Linux声卡驱动相关的ioctl属性

The ioctl() system call

All OSS system calls follow the familiar Posix/Unix semantics. Please look at the standard manual page (man ioctl) for more informtion. This section will only explain some OSS related details. The error codes returned by OSS as well as their meaning will be described in the Possible error codes (errno) returned by OSS calls section.

The available ioctl call set depends on the device and the calls will be described in the chapters for each device type. All ioctl calls are non-blocking ones except few exceptions that are used to wait until the device has played all of the data written to it.

Some of the ioctl calls have no parameters at all. However most of them have one parameter that is a pointer to an integer variavle or to some structure. The function return of the ioctl() system call has no defined meaning. However return value of -1 means that an error has occurred. In that case the errno system variable will contain the exact error code (see above).

Even if the ioctl call didn't return error it's necessary to check the argument value to see if the device accepted the requested value. Many ioctl calls will use the nearest possible value of the one requested by the application was not supported. For example if an application requests sampling rate of 44000 Hz the device may change it to 44100 Hz. It's responsibility of the application to check if the returned value is suitable for it's purposes.

Most ioctl calls will return only when the application did something seriously wrong. Another reason to an error is that the device is not working properly. If a minor error occurred the ioctl call will just silently modify the argument to the value being actually used.

With OSS the return value of ioctl() is used only for error reporting. The return value has no defined meaning when the call was successful (and it will be 0 in most cases). Applications that use the ioctl return value are likely to fail under different OSS implementations.

Ioctl calls available on audio devices

Source Explanation
SNDCTL_DSP_BIND_CHANNEL Route stereo output to the specified channels (obsolete)
SNDCTL_DSP_CHANNELS Set the number of audio channels
SNDCTL_DSP_COOKEDMODE Disable/enable the "on fly" format conversions made by the OSS software
SNDCTL_DSP_CURRENT_IPTR Returns the current recording position
SNDCTL_DSP_CURRENT_OPTR Returns the current playback position
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值