summaryrefslogtreecommitdiff
path: root/src/sound
diff options
context:
space:
mode:
authoregladil <egladil@openttd.org>2007-11-07 21:35:33 +0000
committeregladil <egladil@openttd.org>2007-11-07 21:35:33 +0000
commitcd5597dddf6ec33d9c2bd1db1a892267e9acbc9e (patch)
treebe0a6d5de09021779c127a919cfe99eac6421412 /src/sound
parent015454198226049694037f1b85af0b6d44318351 (diff)
downloadopenttd-cd5597dddf6ec33d9c2bd1db1a892267e9acbc9e.tar.xz
(svn r11389) -Fix [FS#1386]: Replace calls to deprecated API with newer ones and handle broken iconv declaration in OSX 10.5.
Diffstat (limited to 'src/sound')
-rw-r--r--src/sound/cocoa_s.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/sound/cocoa_s.cpp b/src/sound/cocoa_s.cpp
index 7e2c7d034..890761ebc 100644
--- a/src/sound/cocoa_s.cpp
+++ b/src/sound/cocoa_s.cpp
@@ -31,9 +31,9 @@ static FSoundDriver_Cocoa iFSoundDriver_Cocoa;
static AudioUnit _outputAudioUnit;
/* The CoreAudio callback */
-static OSStatus audioCallback(void *inRefCon, AudioUnitRenderActionFlags inActionFlags, const AudioTimeStamp *inTimeStamp, UInt32 inBusNumber, AudioBuffer *ioData)
+static OSStatus audioCallback(void *inRefCon, AudioUnitRenderActionFlags *inActionFlags, const AudioTimeStamp *inTimeStamp, UInt32 inBusNumber, UInt32 inNumberFrames, AudioBufferList * ioData)
{
- MxMixSamples(ioData->mData, ioData->mDataByteSize / 4);
+ MxMixSamples(ioData->mBuffers[0].mData, ioData->mBuffers[0].mDataByteSize / 4);
return noErr;
}
@@ -43,7 +43,7 @@ const char *SoundDriver_Cocoa::Start(const char * const *parm)
{
Component comp;
ComponentDescription desc;
- struct AudioUnitInputCallback callback;
+ struct AURenderCallbackStruct callback;
AudioStreamBasicDescription requestedDesc;
/* Setup a AudioStreamBasicDescription with the requested format */
@@ -65,9 +65,9 @@ const char *SoundDriver_Cocoa::Start(const char * const *parm)
/* Locate the default output audio unit */
- desc.componentType = kAudioUnitComponentType;
- desc.componentSubType = kAudioUnitSubType_Output;
- desc.componentManufacturer = kAudioUnitID_DefaultOutput;
+ desc.componentType = kAudioUnitType_Output;
+ desc.componentSubType = kAudioUnitSubType_HALOutput;
+ desc.componentManufacturer = kAudioUnitManufacturer_Apple;
desc.componentFlags = 0;
desc.componentFlagsMask = 0;
@@ -93,8 +93,8 @@ const char *SoundDriver_Cocoa::Start(const char * const *parm)
/* Set the audio callback */
callback.inputProc = audioCallback;
callback.inputProcRefCon = NULL;
- if (AudioUnitSetProperty(_outputAudioUnit, kAudioUnitProperty_SetInputCallback, kAudioUnitScope_Input, 0, &callback, sizeof(callback)) != noErr) {
- return "cocoa_s: Failed to start CoreAudio: AudioUnitSetProperty (kAudioUnitProperty_SetInputCallback)";
+ if (AudioUnitSetProperty(_outputAudioUnit, kAudioUnitProperty_SetRenderCallback, kAudioUnitScope_Input, 0, &callback, sizeof(callback)) != noErr) {
+ return "cocoa_s: Failed to start CoreAudio: AudioUnitSetProperty (kAudioUnitProperty_SetRenderCallback)";
}
/* Finally, start processing of the audio unit */
@@ -109,7 +109,7 @@ const char *SoundDriver_Cocoa::Start(const char * const *parm)
void SoundDriver_Cocoa::Stop()
{
- struct AudioUnitInputCallback callback;
+ struct AURenderCallbackStruct callback;
/* stop processing the audio unit */
if (AudioOutputUnitStop(_outputAudioUnit) != noErr) {
@@ -120,8 +120,8 @@ void SoundDriver_Cocoa::Stop()
/* Remove the input callback */
callback.inputProc = 0;
callback.inputProcRefCon = 0;
- if (AudioUnitSetProperty(_outputAudioUnit, kAudioUnitProperty_SetInputCallback, kAudioUnitScope_Input, 0, &callback, sizeof(callback)) != noErr) {
- DEBUG(driver, 0, "cocoa_s: Core_CloseAudio: AudioUnitSetProperty (kAudioUnitProperty_SetInputCallback) failed");
+ if (AudioUnitSetProperty(_outputAudioUnit, kAudioUnitProperty_SetRenderCallback, kAudioUnitScope_Input, 0, &callback, sizeof(callback)) != noErr) {
+ DEBUG(driver, 0, "cocoa_s: Core_CloseAudio: AudioUnitSetProperty (kAudioUnitProperty_SetRenderCallback) failed");
return;
}