Re: AudioConverterConvertBuffer sample?
Re: AudioConverterConvertBuffer sample?
- Subject: Re: AudioConverterConvertBuffer sample?
- From: email@hidden
- Date: Fri, 8 Mar 2002 04:55:34 -0600 (CST)
Although my code has a number of differences from yours, the thing that
looks problematic to me is that you're not modifying the various bit/byte
length fields in the AudioStreamBasicDescription (mBitsPerChannel, etc.)
to reflect the size difference between SInt16 and float. As a check I
just converted buffers of type int to float and little endian int to big
endian float (a 30MB track), doing each twice via a repeated call to
AudioConverterConvertBuffer without a problem.
Ben
On Thu, 7 Mar 2002 email@hidden wrote:
>
>If you could please post an example (and/or put it in a bug at
>
>bugreporter), that would be helpful.
>
>
The following sample code simply tries to use an AudioConverter
>
to go from signed int -> float, but every second call to AudioConverterConvertBuffer fails with -50, even when called twice
>
in a row on the same data.
>
>
------------------
>
>
uiParamSize = sizeof(AudioStreamBasicDescription);
>
verify_noerr( AudioUnitGetProperty( sOutputUnit,
>
kAudioUnitProperty_StreamFormat,
>
kAudioUnitScope_Output,
>
0,
>
&sDstStreamFormat,
>
&uiParamSize ) );
>
>
memcpy( &sSrcStreamFormat,
>
&sDstStreamFormat,
>
sizeof(AudioStreamBasicDescription) );
>
>
sSrcStreamFormat.mFormatFlags =
>
kLinearPCMFormatFlagIsSignedInteger |
>
kLinearPCMFormatFlagIsBigEndian |
>
kLinearPCMFormatFlagIsPacked;
>
>
verify_noerr( AudioConverterNew( &sSrcStreamFormat,
>
&sDstStreamFormat,
>
&sConverter ) );
>
>
------------------
>
>
UInt32 uiBufferSize = uiSize * 2;
>
Handle hAudioBuffer = NewHandle( uiBufferSize );
>
>
HLock( hAudioBuffer );
>
err = AudioConverterConvertBuffer( sConverter,
>
uiSize, pBuffer,
>
&uiBufferSize,
>
*hAudioBuffer );
>
>
// err == -50 every second call, which gives me nice stuttering audio :)
>
>
------------------
>
>
TIA!
>
>
--
>
fruit is good
>
>
Hush provide the worlds most secure, easy to use online applications - which solution is right for you?
>
HushMail Secure Email http://www.hushmail.com/
>
HushDrive Secure Online Storage http://www.hushmail.com/hushdrive/
>
Hush Business - security for your Business http://www.hush.com/
>
Hush Enterprise - Secure Solutions for your Enterprise http://www.hush.com/
>
>
Looking for a good deal on a domain name? http://www.hush.com/partners/offers.cgi?id=domainpeople
>
_______________________________________________
>
coreaudio-api mailing list | email@hidden
>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/coreaudio-api
>
Do not post admin requests to the list. They will be ignored.
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.