Thanks!
One more problem: I'm using this all from within a class. I can't
seem to
define an appropriate callback to AudioConverterFillBuffer without
the
compiler choking. The callback is defined as:
class sample{
...
...
private:
...
OSStatus dataProc( AudioConverterRef inAudioConverter,
UInt32* ioDataSize,
void** outData,
void* inUserData);
...
}
and AudioConverterFillBuffer is being called via:
AudioConverterFillBuffer( audioConv, &Sample::dataProc, NULL,
&m_uLength,
&m_fFrames[0] );
The compiler says, "error: invalid static_cast from type 'OSStatus
(Sample::*)(OpaqueAudioConverter*, UInt32*, void**, void*)' to type
'OSStatus (*)(OpaqueAudioConverter*, UInt32*, void**, void*)'"
The compiler seems not to like the fact that my callback is part of
a class.
Is there a better way to do this, or a way to circumvent the
callback? As
I'm just converting from a buffer stored in memory, it seems a little
circuitous to have to use a callback.
Thanks again,
Aaron
On Feb 12, 2008, at 11:24 PM, Art Gillespie wrote:
It looks like you're reading in the raw bytes--you want to convert
the
format to 32-bit float canonical at the current sample rate so that
you'll get the expected results in Render. Check out
AudioConverterNew, AudioConverterFillBuffer, etc. in
<AudioToolbox/AudioConverter.h>
Best,
Art
On Feb 12, 2008 8:59 PM, Aaron Wishnick <email@hidden>
wrote:
I'm writing an audio unit which will need to load audio files into
memory.
I'm confused by all the different interfaces available. Here's what
I'm
using so far. When I play the sound back in Process(), I get
static, so I'd
like to know if anybody sees anything glaring here:
OSStatus Sample::Open( std::string filename ) {
FSPathMakeRef((UInt8 *)filename.c_str(), &m_fsRef, NULL);
OSStatus retVal = AudioFileOpen ( &m_fsRef, fsRdPerm, 0, &m_fileID );
// should do error checking here
UInt32 uSize = sizeof( m_uLength );
AudioFileGetProperty( m_fileID, kAudioFilePropertyAudioDataByteCount,
&uSize, &m_uLength);
m_fFrames.resize( m_uLength, 0.0f );
retVal = AudioFileReadBytes( m_fileID, false, 0, &m_uLength,
&m_fFrames[0]
);
return retVal;
return 0;
}
_______________________________________________
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