Open Sound System
|Do you have problems with sound/audio application development? Don't panic! Click here for help!|
int (*adrv_set_rate) (int dev, int rate);
The first paramater (
dev) is anways the audio engine number which is an index to the audio_engines table. The driver can use the audio_engines entry to find out some of the current parameters. In particular the devc, portc, portc_play and portc_record fields can be used to locate the driver defined structures for the audio engine.
The purpose of this audio driver method is very simple. It sets the sampling rate to be used when the adrv_prepare_for_input and adrv_prepare_for_output methods get called to start the device. The change in the sampling rate must in no case take effect immediately. Instead the driver should store the new rate in the portc structure for the engine until the adrv_prepare_for_* method gets called.
rate parameter gives the new sampling rate in Hz. Value of 0 is a special case used when the audio core wants to know the current sample rate (it should get returned without any change to the device state or the driver variables).
The driver should verify that the requested rate is supported by the device. If the rate is not supported then the nearest possible rate should be returned.
The function return value should be the sampling rate the device will be used when the device is started.
If the device supports only one sampling rate then it's recommended that the ADEV_FIXEDRATE flag is set in the adev_t structure and the
fixed_rate field is set to match that rate.
In some cases the driver may need to check that the sampling rate, sample format and number of channels are compatible with each other. This may be tricky to implement since all these parameters are set separately. However it's safe to assume that number of channels will be set first and sampling rate last. Applications that don't follow this recommendation will not work properly.
Audio driver entry point should return 0 if the call was successful. Negative return value (-errno) means that an error has occurred. However some of the functions have void type and they don't return any value.
|audio/oss_audio_core.c||Audio core functionality of OSS|
|include/ossddk.h||Source file oss-current/kernel/framework/include/ossddk/ossddk.h|
|remux/oss_remux.c||Multi channel playback support for devices with multiple stereo engines.|