Re: extaudiofileread stereo float (iOS)
Re: extaudiofileread stereo float (iOS)
- Subject: Re: extaudiofileread stereo float (iOS)
- From: Gregory Wieber <email@hidden>
- Date: Thu, 23 Feb 2012 20:25:06 -0800
Ha, yes I know what noninterleaved means. Paul wrote back and said that they were actually de-interleaving in a separate step, and the code Tahome mentioned also does the de-interleaving in a separate step, so I was just beginning to wonder if anyone was actually using two buffers and getting noninterleaved directly from the extAudioFileRead. But... clearly you said you were, and I should have trusted you :)
Thanks so much for your time and posting this. Unfortunately, it's essentially what I'm already doing.
I'm not entirely hazy on the variable length array concept, but I'm wondering (and this is more a general C thing, so I should post elsewhere) how to debug a variable length array. Because, as far as the debugger is concerned it is still an array of length 1; even though clearly the two buffers have been allocated. It just makes it hard for me to peak under the hood and solve the problem. When I simply print the values in the buffers, they're identical for left and right.
I trashed the original ASBD because I had to get passed the problem, and for this particular bit mono is fine, but I do want to solve the problem so I'll reconstruct it and post it.
But, I think Paul is right – the code that I'm trying to shove this into is complex, with many moving parts so the smart thing to do (instead of me wasting everyone's time) is to create a small test app. I might have time this weekend.
Greg
On Thu, Feb 23, 2012 at 12:04 PM, Michael Tyson
<email@hidden> wrote:
That's right - that's what noninterleaved means: Each channel is treated separately.
It can be a little confusing, because the AudioBufferList structure defines only a single AudioBuffer within it - you have to either allocate space for the buffer list + the extra buffer, or use a struct or something on the stack.
For example, to prepare an AudioBufferList on the stack, to receive kBufferSize floating-point, stereo, non-interleaved samples:
struct { AudioBufferList bufferList; AudioBuffer secondBuffer; } buffers;
buffers.bufferList.mNumberBuffers = 2;
for ( int i=0; i<buffers.bufferList.mNumberBuffers; i++ ) {
buffers.bufferList.mBuffers[i].mNumberOfChannels = 1;
buffers.bufferList.mBuffers[i].mDataByteSize = kBufferSize * sizeof(float);
buffers.bufferList.mBuffers[i].mData = malloc(kBufferSize * sizeof(float));
}
--
A Tasty Pixel: App artisans
Latest news: Loopy HD wins 2nd place in the 2011 Best App Ever Awards for Best Musicians App!
On 23 Feb 2012, at 18:06, Gregory Wieber wrote:
Thanks Michael,
Sure - I'll post it when I put together a more simple test app.
Curious: were you reading the noninterleaved audio into two different buffers in a bufferlist? That's the thing I can't seem to find any examples of online.
best,
Greg
On Thu, Feb 23, 2012 at 2:22 AM, Michael Tyson
<email@hidden> wrote:
_______________________________________________
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
_______________________________________________
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