mirror of
https://github.com/encounter/SDL.git
synced 2025-12-16 16:37:09 +00:00
coreaudio: Move from AudioUnits to AudioQueues.
AudioQueues are available in Mac OS X 10.5 and later (and iOS 2.0 and later). Their API is much more clear (and if you don't mind the threading tapdance to get its own CFRunLoop) much easier to use in general for our purposes. As an added benefit: they seemlessly deal with format conversion in ways AudioUnits don't: for example, my MacBook Pro's built-in microphone won't capture at 8000Hz and the AudioUnit version wouldn't resample to hide this fact; the AudioQueue version, however, can handle this.
This commit is contained in:
@@ -32,10 +32,9 @@
|
||||
#if MACOSX_COREAUDIO
|
||||
#include <CoreAudio/CoreAudio.h>
|
||||
#include <CoreServices/CoreServices.h>
|
||||
#else
|
||||
#include <AudioToolbox/AudioToolbox.h>
|
||||
#endif
|
||||
|
||||
#include <AudioToolbox/AudioToolbox.h>
|
||||
#include <AudioUnit/AudioUnit.h>
|
||||
|
||||
/* Hidden "this" pointer for the audio functions */
|
||||
@@ -43,11 +42,16 @@
|
||||
|
||||
struct SDL_PrivateAudioData
|
||||
{
|
||||
AudioUnit audioUnit;
|
||||
SDL_bool audioUnitOpened;
|
||||
SDL_Thread *thread;
|
||||
AudioQueueRef audioQueue;
|
||||
AudioQueueBufferRef audioBuffer[2];
|
||||
void *buffer;
|
||||
UInt32 bufferOffset;
|
||||
UInt32 bufferSize;
|
||||
AudioStreamBasicDescription strdesc;
|
||||
SDL_sem *ready_semaphore;
|
||||
char *thread_error;
|
||||
SDL_atomic_t shutdown;
|
||||
#if MACOSX_COREAUDIO
|
||||
AudioDeviceID deviceID;
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user