Re: old mtcoreaudio code doesn't work now
Re: old mtcoreaudio code doesn't work now
- Subject: Re: old mtcoreaudio code doesn't work now
- From: Michael Thornburgh <email@hidden>
- Date: Sat, 22 Dec 2007 00:37:00 -0800
-[MTConversionBuffer
initWithSourceSampleRate:channels:bufferFrames:destinationSampleRate:channels:bufferFrames:minimumBufferSeconds
:] is the designated initializer. -[MTConversionBuffer
initWithSourceDevice:destinationDevice:] is a convenience initializer
that queries the given input and output devices for their properties
and uses some reasonable defaults for other parameters. the third
method Jaime mentions is an internal method (hence the leading "_" and
absence from the public API in the header file) and should never be
used by a client.
it looks like the designated initializer is the one you want. you
could say something like
inConverter = [[MTConversionBuffer alloc] initWithSourceSampleRate:
[shtoomDescription sampleRate] channels: [shtoomDescription
channelsPerFrame] bufferFrames: SOME_REASONABLE_NUMBER_OF_FRAMES
destinationSampleRate: [outputDevice nominalSampleRate] channels:
[outputDevice channelsForDirection:
kMTCoreAudioDevicePlaybackDirection] bufferFrames: [outputDevice
deviceMaxVariableBufferSizeInFrames] * SR_ERROR_ALLOWANCE
minimumBufferSeconds: 1.0];
-mike
On Dec 21, 2007, at 11:08 AM, Robert Ackerman wrote:
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
_______________________________________________
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