Clean up audio output code just a bit
This commit is contained in:
parent
b7596caa44
commit
b7487e2ad2
2 changed files with 7 additions and 6 deletions
|
@ -6,6 +6,7 @@
|
||||||
// Copyright 2005 Vincent Spader. All rights reserved.
|
// Copyright 2005 Vincent Spader. All rights reserved.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
#import <AssertMacros.h>
|
||||||
#import <Cocoa/Cocoa.h>
|
#import <Cocoa/Cocoa.h>
|
||||||
|
|
||||||
#import <CoreAudio/AudioHardware.h>
|
#import <CoreAudio/AudioHardware.h>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
//
|
//
|
||||||
// OutputCoreAudio.m
|
// OutputCoreAudio.m
|
||||||
// Cog
|
// Cog
|
||||||
//
|
//
|
||||||
|
@ -225,7 +225,7 @@ static OSStatus Sound_Renderer(void *inRefCon, AudioUnitRenderActionFlags *ioAc
|
||||||
};
|
};
|
||||||
UInt32 dataSize;
|
UInt32 dataSize;
|
||||||
|
|
||||||
ComponentDescription desc;
|
AudioComponentDescription desc;
|
||||||
OSStatus err;
|
OSStatus err;
|
||||||
|
|
||||||
desc.componentType = kAudioUnitType_Output;
|
desc.componentType = kAudioUnitType_Output;
|
||||||
|
@ -234,11 +234,11 @@ static OSStatus Sound_Renderer(void *inRefCon, AudioUnitRenderActionFlags *ioAc
|
||||||
desc.componentFlags = 0;
|
desc.componentFlags = 0;
|
||||||
desc.componentFlagsMask = 0;
|
desc.componentFlagsMask = 0;
|
||||||
|
|
||||||
Component comp = FindNextComponent(NULL, &desc); //Finds an component that meets the desc spec's
|
AudioComponent comp = AudioComponentFindNext(NULL, &desc); //Finds an component that meets the desc spec's
|
||||||
if (comp == NULL)
|
if (comp == NULL)
|
||||||
return NO;
|
return NO;
|
||||||
|
|
||||||
err = OpenAComponent(comp, &outputUnit); //gains access to the services provided by the component
|
err = AudioComponentInstanceNew(comp, &outputUnit); //gains access to the services provided by the component
|
||||||
if (err)
|
if (err)
|
||||||
return NO;
|
return NO;
|
||||||
|
|
||||||
|
@ -344,7 +344,7 @@ static OSStatus Sound_Renderer(void *inRefCon, AudioUnitRenderActionFlags *ioAc
|
||||||
deviceChannelMap[i] = i;
|
deviceChannelMap[i] = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
free(preferredChannelLayout), preferredChannelLayout = nil;
|
free(preferredChannelLayout); preferredChannelLayout = nil;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Just use a channel map that makes sense
|
// Just use a channel map that makes sense
|
||||||
|
@ -415,7 +415,7 @@ static OSStatus Sound_Renderer(void *inRefCon, AudioUnitRenderActionFlags *ioAc
|
||||||
{
|
{
|
||||||
AudioOutputUnitStop(outputUnit);
|
AudioOutputUnitStop(outputUnit);
|
||||||
AudioUnitUninitialize (outputUnit);
|
AudioUnitUninitialize (outputUnit);
|
||||||
CloseComponent(outputUnit);
|
AudioComponentInstanceDispose(outputUnit);
|
||||||
outputUnit = NULL;
|
outputUnit = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue