Re: portaudio, LynxTWO-B and Linux/OSS
Matthew Robbetts <wingfeathera <at> gmail.com>
2010-04-06 10:57:23 GMT
Thanks for your reply (and the link). I love neat code!
Now, there's a very good chance that I am being obtuse, so please bear
with me. However, I don't understand your answer. I know that you can
specify the desired number of channels when opening a stream by
setting PaStreamParameters.channelCount to the number of channels you
need. Pa_OpenStream() accepts a PaStreamParameters struct to detail
the stream inputs, and another one to detail the stream outputs. So,
when using Portaudio under Windows/ASIO, it was possible just specify
2 in this field of the `input' struct, 8 in this field of the `output'
struct, and open the one stream with a single call to Pa_OpenStream().
However, with Linux/OSS, my one multichannel sound card appears as 16
separate (stereo) devices to Portaudio. Trying to open more than 2
channels onto one of these devices doesn't work. If I understand it
correctly, your code receives in a single PaDeviceInfo, which in my
case would describe a single stereo device, so I can't see how this
problem is avoided.
Have I got it wrong?
Thanks a lot,
On 5 April 2010 21:43, Albert Santoni <alberts <at> mixxx.org> wrote:
> Hi Matthew,
> On Sat, Apr 3, 2010 at 7:25 PM, Matthew Robbetts <wingfeathera <at> gmail.com> wrote:
>> Hi all,
>> I'm writing an application to use Portaudio with a Lynx TWO-B sound
>> card. The only driver for this card under Linux is OSS. Now, I used this
>> card with Portaudio under Windows back in the day, with ASIO, and had no
>> problems. I'm looking to port that application to Linux.
>> Now, the problem: under Linux/OSS, this multichannel card is presented
>> as separate stereo inputs and stereo outputs. The internal hardware
>> mixer of the card can deal with 16 channels each of input and output, so
>> OSS presents it as 16 stereo pairs. My application (a loudspeaker
>> crossover processor) requires streaming from 2 inputs to 8 outputs. Can
>> you comment on the best way to achieve this with callback I/O in
>> portaudio, given the behaviour of the driver? IIRC the windows driver
>> for this card behaves similarly, but additionally presents a big
>> multichannel ASIO device, so I just used that in the old version.
>> I presume that blocking I/O might be applicable for this problem (I've
>> not used that before), but the callback method seems much neater and
>> more extensible, if I can somehow control this I/O with a single PA
>> stream. However, at the moment it looks like all I can do is open 5
>> separate stereo streams and have separate callbacks for each, which I
>> think would then need centralised buffering and manual synchronisation
>> between all the callbacks - not so neat anymore. Any ideas? I imagine
>> I've missed something silly.
> The recommended way to approach this would be to open a single stream,
> which have your 5 stereo channel pairs interleaved, along with the two
> input channels. When you're setting up your stream parameters, you can
> specify how many output and input channels you want opened, so you
> shouldn't have any problems there. You'll only have one callback
> method too...
> I've written code using PortAudio that handles all of this, and it
> might be useful as an example for you:
> Check out the SoundDevicePortAudio::open() function there, especially
> lines 164-185 to see how I set up the stream parameters.
> Good luck, and hope this helps,
> Portaudio mailing list
> Portaudio <at> music.columbia.edu