Charles Davis : winecoreaudio: Fix deprecation warnings in audiounit.c.

Alexandre Julliard julliard at winehq.org
Mon Jan 31 11:26:14 CST 2011


Module: wine
Branch: master
Commit: b149d7bc7bf28dc13919a2d6d2c4b79e519e7a58
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=b149d7bc7bf28dc13919a2d6d2c4b79e519e7a58

Author: Charles Davis <cdavis at mymail.mines.edu>
Date:   Sat Jan 29 16:45:54 2011 -0700

winecoreaudio: Fix deprecation warnings in audiounit.c.

---

 configure                          |   14 ++++++++++++
 configure.ac                       |    5 ++++
 dlls/winecoreaudio.drv/audiounit.c |   40 +++++++++++++++++++++++++++--------
 include/config.h.in                |    3 ++
 4 files changed, 53 insertions(+), 9 deletions(-)

diff --git a/configure b/configure
index 89bfefa..c178d92 100755
--- a/configure
+++ b/configure
@@ -6535,6 +6535,20 @@ fi
                         COREAUDIO="-framework CoreAudio -framework AudioUnit -framework CoreServices -framework AudioToolbox -framework CoreMIDI"
 
         fi
+                ac_save_LIBS="$LIBS"
+        LIBS="$LIBS $COREAUDIO"
+        for ac_func in AUGraphAddNode
+do :
+  ac_fn_c_check_func "$LINENO" "AUGraphAddNode" "ac_cv_func_AUGraphAddNode"
+if test "x$ac_cv_func_AUGraphAddNode" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_AUGRAPHADDNODE 1
+_ACEOF
+
+fi
+done
+
+        LIBS="$ac_save_LIBS"
     fi
     if test "$ac_cv_header_OpenAL_al_h" = "yes"
     then
diff --git a/configure.ac b/configure.ac
index c0a9d7f..b4be299 100644
--- a/configure.ac
+++ b/configure.ac
@@ -719,6 +719,11 @@ case $host_os in
             dnl CoreServices needed by AudioUnit
             AC_SUBST(COREAUDIO,"-framework CoreAudio -framework AudioUnit -framework CoreServices -framework AudioToolbox -framework CoreMIDI")
         fi
+        dnl Check for the AUGraphAddNode function
+        ac_save_LIBS="$LIBS"
+        LIBS="$LIBS $COREAUDIO"
+        AC_CHECK_FUNCS(AUGraphAddNode)
+        LIBS="$ac_save_LIBS"
     fi
     if test "$ac_cv_header_OpenAL_al_h" = "yes"
     then
diff --git a/dlls/winecoreaudio.drv/audiounit.c b/dlls/winecoreaudio.drv/audiounit.c
index 5191669..bd0ad17 100644
--- a/dlls/winecoreaudio.drv/audiounit.c
+++ b/dlls/winecoreaudio.drv/audiounit.c
@@ -59,6 +59,18 @@ static inline OSStatus AudioComponentInstanceDispose(AudioComponentInstance aci)
 }
 #endif
 
+#ifndef HAVE_AUGRAPHADDNODE
+static inline OSStatus AUGraphAddNode(AUGraph graph, const AudioComponentDescription *desc, AUNode *node)
+{
+    return AUGraphNewNode(graph, desc, 0, NULL, node);
+}
+
+static inline OSStatus AUGraphNodeInfo(AUGraph graph, AUNode node, AudioComponentDescription *desc, AudioUnit *au)
+{
+    return AUGraphGetNodeInfo(graph, node, desc, 0, NULL, au);
+}
+#endif
+
 WINE_DEFAULT_DEBUG_CHANNEL(wave);
 WINE_DECLARE_DEBUG_CHANNEL(midi);
 
@@ -194,11 +206,15 @@ int AudioUnit_GetInputDeviceSampleRate(void)
 {
     AudioDeviceID               defaultInputDevice;
     UInt32                      param;
+    AudioObjectPropertyAddress  propertyAddress;
     Float64                     sampleRate;
     OSStatus                    err;
 
     param = sizeof(defaultInputDevice);
-    err = AudioHardwareGetProperty(kAudioHardwarePropertyDefaultInputDevice, &param, &defaultInputDevice);
+    propertyAddress.mSelector = kAudioHardwarePropertyDefaultInputDevice;
+    propertyAddress.mScope = kAudioObjectPropertyScopeGlobal;
+    propertyAddress.mElement = kAudioObjectPropertyElementMaster;
+    err = AudioObjectGetPropertyData(kAudioObjectSystemObject, &propertyAddress, 0, NULL, &param, &defaultInputDevice);
     if (err != noErr || defaultInputDevice == kAudioDeviceUnknown)
     {
         ERR("Couldn't get the default audio input device ID: %08lx\n", err);
@@ -206,7 +222,9 @@ int AudioUnit_GetInputDeviceSampleRate(void)
     }
 
     param = sizeof(sampleRate);
-    err = AudioDeviceGetProperty(defaultInputDevice, 0, 1, kAudioDevicePropertyNominalSampleRate, &param, &sampleRate);
+    propertyAddress.mSelector = kAudioDevicePropertyNominalSampleRate;
+    propertyAddress.mScope = kAudioDevicePropertyScopeInput;
+    err = AudioObjectGetPropertyData(defaultInputDevice, &propertyAddress, 0, NULL, &param, &sampleRate);
     if (err != noErr)
     {
         ERR("Couldn't get the device sample rate: %08lx\n", err);
@@ -226,6 +244,7 @@ int AudioUnit_CreateInputUnit(void* wwi, AudioUnit* out_au,
     AudioComponent              component;
     AudioUnit                   au;
     UInt32                      param;
+    AudioObjectPropertyAddress  propertyAddress;
     AURenderCallbackStruct      callback;
     AudioDeviceID               defaultInputDevice;
     AudioStreamBasicDescription desiredFormat;
@@ -291,7 +310,10 @@ int AudioUnit_CreateInputUnit(void* wwi, AudioUnit* out_au,
 
     /* Find the default input device */
     param = sizeof(defaultInputDevice);
-    err = AudioHardwareGetProperty(kAudioHardwarePropertyDefaultInputDevice, &param, &defaultInputDevice);
+    propertyAddress.mSelector = kAudioHardwarePropertyDefaultInputDevice;
+    propertyAddress.mScope = kAudioObjectPropertyScopeGlobal;
+    propertyAddress.mElement = kAudioObjectPropertyElementMaster;
+    err = AudioObjectGetPropertyData(kAudioObjectSystemObject, &propertyAddress, 0, NULL, &param, &defaultInputDevice);
     if (err != noErr || defaultInputDevice == kAudioDeviceUnknown)
     {
         ERR("Couldn't get the default audio device ID: %08lx\n", err);
@@ -396,10 +418,10 @@ int SynthUnit_CreateDefaultSynthUnit(AUGraph *graph, AudioUnit *synth)
     desc.componentType = kAudioUnitType_MusicDevice;
     desc.componentSubType = kAudioUnitSubType_DLSSynth;
 
-    err = AUGraphNewNode(*graph, &desc, 0, NULL, &synthNode);
+    err = AUGraphAddNode(*graph, &desc, &synthNode);
     if (err != noErr)
     {
-        ERR_(midi)("AUGraphNewNode cannot create synthNode : %s\n", wine_dbgstr_fourcc(err));
+        ERR_(midi)("AUGraphAddNode cannot create synthNode : %s\n", wine_dbgstr_fourcc(err));
         return 0;
     }
 
@@ -407,10 +429,10 @@ int SynthUnit_CreateDefaultSynthUnit(AUGraph *graph, AudioUnit *synth)
     desc.componentType = kAudioUnitType_Output;
     desc.componentSubType = kAudioUnitSubType_DefaultOutput;
 
-    err = AUGraphNewNode(*graph, &desc, 0, NULL, &outNode);
+    err = AUGraphAddNode(*graph, &desc, &outNode);
     if (err != noErr)
     {
-        ERR_(midi)("AUGraphNewNode cannot create outNode %s\n", wine_dbgstr_fourcc(err));
+        ERR_(midi)("AUGraphAddNode cannot create outNode %s\n", wine_dbgstr_fourcc(err));
         return 0;
     }
 
@@ -430,10 +452,10 @@ int SynthUnit_CreateDefaultSynthUnit(AUGraph *graph, AudioUnit *synth)
     }
 
     /* Get the synth unit */
-    err = AUGraphGetNodeInfo(*graph, synthNode, 0, 0, 0, synth);
+    err = AUGraphNodeInfo(*graph, synthNode, 0, synth);
     if (err != noErr)
     {
-        ERR_(midi)("AUGraphGetNodeInfo return %s\n", wine_dbgstr_fourcc(err));
+        ERR_(midi)("AUGraphNodeInfo return %s\n", wine_dbgstr_fourcc(err));
         return 0;
     }
 
diff --git a/include/config.h.in b/include/config.h.in
index 5cae81b..0b16b35 100644
--- a/include/config.h.in
+++ b/include/config.h.in
@@ -52,6 +52,9 @@
 /* Define to 1 if you have the <audio/soundlib.h> header file. */
 #undef HAVE_AUDIO_SOUNDLIB_H
 
+/* Define to 1 if you have the `AUGraphAddNode' function. */
+#undef HAVE_AUGRAPHADDNODE
+
 /* Define to 1 if you have the <capi20.h> header file. */
 #undef HAVE_CAPI20_H
 




More information about the wine-cvs mailing list