diff --git a/SConstruct b/SConstruct index 403cf36e57..03ba620d0f 100644 --- a/SConstruct +++ b/SConstruct @@ -288,29 +288,25 @@ env['HAVE_SDL'] = conf.CheckSDL('1.0.0') env['HAVE_BLUEZ'] = conf.CheckPKG('bluez') # needed for sound -env['HAVE_AO'] = 0 -if not env['noao']: - env['HAVE_AO'] = conf.CheckPKG('ao') - -env['HAVE_OPENAL'] = 0 -if env['openal']: - env['HAVE_OPENAL'] = conf.CheckPKG('openal') - env['HAVE_ALSA'] = conf.CheckPKG('alsa') +env['HAVE_AO'] = 0 +env['HAVE_OPENAL'] = 0 +env['HAVE_PORTAUDIO'] = 0 env['HAVE_PULSEAUDIO'] = 0 -#env['HAVE_PULSEAUDIO'] = conf.CheckPKG('libpulse') +if sys.platform != 'darwin': + if not env['noao']: + env['HAVE_AO'] = conf.CheckPKG('ao') + if env['openal']: + env['HAVE_OPENAL'] = conf.CheckPKG('openal') + env['HAVE_PORTAUDIO'] = conf.CheckPortaudio(1890) + #env['HAVE_PULSEAUDIO'] = conf.CheckPKG('libpulse') # OpenCL env['HAVE_OPENCL'] = 0 if env['opencl']: env['HAVE_OPENCL'] = conf.CheckPKG('OpenCL') -env['HAVE_PORTAUDIO'] = 0 -if sys.platform != 'darwin': -# needed for mic - env['HAVE_PORTAUDIO'] = conf.CheckPortaudio(1890) - # SOIL env['SHARED_SOIL'] = 0; if env['shared_soil']: diff --git a/Source/Core/AudioCommon/Src/AOSoundStream.cpp b/Source/Core/AudioCommon/Src/AOSoundStream.cpp index d26bdd9755..14b114e1c5 100644 --- a/Source/Core/AudioCommon/Src/AOSoundStream.cpp +++ b/Source/Core/AudioCommon/Src/AOSoundStream.cpp @@ -29,11 +29,7 @@ void AOSound::SoundLoop() default_driver = ao_default_driver_id(); format.bits = 16; format.channels = 2; -#ifdef __APPLE__ - format.rate = 44100; // libao for osx only supports 44.1kHz... -#else format.rate = m_mixer->GetSampleRate(); -#endif format.byte_format = AO_FMT_LITTLE; device = ao_open_live(default_driver, &format, NULL /* no options */); diff --git a/Source/Core/AudioCommon/Src/AudioCommon.cpp b/Source/Core/AudioCommon/Src/AudioCommon.cpp index de371d7595..1ea0d44a9a 100644 --- a/Source/Core/AudioCommon/Src/AudioCommon.cpp +++ b/Source/Core/AudioCommon/Src/AudioCommon.cpp @@ -20,7 +20,9 @@ #include "DSoundStream.h" #include "AOSoundStream.h" #include "AlsaSoundStream.h" +#ifdef __APPLE__ #include "CoreAudioSoundStream.h" +#endif #include "OpenALStream.h" #include "PulseAudioStream.h" diff --git a/Source/Core/AudioCommon/Src/CoreAudioSoundStream.cpp b/Source/Core/AudioCommon/Src/CoreAudioSoundStream.cpp index e5268549b7..131330c675 100644 --- a/Source/Core/AudioCommon/Src/CoreAudioSoundStream.cpp +++ b/Source/Core/AudioCommon/Src/CoreAudioSoundStream.cpp @@ -52,20 +52,20 @@ bool CoreAudioSound::Start() AudioStreamBasicDescription format; desc.componentType = kAudioUnitType_Output; - desc.componentSubType = kAudioUnitSubType_HALOutput; + desc.componentSubType = kAudioUnitSubType_DefaultOutput; desc.componentFlags = 0; desc.componentFlagsMask = 0; desc.componentManufacturer = kAudioUnitManufacturer_Apple; Component component = FindNextComponent(NULL, &desc); if (component == NULL) { - printf("error finding audio component\n"); + ERROR_LOG(AUDIO, "error finding audio component"); return false; } err = OpenAComponent(component, &audioUnit); if (err != noErr) { - printf("error opening audio component\n"); + ERROR_LOG(AUDIO, "error opening audio component"); return false; } @@ -82,7 +82,7 @@ bool CoreAudioSound::Start() kAudioUnitScope_Input, 0, &format, sizeof(AudioStreamBasicDescription)); if (err != noErr) { - printf("error setting audio format\n"); + ERROR_LOG(AUDIO, "error setting audio format"); return false; } @@ -93,19 +93,19 @@ bool CoreAudioSound::Start() kAudioUnitScope_Input, 0, &callback_struct, sizeof callback_struct); if (err != noErr) { - printf("error setting audio callback\n"); + ERROR_LOG(AUDIO, "error setting audio callback"); return false; } err = AudioUnitInitialize(audioUnit); if (err != noErr) { - printf("error initializing audiounit\n"); + ERROR_LOG(AUDIO, "error initializing audiounit"); return false; } err = AudioOutputUnitStart(audioUnit); if (err != noErr) { - printf("error starting audiounit\n"); + ERROR_LOG(AUDIO, "error starting audiounit"); return false; } @@ -122,19 +122,19 @@ void CoreAudioSound::Stop() err = AudioOutputUnitStop(audioUnit); if (err != noErr) { - printf("error stopping audiounit\n"); + ERROR_LOG(AUDIO, "error stopping audiounit"); return; } err = AudioUnitUninitialize(audioUnit); if (err != noErr) { - printf("error uninitializing audiounit\n"); + ERROR_LOG(AUDIO, "error uninitializing audiounit"); return; } err = CloseComponent(audioUnit); if (err != noErr) { - printf("error while closing audio component\n"); + ERROR_LOG(AUDIO, "error closing audio component"); return; } } diff --git a/Source/Core/AudioCommon/Src/CoreAudioSoundStream.h b/Source/Core/AudioCommon/Src/CoreAudioSoundStream.h index c8cb3218c3..c397e085ac 100644 --- a/Source/Core/AudioCommon/Src/CoreAudioSoundStream.h +++ b/Source/Core/AudioCommon/Src/CoreAudioSoundStream.h @@ -18,23 +18,15 @@ #ifndef _COREAUDIO_SOUND_STREAM_H #define _COREAUDIO_SOUND_STREAM_H -#include "Common.h" -#include "SoundStream.h" -#if defined(__APPLE__) #include #include #include -#endif -#include "Thread.h" +#include "Common.h" +#include "SoundStream.h" class CoreAudioSound : public SoundStream { -#if defined(__APPLE__) - Common::Thread *thread; - Common::Event soundSyncEvent; - Common::CriticalSection soundCriticalSection; - ComponentDescription desc; AudioUnit audioUnit; @@ -56,10 +48,6 @@ public: virtual void Update(); void RenderSamples(void *target, UInt32 size); -#else -public: - CoreAudioSound(CMixer *mixer) : SoundStream(mixer) {} -#endif }; #endif diff --git a/Source/Core/AudioCommon/Src/OpenALStream.h b/Source/Core/AudioCommon/Src/OpenALStream.h index 4f4f8a8891..9db4559d55 100644 --- a/Source/Core/AudioCommon/Src/OpenALStream.h +++ b/Source/Core/AudioCommon/Src/OpenALStream.h @@ -26,10 +26,6 @@ #ifdef _WIN32 #include "../../../../Externals/OpenAL/include/al.h" #include "../../../../Externals/OpenAL/include/alc.h" -#elif defined(__APPLE__) -#include "openal/al.h" -#include "openal/alc.h" -#else #include #include #endif // WIN32 diff --git a/Source/Core/AudioCommon/Src/aldlist.cpp b/Source/Core/AudioCommon/Src/aldlist.cpp index 22c3fb7c50..9e9114cb81 100644 --- a/Source/Core/AudioCommon/Src/aldlist.cpp +++ b/Source/Core/AudioCommon/Src/aldlist.cpp @@ -27,10 +27,6 @@ #ifdef _WIN32 #include "../../../../Externals/OpenAL/include/al.h" #include "../../../../Externals/OpenAL/include/alc.h" -#elif defined(__APPLE__) -#include "openal/al.h" -#include "openal/alc.h" -#else #include #include #endif // WIN32