Skip to contentSkip to conversation

SND_PCM_OPEN_PLAYBACK & SND_PCM_OPEN_CAPTURE

DISCUSSION Damien Sandras 2 participants 5 messages Aug 13, 2003

lore
Share & tools
lore
#0 lore raw

Hello,

I would like to know if it is always possible to open the same device twice at the same time : once with SND_PCM_OPEN_PLAYBACK and once with SND_PCM_OPEN_CAPTURE.

I know it is not possible with OSS, but I wanted to know if ALSA makes it possible or if the device has to be opened only once with SND_PCM_OPEN_DUPLEX in that case.

Thanks a lot!

Signature · 9 lines
Damien Sandras <[email protected]>



-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
#1 lore raw

I just noticed I was looking at the old API :)

With the new API, I think it always work to open the same device twice (once for PLAYBACK STREAM and once for CAPTURE STREAM) at least for full-duplex soundcards. If I'm wrong, can somebody correct me?

Thanks,

Quoted 11 lines · Damien Sandras

Hello,

I would like to know if it is always possible to open the same device twice at the same time : once with SND_PCM_OPEN_PLAYBACK and once with SND_PCM_OPEN_CAPTURE.

I know it is not possible with OSS, but I wanted to know if ALSA makes it possible or if the device has to be opened only once with SND_PCM_OPEN_DUPLEX in that case.

Thanks a lot!

Signature · 9 lines
Damien Sandras <[email protected]>



-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
#2 lore raw
Quoted 5 lines

I just noticed I was looking at the old API :)

With the new API, I think it always work to open the same device twice (once for PLAYBACK STREAM and once for CAPTURE STREAM) at least for full-duplex soundcards. If I'm wrong, can somebody correct me?

yes, if the h/w can do full-duplex, then this will always work (and as you noticed, there is no "DUPLEX" mode anymore - you always get one handle for playback and a different one for capture).

note that some cards (the early SB series come to mind) will not support the same parameters for playback and capture when opened for duplex usage, so it can a bit more complex than you'd really like.

--p

-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01

#3 lore raw
Quoted 4 lines · Paul Davis

yes, if the h/w can do full-duplex, then this will always work (and as you noticed, there is no "DUPLEX" mode anymore - you always get one handle for playback and a different one for capture).

That is a good news for me.

Quoted 4 lines

note that some cards (the early SB series come to mind) will not support the same parameters for playback and capture when opened for duplex usage, so it can a bit more complex than you'd really like.

How can I determine that and solve that problem? Is there a source code example that I could look at?

Many thanks for your support.

I'm currently porting GnomeMeeting to be able to use native ALSA.

Signature · 9 lines
Damien Sandras <[email protected]>



-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
#4 lore raw
Quoted 7 lines
Quoted 4 lines

note that some cards (the early SB series come to mind) will not support the same parameters for playback and capture when opened for duplex usage, so it can a bit more complex than you'd really like.

How can I determine that and solve that problem? Is there a source code example that I could look at?

you can only find out by trying it.

if you always open "plughw:N" (where N is going to be 0 for most users, since most people have only soundcard), this won't matter, because a "plughw" device will support (almost) any parameters you use.

the limitations of the hardware only matter if you try to open "hw:N", which will expose the stupid (cheap) design of the soundcard. there is no workaround for "hw" device other than to use a "plughw" device instead.

--p

-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01