Re: Really puzzling ExtAudioFileRead crash...
Re: Really puzzling ExtAudioFileRead crash...
- Subject: Re: Really puzzling ExtAudioFileRead crash...
- From: "Stephan M. Bernsee" <email@hidden>
- Date: Mon, 7 Jan 2008 15:19:29 +0100
Hi Adrian,
thank you for responding.
So if I understand you correctly - what you're saying is that I am not
using the correct format in my ABL, or more specifically, I am not
allowed to use a single buffer with two channels in it when I call
ExtAudioFileRead()?
I could not find anything in the documentation indicating that channel
interleaved data buffers are not allowed when reading from an
ExtAudioFile - could you please provide a reference for this?
Also, I have rewritten the code to use a separate buffer for each
channel as you have suggested, but it does not seem to make a
difference. The crash after 26 seconds is still there, it just happens
a bit deeper down at the same place in the bowels of the CA code...
#0 0x91f62978 in MPEGAudioFile::ReadPackets
#1 0x91f6284c in MPEGAudioFile::ReadPackets
#2 0x91f81440 in ExtAudioFile::ReadInputProc
#3 0x91ef9794 in AudioConverterChain::DirectCallInputProc
#4 0x91ef9598 in CodecConverter::CallInputProc
#5 0x91ef90ac in CodecConverter::DecoderFillBuffer
#6 0x91eef0dc in BufferedAudioConverter::GetInputBytes
#7 0x91eeef58 in CBRConverter::RenderOutput
#8 0x91eeece0 in BufferedAudioConverter::FillBuffer
#9 0x91eeee50 in AudioConverterChain::RenderOutput
#10 0x91eeece0 in BufferedAudioConverter::FillBuffer
#11 0x91f02d04 in AudioConverterFillComplexBuffer
#12 0x91f83bd8 in ExtAudioFile::Read
#13 0x91f77488 in ExtAudioFileRead
#14 0x000027c8 in -[EAFRead readFloatsConsecutive:intoArray:] at
EAFRead.mm:130
#15 0x00002a80 in -[EAFRead init] at EAFRead.mm:188
#16 0x000023cc in main at main.m:11
The modified code is at
http://stephan.bernsee.com/ExtAudioFileReadTestNoninterleaved.zip
(47 kB)
Btw. what your modification does is reading samples into the same
(overlapping) memory space, potentially overwriting buffer boundaries
in the process...!
Thanks again for your input
Stephan Bernsee
2008/1/7, Adrian Pflugshaupt <email@hidden>:
> Hi all,
>
> I'm currently doing the (almost) same thing and in my opinion the
> problem is how you set up the buffer list.
> I think you need to use two buffers, not one buffer with two
channels.
> I changed a section in your code to this and then the crash was gone:
>
> bufList.mNumberBuffers = 2;
> bufList.mBuffers[0].mNumberChannels = 1; //extAFNumChannels; //
Always
> 2 channels in this example
> bufList.mBuffers[0].mData = data; // data is a pointer (float*) to
our
> sample buffer
> bufList.mBuffers[0].mDataByteSize = samples * sizeof(float);
> bufList.mBuffers[1].mNumberChannels = 1; //extAFNumChannels; //
Always
> 2 channels in this example
> bufList.mBuffers[1].mData = data + kSegmentSize/2; // data is a
> pointer (float*) to our sample buffer
> bufList.mBuffers[1].mDataByteSize = samples * sizeof(float);
>
> I had lots of crashes as well initially, but then I switched over to
> using all the CA... classes which make my life a lot easier and they
> use the ExtAudioFile calls internally. The whole thing then just
> becomes:
>
> CAAudioFile audioFile;
> audioFile.Open("/test.mp3");
> CAStreamBasicDescription format = audioFile.GetFileDataFormat();
> format.SetCanonical(format.NumberChannels(), false);
> audioFile.SetClientFormat(format);
>
> UInt32 numSamples = 512;
> AUOutputBL outputBuffer(format, numSamples);
> outputBuffer.Allocate(numSamples);
> outputBuffer.Prepare();
> audioFile.Read(numSamples, outputBuffer.ABL());
>
> // Then the actual samples can be accessed this way (for a stereo
file)
> void* channel0data = outputBuffer.ABL()->mBuffers[0].mData;
> void* channel1data = outputBuffer.ABL()->mBuffers[1].mData;
>
> Best Regards,
>
> Adrian Pflugshaupt (apulSoft)
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden