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

old mtcoreaudio code doesn't work now



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




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.