Converting OSS ioctl's to ALSA API
Hello,
I'm converting the audio subroutines of a video-conferencing application from using OSS to using ALSA. This app uses the blocking-read/write model.
I've read through all of the documentation I could find, but am not sure how to convert some of the more "advanced" OSS ioctl's directly to ALSA Library API calls.
For example, what would be the equivalent of the OSS SNDCTL_DSP_SYNC ioctl? The previous programmer used this to wait for playback completion.
Another example would be the equivalent of the SNDCLT_DSP_GETOSPACE, SNDCTL_DSP_GETISPACE and SNDCTL_DSP_SETFRAGMENT ioctls.
BTW, in case anyone mentions it, we don't want to use the OSS emulation mode, as it hasn't worked-out for us.
Any help would be most appreciated.
Thanks,
Bob
-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
Quoted 1 line · Bob Ingraham
what would be the equivalent of the OSS
SNDCTL_DSP_SYNCioctl?
snd_pcm_drain()
Quoted 1 line
SNDCTL_DSP_SETFRAGMENT
snd_pcm_hw_params_set_period_size()snd_pcm_hw_params_set_periods()
Quoted 1 line
SNDCLT_DSP_GETOSPACE,SNDCTL_DSP_GETISPACE
snd_pcm_avail_update()
HTH
Clemens
-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
Thank-you so much for ioctl mapping!
May I ask one other architectural question?
This video-conferencing app expected to use two half-duplex devices for simultaneous record-playback:
/dev/dsp0 and /dev/dsp1 - these were expected to be configured as the separate playback and record channels of a single soundcard.
However, on all of our target platforms (all running SuSE/Novell-Linux-Desktop,) there only appears to be a single, full-duplex device to use (plugwh:0,0) for both record and playback.
So the (three-part) question is:
1. Do I:
(a) Try to re-write this app to use full-duplex? or,
(b) Can I re-configure ALSA to split the default device (plughw:0,0)
into two separate, half-duplex sub-devices (one for playback and one for record?
2. Which approach makes more sense (i.e., more stable, reliable, etc.)?
3. If 1a is the way to go, is there a tutorial or sample-doc on how to properly program full-duplex (simultaneous record & playback) operation under ALSA?
Thanks,
Bob
Quoted 10 lines
Quoted 1 line · Bob Ingraham
what would be the equivalent of the OSS
SNDCTL_DSP_SYNCioctl?
snd_pcm_drain()Quoted 1 line
SNDCTL_DSP_SETFRAGMENT
snd_pcm_hw_params_set_period_size()snd_pcm_hw_params_set_periods()
Quoted 9 lines
Quoted 1 line
SNDCLT_DSP_GETOSPACE,SNDCTL_DSP_GETISPACE
snd_pcm_avail_update()HTH
Clemens
-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
Quoted 28 lines · Bob Ingraham
Thank-you so much for ioctl mapping!
May I ask one other architectural question?
This video-conferencing app expected to use two half-duplex devices for simultaneous record-playback:
/dev/dsp0and/dev/dsp1- these were expected to be configured as the separate playback and record channels of a single soundcard.However, on all of our target platforms (all running SuSE/Novell-Linux-Desktop,) there only appears to be a single, full-duplex device to use (plugwh:0,0) for both record and playback.
So the (three-part) question is:
1. Do I:
(a) Try to re-write this app to use full-duplex? or,
(b) Can I re-configure ALSA to split the default device (plughw:0,0)
into two separate, half-duplex sub-devices (one for playback and one for record?2. Which approach makes more sense (i.e., more stable, reliable, etc.)?
Quoted 9 lines
3. If 1a is the way to go, is there a tutorial or sample-doc on how to properly program full-duplex (simultaneous record & playback) operation under ALSA?
Thanks,
Bob
ALSA provides an abstraction layer.
If you open plughw:0,0 for only playback, and then again for only capture it should work.
So, although the device name looks the same, device names for playback and capture are in fact in a different name space. alsa-lib does all the difficult work for you.
Another alternative could be to use jackd. It is ideal for low latency applications, and VoIP is certainly ideal for that.
James
-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
Quoted 2 lines · James Courtier-Dutton
If you open plughw:0,0 for only playback, and then again for only capture it should work.
It should be noted that this is the _only_ way you can use such a device, as snd_pcm_open() opens only one direction at a time.
Your application just shouldn't care if the playback and capture devices happen to have the same name.
HTH
Clemens
-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf