jdk/src/java.desktop/macosx/native/libjsound/PLATFORM_API_MacOSX_PCM.cpp
changeset 29258 adf046d51c1c
parent 25859 3317bb8137f4
child 41566 f52207d194bf
--- a/jdk/src/java.desktop/macosx/native/libjsound/PLATFORM_API_MacOSX_PCM.cpp	Tue Feb 17 11:50:06 2015 -0800
+++ b/jdk/src/java.desktop/macosx/native/libjsound/PLATFORM_API_MacOSX_PCM.cpp	Wed Feb 18 16:59:51 2015 +0300
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,7 +28,6 @@
 //#define USE_VERBOSE_TRACE
 
 #include <AudioUnit/AudioUnit.h>
-#include <CoreServices/CoreServices.h>
 #include <AudioToolbox/AudioConverter.h>
 #include <pthread.h>
 #include <math.h>
@@ -617,7 +616,7 @@
 
     ~OSX_DirectAudioDevice() {
         if (audioUnit) {
-            CloseComponent(audioUnit);
+            AudioComponentInstanceDispose(audioUnit);
         }
         if (resampler) {
             delete resampler;
@@ -629,17 +628,16 @@
 {
     OSStatus err;
     AudioUnit unit;
-    UInt32 size;
 
-    ComponentDescription desc;
+    AudioComponentDescription desc;
     desc.componentType         = kAudioUnitType_Output;
     desc.componentSubType      = (deviceID == 0 && isSource) ? kAudioUnitSubType_DefaultOutput : kAudioUnitSubType_HALOutput;
     desc.componentManufacturer = kAudioUnitManufacturer_Apple;
     desc.componentFlags        = 0;
     desc.componentFlagsMask    = 0;
 
-    Component comp = FindNextComponent(NULL, &desc);
-    err = OpenAComponent(comp, &unit);
+    AudioComponent comp = AudioComponentFindNext(NULL, &desc);
+    err = AudioComponentInstanceNew(comp, &unit);
 
     if (err) {
         OS_ERROR0(err, "CreateOutputUnit:OpenAComponent");
@@ -664,7 +662,7 @@
             // get real AudioDeviceID for default input device (macosx current input device)
             deviceID = GetDefaultDevice(isSource);
             if (!deviceID) {
-                CloseComponent(unit);
+                AudioComponentInstanceDispose(unit);
                 return NULL;
             }
         }
@@ -675,7 +673,7 @@
                                     0, &deviceID, sizeof(deviceID));
         if (err) {
             OS_ERROR0(err, "SetProperty (CurrentDevice)");
-            CloseComponent(unit);
+            AudioComponentInstanceDispose(unit);
             return NULL;
         }
     }