• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: AudioConverterConvertBuffer() and interleaved data
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AudioConverterConvertBuffer() and interleaved data


  • Subject: Re: AudioConverterConvertBuffer() and interleaved data
  • From: Doug Wyatt <email@hidden>
  • Date: Thu, 22 Sep 2005 08:52:05 -0400

On Sep 22, 2005, at 3:08, Herbie Robinson wrote:
Also, for core audio, each channel has to be in it's own buffer. [Right Bill?]

Consider the diagram earlier in this thread: L L L R R R

For a moment I thought of replying that it might be more accurate to show it like this:
L L L
R R R
indeed, to emphasize that the two channels' data had to be in separate buffers, but -- what is a buffer but a pointer?


For example, one could allocate memory for a deinterleaved AudioBufferList as follows, in a single allocation.

#include <CoreAudio/CoreAudioTypes.h>
#include <stdlib.h>
#include <stddef.h>

int i;
static const int kNumChannels = 2;
static const int kNumFrames = 512;
const int kBytesPerChannel = kNumFrames * sizeof(Float32);
char *buffer = malloc(kNumChannels * kBytesPerChannel);
AudioBufferList *abl = (AudioBufferList *)malloc(offsetof (AudioBufferList, mBuffers[kNumChannels]));
abl->mNumberBuffers = kNumChannels;
for (i = 0; i < kNumChannels; ++i) {
abl->mBuffers[i].mNumberChannels = 1;
abl->mBuffers[i].mDataByteSize = kBytesPerChannel;
abl->mBuffers[i].mData = (Float32 *)(buffer + i * kBytesPerChannel);
}



That's the part that I always forget when dealing with the converter. Don't know why exactly, I know that's the convention for AUs, but it doesn't click when dealing with the file converter. Non-interleaved data in a single buffer does exist, BTW (look at DV files sometime).

OK, I haven't looked at DV, but can't you just point the buffer pointers at the right places? AudioConverter makes no assumptions about where the multiple arrays of deinterleaved samples sit in memory and that seems like a good thing.


Doug

--
Doug Wyatt
Core Audio, Apple

_______________________________________________
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


References: 
 >AudioConverterConvertBuffer() and interleaved data (From: Guillermo Lapresta <email@hidden>)
 >Re: AudioConverterConvertBuffer() and interleaved data (From: Guillermo Lapresta <email@hidden>)
 >Re: AudioConverterConvertBuffer() and interleaved data (From: William Stewart <email@hidden>)
 >Re: AudioConverterConvertBuffer() and interleaved data (From: Herbie Robinson <email@hidden>)

  • Prev by Date: Re: AudioConverterConvertBuffer() and interleaved data
  • Next by Date: Re: How to route channels from SynthUnit to a multi-channel device? <solved>
  • Previous by thread: Re: AudioConverterConvertBuffer() and interleaved data
  • Next by thread: IMPORTANT: Tiger QuicKTime 7.0.2 SDK SU Problem
  • Index(es):
    • Date
    • Thread