Wave data and CoreAudio
Wave data and CoreAudio
- Subject: Wave data and CoreAudio
- From: Hari Seldon <email@hidden>
- Date: Thu, 17 Aug 2006 19:35:27 -0400
I'm testing my audio implementation by streaming wave audio data into
it. Basically I'm using AudioFileOpen, AudioFileReadBytes, etc, to
get the audio data, then copy this data into a buffer that is used to
feed an inputCallback on an AUConverter. The data I'm using is a
windows wave audio file (2 channels, 44.1k rate, 16 bit), and I'm
putting this into an audio converter using the format:
inputFormat.mSampleRate = 44100;
inputFormat.mFormatID = kAudioFormatLinearPCM;
inputFormat.mFormatFlags = kLinearPCMFormatFlagIsSignedInteger;
inputFormat.mChannelsPerFrame = 2;
inputFormat.mBitsPerChannel = 16;
inputFormat.mFramesPerPacket = 1;
inputFormat.mBytesPerFrame = 4;
inputFormat.mBytesPerPacket = 4;
Most of these settings are calculated at runtime, but for my sample
this is what they are.
I have the converter set to output into a mixer, and i've given the
converter an output format that matches the mixers input format (used
Get/Set on the formats, etc).
When the inputCallback requests data I read it out of my buffer (byte
array), and I have another thread that will refill the empty room in
the buffer by reading more data from the file. This way the buffer
pretty much always has data in it, and i should be able to keep the
inputCallback fully supplied with data.
The problem that I'm hitting is that the audio sounds okay for a short
period then it sounds like it gets some static (pops), and it will
occasionally sound slowed down or rushed (very slightly). I'm
wondering if the converter is altering the playback a little? Are
there extra considerations I need to make when providing audio data
this way? I think the InputCallback is always getting a full buffer
worth of data (as I always seem to have extra data loaded).
I've also tried adding in some other mFormatFlags incase I had the
format off a little, but that didn't seem to fix the problem.
Any ideas?
Thanks
_______________________________________________
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