Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: old mtcoreaudio code doesn't work now
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: old mtcoreaudio code doesn't work now




On Dec 21, 2007, at 10:46 AM, Jaime Magiera wrote:


On Dec 21, 2007, at 12:53 PM, Robert Ackerman wrote:

it complains about a bad method call which, indeed, does not now exist:

inConverter = [[MTConversionBuffer alloc]
       initWithSourceDescription:shtoomDescription
                    bufferFrames:inBufferSize
          destinationDescription:[MTConversionBuffer descriptionForDevice:outputDevice forDirection:kMTCoreAudioDevicePlaybackDirection]
                    bufferFrames:ceil ( [outputDevice deviceMaxVariableBufferSizeInFrames] * SR_ERROR_ALLOWANCE )];

there is no such initializer, now.
so, i need to figure out how to translate everything in my allocConterer method to what MYConversionBuffer now expects.
my old code used a AudioStreamBasicDescription object to pass to the conversion buffer init. i see that initWithSourceSampleRate ends up creating such an object within itself, so that is my clue.
i will try to refactor my code to just pass in the params that method asks for.

Hello,

Looking at the MTConversionBuffer class, there are three init methods...

- initWithSourceDevice:(MTCoreAudioDevice *)inputDevice destinationDevice:(MTCoreAudioDevice *)outputDevice

- initWithSourceSampleRate:(Float64)srcRate channels:(UInt32)srcChans bufferFrames:(UInt32)srcFrames destinationSampleRate:(Float64)dstRate channels:(UInt32)dstChans bufferFrames:(UInt32)dstFrames minimumBufferSeconds:(Float64)minBufferSeconds

- (Boolean) _initAudioConverterWithSourceSampleRate:(Float64)srcRate channels:(UInt32)srcChans destinationSampleRate:(Float64)dstRate channels:(UInt32)dstChans

It looks like first two are usable in your situation. The third creates the actual Converter -- which may or may not be all you need. Note that MTConversionBuffer is a wrapper for AudioConverterRef, which you would allocate with...
extern OSStatus AudioConverterNew(     
	const AudioStreamBasicDescription*inSourceFormat,     
	const AudioStreamBasicDescription*inDestinationFormat,     
	AudioConverterRef*outAudioConverter);  
What I would do is check elsewhere in the code and see if using MTConversionBuffer is necessary (does the wrapper provide an important functionality? or could you just use the AudioConverterRef and its accompanying setProperty/getProperty methods?)
does that help?
Jaime
thanks for responding -- 
i inherited the code which uses MTCoreAudio including MTConversionBuffer as a wrapper.
the MTConversionBuffer code handles reads/writes/flushes and callbacks to the app code, so i really don't want  to elimiate it.
but i think i have enough to go on here. i will use one of the other init methods and see what happens.

b
 _______________________________________________
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: 
 >old mtcoreaudio code doesn't work now (From: Robert Ackerman <email@hidden>)
 >Re: old mtcoreaudio code doesn't work now (From: Jaime Magiera <email@hidden>)
 >Re: old mtcoreaudio code doesn't work now (From: Robert Ackerman <email@hidden>)
 >Re: old mtcoreaudio code doesn't work now (From: Jaime Magiera <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.