Hello again everyone.
Would those of you affected by bug 900364
(https://bugs.launchpad.net/mixxx/+bug/900364) regarding corrupt audio
when using the microphone on Linux please compile PortAudio with the
attached patch and see if it corrects the problem? (Patch is attached to
the bug report as well.)
Sincerely,
Sean M. Pappalardo
"D.J. Pegasus"
Mixxx Developer - Controller Specialist
--- Begin Message ---
On Sunday 13 October 2013 23:31, RJ Ryan wrote:
> The cause was indeed identified. The line that Clemens pointed out from the
> ALSA hostapi in PortAudio fully explains the observations we've seen with
> this bug over the years. (for example, the screenshot you just sent out is
> exactly as expected given that line of code and a device with a minimum of
> 2 input channels).
Well I class that more as useful speculation. Clemens was probably not aware
that Portaudio is coded with the intention of handling the cases where
(hostChans != userChans), so finding they can differ is not a big surprise.
However, it was clear from my test that in some cases it is not being done
correctly.
....read on....
On another machine with ice1712 card, where hw:0 can only be opened for
capture with 12 channels, it is fine to record with any number of channels
from 1 to 12 and Portaudio does adjust fine, as intended.
I have tracked the issue down, I believe, to inside the buffer processing.
When the formats do not differ (and there is no de-interleaving to do) the
input conversion is skipped, and this thwarts the mechanism for input channel
adaption, that uses the input data stride, since data is not then
transferred. When the formats do differ, correct channel adaption occurs.
It is possible that Alsa hw devices are the only users of this adaption
mechanism, even though it is in the common code.
This can be remedied by adding a check for matching channel numbers when
deciding whether to skip the conversion.
Ross, Phil, can you check the reasonableness of this approach, since I am not
very familiar with the buffer processing etc?
The attached patch to pa_process.c resolves the issues identified in my
earlier tests. Perhaps others would like to test if it resolves all the
cases of bad mono recording, or if there is still another issue. Also bear
in mind it may not be the final solution.
"pa_process-chans-no-skip.diff"
Regards
Alan
--- svn-working-copy/src/common/pa_process.c 2013-08-13 21:35:27.000000000 +0100
+++ lib-src/portaudio-v19/src/common/pa_process.c 2013-10-16 08:46:44.000000000 +0100
@@ -743,8 +744,10 @@
destSampleStrideSamples = bp->inputChannelCount;
destChannelStrideBytes = bp->bytesPerUserInputSample;
- /* process host buffer directly, or use temp buffer if formats differ or host buffer non-interleaved */
- if( bp->userInputSampleFormatIsEqualToHost && bp->hostInputIsInterleaved && bp->hostInputChannels[0][0].data)
+ /* process host buffer directly, or use temp buffer if formats differ or host buffer non-interleaved,
+ * or if the number of channels differs between the host (set in stride) and the user */
+ if( bp->userInputSampleFormatIsEqualToHost && bp->hostInputIsInterleaved
+ && bp->hostInputChannels[0][0].data && bp->inputChannelCount == hostInputChannels[0].stride)
{
userInput = hostInputChannels[0].data;
destBytePtr = (unsigned char *)hostInputChannels[0].data;
_______________________________________________
Portaudio mailing list
portau...@music.columbia.edu
http://music.columbia.edu/mailman/listinfo/portaudio
--- End Message ---
------------------------------------------------------------------------------
November Webinars for C, C++, Fortran Developers
Accelerate application performance with scalable programming models. Explore
techniques for threading, error checking, porting, and tuning. Get the most
from the latest Intel processors and coprocessors. See abstracts and register
http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk
_______________________________________________
Get Mixxx, the #1 Free MP3 DJ Mixing software Today
http://mixxx.org
Mixxx-devel mailing list
Mixxx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mixxx-devel