old mtcoreaudio code doesn't work now
old mtcoreaudio code doesn't work now
- Subject: old mtcoreaudio code doesn't work now
- From: Robert Ackerman <email@hidden>
- Date: Thu, 20 Dec 2007 23:11:21 -0800
my old code did an 'allocNewConverter' with calls that don't exist in
the lastest version.
any hints on how to adapt this code. probably other issues after that,
so any example code would help.
this is my current code that doesn't work:
- (void) allocNewConverter
{
NSLog(@"allocNewConverter");
Float64 inScale = ([self sampleRate] / [outputDevice
nominalSampleRate]);
unsigned inBufferSize = ceil ( inScale * [outputDevice
deviceMaxVariableBufferSizeInFrames] * SR_ERROR_ALLOWANCE );
if (inBuffer) MTAudioBufferListDispose(inBuffer);
inBuffer = MTAudioBufferListNew(1, inBufferSize, NO);
AudioStreamBasicDescription shtoomDescription;
shtoomDescription.mSampleRate = [self sampleRate];
shtoomDescription.mFormatID = kAudioFormatLinearPCM;
shtoomDescription.mFormatFlags = kLinearPCMFormatFlagIsPacked |
kLinearPCMFormatFlagIsSignedInteger | kLinearPCMFormatFlagIsBigEndian
| kAudioFormatFlagIsNonInterleaved;
shtoomDescription.mBytesPerFrame = sizeof(SInt16);
shtoomDescription.mFramesPerPacket = 1;
shtoomDescription.mBytesPerPacket = sizeof(SInt16);
shtoomDescription.mChannelsPerFrame = 1;
shtoomDescription.mBitsPerChannel = 16;
shtoomDescription.mReserved = 0;
[inConverter release];
inConverter = [[MTConversionBuffer alloc]
initWithSourceDescription:shtoomDescription
bufferFrames:inBufferSize
destinationDescription:[MTConversionBuffer
descriptionForDevice:outputDevice
forDirection:kMTCoreAudioDevicePlaybackDirection]
bufferFrames:ceil ( [outputDevice
deviceMaxVariableBufferSizeInFrames] * SR_ERROR_ALLOWANCE )];
Float64 outScale = ([self sampleRate] / [inputDevice
nominalSampleRate]);
unsigned outBufferSize = ceil ( outScale * [inputDevice
deviceMaxVariableBufferSizeInFrames] * SR_ERROR_ALLOWANCE );
if (outBuffer) MTAudioBufferListDispose(outBuffer);
outBuffer = MTAudioBufferListNew(1, outBufferSize, NO);
[outConverter release];
outConverter = [[MTConversionBuffer alloc]
initWithSourceDescription:[MTConversionBuffer
descriptionForDevice:inputDevice
forDirection:kMTCoreAudioDeviceRecordDirection]
bufferFrames:outBufferSize
destinationDescription:shtoomDescription
bufferFrames:ceil ( [outputDevice
deviceMaxVariableBufferSizeInFrames] * SR_ERROR_ALLOWANCE )];
}
_______________________________________________
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