Now that Core Audio works, reduce the number of build permutations a bit
by not linking in other Unix audio modules. Use kAudioUnitSubType_DefaultOutput instead of kAudioUnitSubType_HALOutput so that a runtime switch to another audio device is automatically handled. Use ERROR_LOG for audio errors. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5562 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
f7494e6b2b
commit
9d7b569ccb
24
SConstruct
24
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']:
|
||||
|
|
|
@ -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 */);
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,23 +18,15 @@
|
|||
#ifndef _COREAUDIO_SOUND_STREAM_H
|
||||
#define _COREAUDIO_SOUND_STREAM_H
|
||||
|
||||
#include "Common.h"
|
||||
#include "SoundStream.h"
|
||||
#if defined(__APPLE__)
|
||||
#include <CoreAudio/AudioHardware.h>
|
||||
#include <AudioUnit/AudioUnit.h>
|
||||
#include <CoreServices/CoreServices.h>
|
||||
#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
|
||||
|
|
|
@ -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 <AL/al.h>
|
||||
#include <AL/alc.h>
|
||||
#endif // WIN32
|
||||
|
|
|
@ -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 <AL/al.h>
|
||||
#include <AL/alc.h>
|
||||
#endif // WIN32
|
||||
|
|
Loading…
Reference in New Issue