Open PortAudio-admin opened 16 years ago
Comment by @RossBencina
Moved half of this to a separate ticket targetting the buffer processor.
Comment by @philburk
A long time ago Roman M. Shulakov wrote: I believe there might be a bug in a MacOS part when playing audio from separate non-interleaved buffers using blocking API. If I got it right, one needs to OR 'paNonInterleaved' flag with a sample format in use when describing PA stream parameters. After this Pa_WriteStream() will take an array of (void *) pointers to separate buffers, one per channel, instead of a pointer to one large interleaved buffer. This works nicely on Linux. On OSX however, Pa_WriteStream() never returns. I traced it down to internal ring buffer having size of zero thus never being ready to accept a single byte of data. This condition seems to be caused by 'computeSampleSizeFromFormat()' and 'computeSampleSizeFromFormatPow2()' procs in 'pa_mac_core_blocking.c' not expecting any extra flags OR'ed with a sample format.
Next I tried to help it by changing lines 79 and 94 from:
switch( format ) {
to:
switch( format & (~paNonInterleaved) ) {
This gave an internal ring buffer a reasonable size, however it also caused a memory corruption in CoreAudo RT thread (I think). Any ideas?
Comment by @philburk
I verified Roman's analysis of the computeSampleSizeFromFormat() error.
Comment by @philburk
It looks like the fix is non-trivial. The implementation uses the ringbuffer to write data to CoreAudio. We probably need to interleave the data as it is written to the ringbuffer and then make the back iend run in interleaved mode.
For now I just added code to detect paNonInterleaved and return paSampleFormatNotSupported. I also fixed the switch statements that return sample size.
Comment by @RossBencina
TRAC migration: propagating ticket status from TRAC
Note that PA/ASIO implements ReadStream() and WriteStream() using the PaBufferProcessor, which should be able to handle the interleaved and non-interleaved cases. This code code could be copied/adapted.
But note that there might be a bug in the PA/ASIO ReadStream implementation: https://github.com/PortAudio/portaudio/issues/746
Issue created by @RossBencina
There is no test for this case either.
See mailing list discussion thread 19/2/2008: Re: [Portaudio] ASIO Blocking I/O Patch Implementation (a ring buffercontaining frames, not bytes)
Yes, since that sounds like a major issue and I won't be able to
address that anytime soon. Is there a test for it?
[nope]
There is a ticket to implement the test: #83