• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
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


  • Subject: Re: old mtcoreaudio code doesn't work now
  • From: dudley ackerman <email@hidden>
  • Date: Sun, 6 Jan 2008 11:16:54 -0800

mtcoreaudio worked on tiger, now i am using the latest mtcoreaudio on leopard and having a problem.
after having a problem recording yielding loud buzzing, i decided to not use mtcoreaudio as a framework. i modified the imports and included the files directly in my project. now, i get a failure registering my output device.


is there something wrong in my setup?
i am trying to do a simple record and then playback:

- (void) setDeviceOpen:(BOOL)state
{
NSLog(@"setDeviceOpen:");
[receiveQueue release];
receiveQueue = nil;
if (state)
{
[inputDevice setDevicePaused:YES]; // lock out IO cycles while we change a resource they use
[outputDevice setDevicePaused:YES];
[self allocNewConverter];
[outputDevice setDevicePaused:NO];
[inputDevice setDevicePaused:NO];

if ( ! ( [outputDevice deviceStart] && [inputDevice deviceStart] ))
{
NSLog(@"Device was unable to start.");
[self setDeviceOpen:NO];
return;
} else {
NSLog(@"Devices were able to start.");
receiveQueue = [[NSMutableArray alloc] initWithCapacity:16];
}
}
else
{
NSLog(@"Stopping devices.");
[inputDevice deviceStop];
[outputDevice deviceStop];
}
deviceOpen = state;
}



- (void) allocNewConverter { NSLog(@"allocNewConverter");

Float64 inScale = ([self sampleRate] / [outputDevice nominalSampleRate]);
unsigned bfsz = [outputDevice deviceMaxVariableBufferSizeInFrames];
unsigned inBufferSize = ceil ( inScale * bfsz * SR_ERROR_ALLOWANCE );
if (inBuffer) MTAudioBufferListDispose(inBuffer);
inBuffer = MTAudioBufferListNew(1, inBufferSize, NO);


[inConverter release];
inConverter = [[MTConversionBuffer alloc]
initWithSourceSampleRate: [self sampleRate]
channels: 1
bufferFrames: inBufferSize
destinationSampleRate: [outputDevice nominalSampleRate]
channels: [outputDevice channelsForDirection: kMTCoreAudioDevicePlaybackDirection]
bufferFrames: [outputDevice deviceMaxVariableBufferSizeInFrames] * SR_ERROR_ALLOWANCE
minimumBufferSeconds: 0
];


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]
initWithSourceSampleRate: [inputDevice nominalSampleRate]
channels: [inputDevice channelsForDirection: kMTCoreAudioDeviceRecordDirection]
bufferFrames: outBufferSize
destinationSampleRate: [self sampleRate]
channels: 1
bufferFrames: ceil ( [inputDevice deviceMaxVariableBufferSizeInFrames] * SR_ERROR_ALLOWANCE )
minimumBufferSeconds: 0
];
}


_______________________________________________
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


  • Follow-Ups:
    • Re: old mtcoreaudio code doesn't work now
      • From: Michael Thornburgh <email@hidden>
  • Prev by Date: Re: the right question
  • Next by Date: Re: old mtcoreaudio code doesn't work now
  • Previous by thread: Re: the right question
  • Next by thread: Re: old mtcoreaudio code doesn't work now
  • Index(es):
    • Date
    • Thread