Re: Newbie Question about AudioConverter
Re: Newbie Question about AudioConverter
- Subject: Re: Newbie Question about AudioConverter
- From: William Stewart <email@hidden>
- Date: Fri, 23 Apr 2004 10:49:18 -0700
There's some starter type code in the latest release of the SDK
(download from
http://developer.apple.com/audio)
That shows you how to read the data packets from a QT movie's audio
track, then pass them off to a converter. The code only deals with AAC
data in an m4a file - but can easily be generalised to deal with any
audio data in a QT movie. The main thing to do is to convert the sound
description contained in a QT movie into an ASBD that Core Audio uses.
As far as encode or decode of the content. QT uses (currently) Sound
Mgr codecs to do that work. Now, the Audio Converter in CoreAudio has
the facility to interface to SM codecs when it can't find an Audio
Codec (which is the way that these services will be supported on the OS
going forward).
So, there's no need to use anything but the audio converter API.
Bill
On 23/04/2004, at 9:17 AM, Christoph Ndgeli wrote:
>
Hi all,
>
>
I got some questions about the API.
>
First, if I use CoreAudio, can I decompress every sound input that
>
QuickTime understands
>
or do I have to choose either QuickTime or CoreAudio?
>
>
Second, I'd like to convert a movie AudioTrack and I would prefer using
>
CoreAudio since the
>
API seems to be easier. Is there any example for it?
>
>
My Code looks as follows, but I got an error
>
(kAudioConverterErr_FormatNotSupported).
>
What's wrong with that?
>
>
And the last one,
>
how can I set the right Converter Configuration from the Standard
>
Sound Dialog?
>
>
Any help would be appreciated.
>
>
--
>
Christoph
>
>
// Convert from Unsigned Fixed to Float64
>
inDesc.mSampleRate =
>
(Float64)((*(SoundDescriptionHandle)gdp.desc)->sampleRate >> 16);
>
inDesc.mSampleRate +=
>
(Float64)Fix2X((*(SoundDescriptionHandle)gdp.desc)->sampleRate &
>
0xFFFF);
>
>
inDesc.mFormatID = (*(SoundDescriptionHandle)gdp.desc)->dataFormat;
>
inDesc.mFormatFlags = 0;
>
>
inDesc.mBytesPerPacket =
>
(*(SoundDescriptionV1Handle)gdp.desc)->bytesPerPacket;
>
inDesc.mFramesPerPacket = 0;
>
inDesc.mBytesPerFrame =
>
(*(SoundDescriptionV1Handle)gdp.desc)->bytesPerFrame;
>
inDesc.mChannelsPerFrame =
>
(*(SoundDescriptionHandle)gdp.desc)->numChannels;
>
inDesc.mBitsPerChannel = 0;
>
inDesc.mReserved = 0;
>
>
SCGetInfo(soundCompressor,scSoundSampleRateType,&outSampleRate);
>
outDesc.mSampleRate = (Float64)(outSampleRate >> 16);
>
outDesc.mSampleRate += (Float64)Fix2X(outSampleRate & 0xFFFF);
>
>
SCGetInfo(soundCompressor, scSoundCompressionType, &outDesc.mFormatID);
>
outDesc.mFormatFlags = 0;
>
outDesc.mBytesPerPacket = 0;
>
outDesc.mFramesPerPacket = 0;
>
outDesc.mBytesPerFrame = 0;
>
>
SCGetInfo(soundCompressor,scSoundChannelCountType,&numChannels);
>
outDesc.mChannelsPerFrame = numChannels;
>
>
outDesc.mBitsPerChannel = 0;
>
outDesc.mReserved = 0;
>
>
// Create the Converter Instance
>
status = AudioConverterNew(&inDesc,&outDesc,&converter);
>
if(status != noErr)
>
goto bail;
>
_______________________________________________
>
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.
>
>
--
mailto:email@hidden
tel: +1 408 974 4056
________________________________________________________________________
__
Culture Ship Names:
Ravished By The Sheer Implausibility Of That Last Statement
I said, I've Got A Big Stick [OU]
Inappropiate Response [OU]
Far Over The Borders Of Insanity And Still Accelerating [Eccentric]
________________________________________________________________________
__
_______________________________________________
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.