diff src/cdrom/macosx/CDPlayer.cpp @ 935:f8d5ddc7aef1

Audio improvements from Max Horn, including a new CoreAudio driver for MacOSX
author Sam Lantinga <slouken@libsdl.org>
date Sat, 21 Aug 2004 02:06:30 +0000
parents 08b7fc2b5225
children
line wrap: on
line diff
--- a/src/cdrom/macosx/CDPlayer.cpp	Fri Aug 20 22:35:23 2004 +0000
+++ b/src/cdrom/macosx/CDPlayer.cpp	Sat Aug 21 02:06:30 2004 +0000
@@ -68,8 +68,6 @@
 
 static OSStatus CheckInit ();
 
-static OSStatus MatchAUFormats (AudioUnit theUnit, UInt32 theInputBus);
-
 static void     FilePlayNotificationHandler (void* inRefCon, OSStatus inStatus);
 
 static int      RunCallBackThread (void* inRefCon);
@@ -423,7 +421,7 @@
             throw (-3);
         }
             
-        thePlayer->SetDestination(theUnit, 0);
+        thePlayer->SetDestination(theUnit);
         
         if (startFrame >= 0)
             thePlayer->SetStartFrame (startFrame);
@@ -605,16 +603,6 @@
             THROW_RESULT("CheckInit: AudioUnitInitialize")
         
                     
-        // In this case we first want to get the output format of the OutputUnit
-        // Then we set that as the input format. Why?
-        // So that only a single conversion process is done
-        // when SetDestination is called it will get the input format of the
-        // unit its supplying data to. This defaults to 44.1K, stereo, so if
-        // the device is not that, then we lose a possibly rendering of data
-        
-        result = MatchAUFormats (theUnit, 0);
-            THROW_RESULT("CheckInit: MatchAUFormats")
-    
         playBackWasInit = true;
     }
     catch (...)
@@ -625,29 +613,6 @@
     return 0;
 }
 
-
-static OSStatus MatchAUFormats (AudioUnit theUnit, UInt32 theInputBus)
-{
-    AudioStreamBasicDescription theDesc;
-    UInt32 size = sizeof (theDesc);
-    OSStatus result = AudioUnitGetProperty (theUnit,
-                                            kAudioUnitProperty_StreamFormat,
-                                            kAudioUnitScope_Output,
-                                            0,
-                                            &theDesc,
-                                            &size);
-        THROW_RESULT("MatchAUFormats: AudioUnitGetProperty")
-
-    result = AudioUnitSetProperty (theUnit,
-                                   kAudioUnitProperty_StreamFormat,
-                                   kAudioUnitScope_Input,
-                                   theInputBus,
-                                   &theDesc,
-                                   size);
-    
-    return result;
-}
-
 static void FilePlayNotificationHandler(void * inRefCon, OSStatus inStatus)
 {
     if (inStatus == kAudioFilePlay_FileIsFinished) {