Commit b2540abd authored by Ryan C. Gordon's avatar Ryan C. Gordon

Merged Mac OS X and iOS audio targets.

--HG--
rename : src/audio/macosx/SDL_coreaudio.c => src/audio/coreaudio/SDL_coreaudio.c
rename : src/audio/macosx/SDL_coreaudio.h => src/audio/coreaudio/SDL_coreaudio.h
parent cd8da309
...@@ -123,6 +123,8 @@ ...@@ -123,6 +123,8 @@
04FFAB9612E23BDC00BA343D /* SDL_blendmode.h in Headers */ = {isa = PBXBuildFile; fileRef = 04FFAB9312E23BDC00BA343D /* SDL_blendmode.h */; settings = {ATTRIBUTES = (Public, ); }; }; 04FFAB9612E23BDC00BA343D /* SDL_blendmode.h in Headers */ = {isa = PBXBuildFile; fileRef = 04FFAB9312E23BDC00BA343D /* SDL_blendmode.h */; settings = {ATTRIBUTES = (Public, ); }; };
04FFAB9812E23BDC00BA343D /* SDL_shape.h in Headers */ = {isa = PBXBuildFile; fileRef = 04FFAB9512E23BDC00BA343D /* SDL_shape.h */; settings = {ATTRIBUTES = (Public, ); }; }; 04FFAB9812E23BDC00BA343D /* SDL_shape.h in Headers */ = {isa = PBXBuildFile; fileRef = 04FFAB9512E23BDC00BA343D /* SDL_shape.h */; settings = {ATTRIBUTES = (Public, ); }; };
22C905CD13A22646003FE4E4 /* SDL_hints_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 22C905CC13A22646003FE4E4 /* SDL_hints_c.h */; }; 22C905CD13A22646003FE4E4 /* SDL_hints_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 22C905CC13A22646003FE4E4 /* SDL_hints_c.h */; };
56EA86FB13E9EC2B002E47EB /* SDL_coreaudio.c in Sources */ = {isa = PBXBuildFile; fileRef = 56EA86F913E9EC2B002E47EB /* SDL_coreaudio.c */; };
56EA86FC13E9EC2B002E47EB /* SDL_coreaudio.h in Headers */ = {isa = PBXBuildFile; fileRef = 56EA86FA13E9EC2B002E47EB /* SDL_coreaudio.h */; };
56ED04E1118A8EE200A56AA6 /* SDL_power.c in Sources */ = {isa = PBXBuildFile; fileRef = 56ED04E0118A8EE200A56AA6 /* SDL_power.c */; }; 56ED04E1118A8EE200A56AA6 /* SDL_power.c in Sources */ = {isa = PBXBuildFile; fileRef = 56ED04E0118A8EE200A56AA6 /* SDL_power.c */; };
56ED04E3118A8EFD00A56AA6 /* SDL_syspower.m in Sources */ = {isa = PBXBuildFile; fileRef = 56ED04E2118A8EFD00A56AA6 /* SDL_syspower.m */; }; 56ED04E3118A8EFD00A56AA6 /* SDL_syspower.m in Sources */ = {isa = PBXBuildFile; fileRef = 56ED04E2118A8EFD00A56AA6 /* SDL_syspower.m */; };
FD24846D0E5655AE0021E198 /* SDL_uikitkeyboard.h in Headers */ = {isa = PBXBuildFile; fileRef = FD24846B0E5655AE0021E198 /* SDL_uikitkeyboard.h */; }; FD24846D0E5655AE0021E198 /* SDL_uikitkeyboard.h in Headers */ = {isa = PBXBuildFile; fileRef = FD24846B0E5655AE0021E198 /* SDL_uikitkeyboard.h */; };
...@@ -191,8 +193,6 @@ ...@@ -191,8 +193,6 @@
FD65267F0DE8FCDD002AD96B /* SDL_thread.c in Sources */ = {isa = PBXBuildFile; fileRef = FD99BA150DD52EDC00FB1D6B /* SDL_thread.c */; }; FD65267F0DE8FCDD002AD96B /* SDL_thread.c in Sources */ = {isa = PBXBuildFile; fileRef = FD99BA150DD52EDC00FB1D6B /* SDL_thread.c */; };
FD6526800DE8FCDD002AD96B /* SDL_timer.c in Sources */ = {isa = PBXBuildFile; fileRef = FD99BA2E0DD52EDC00FB1D6B /* SDL_timer.c */; }; FD6526800DE8FCDD002AD96B /* SDL_timer.c in Sources */ = {isa = PBXBuildFile; fileRef = FD99BA2E0DD52EDC00FB1D6B /* SDL_timer.c */; };
FD6526810DE8FCDD002AD96B /* SDL_systimer.c in Sources */ = {isa = PBXBuildFile; fileRef = FD99BA310DD52EDC00FB1D6B /* SDL_systimer.c */; }; FD6526810DE8FCDD002AD96B /* SDL_systimer.c in Sources */ = {isa = PBXBuildFile; fileRef = FD99BA310DD52EDC00FB1D6B /* SDL_systimer.c */; };
FD689EFB0E26E57800F90B21 /* SDL_coreaudio_iphone.c in Sources */ = {isa = PBXBuildFile; fileRef = FD689EF90E26E57800F90B21 /* SDL_coreaudio_iphone.c */; };
FD689EFC0E26E57800F90B21 /* SDL_coreaudio_iphone.h in Headers */ = {isa = PBXBuildFile; fileRef = FD689EFA0E26E57800F90B21 /* SDL_coreaudio_iphone.h */; };
FD689F030E26E5B600F90B21 /* SDL_sysjoystick.m in Sources */ = {isa = PBXBuildFile; fileRef = FD689F000E26E5B600F90B21 /* SDL_sysjoystick.m */; }; FD689F030E26E5B600F90B21 /* SDL_sysjoystick.m in Sources */ = {isa = PBXBuildFile; fileRef = FD689F000E26E5B600F90B21 /* SDL_sysjoystick.m */; };
FD689F040E26E5B600F90B21 /* SDLUIAccelerationDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = FD689F010E26E5B600F90B21 /* SDLUIAccelerationDelegate.h */; }; FD689F040E26E5B600F90B21 /* SDLUIAccelerationDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = FD689F010E26E5B600F90B21 /* SDLUIAccelerationDelegate.h */; };
FD689F050E26E5B600F90B21 /* SDLUIAccelerationDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = FD689F020E26E5B600F90B21 /* SDLUIAccelerationDelegate.m */; }; FD689F050E26E5B600F90B21 /* SDLUIAccelerationDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = FD689F020E26E5B600F90B21 /* SDLUIAccelerationDelegate.m */; };
...@@ -378,6 +378,8 @@ ...@@ -378,6 +378,8 @@
04FFAB9312E23BDC00BA343D /* SDL_blendmode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_blendmode.h; path = ../../include/SDL_blendmode.h; sourceTree = SOURCE_ROOT; }; 04FFAB9312E23BDC00BA343D /* SDL_blendmode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_blendmode.h; path = ../../include/SDL_blendmode.h; sourceTree = SOURCE_ROOT; };
04FFAB9512E23BDC00BA343D /* SDL_shape.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_shape.h; path = ../../include/SDL_shape.h; sourceTree = SOURCE_ROOT; }; 04FFAB9512E23BDC00BA343D /* SDL_shape.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_shape.h; path = ../../include/SDL_shape.h; sourceTree = SOURCE_ROOT; };
22C905CC13A22646003FE4E4 /* SDL_hints_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_hints_c.h; path = ../../src/SDL_hints_c.h; sourceTree = "<group>"; }; 22C905CC13A22646003FE4E4 /* SDL_hints_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_hints_c.h; path = ../../src/SDL_hints_c.h; sourceTree = "<group>"; };
56EA86F913E9EC2B002E47EB /* SDL_coreaudio.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_coreaudio.c; path = coreaudio/SDL_coreaudio.c; sourceTree = "<group>"; };
56EA86FA13E9EC2B002E47EB /* SDL_coreaudio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_coreaudio.h; path = coreaudio/SDL_coreaudio.h; sourceTree = "<group>"; };
56ED04E0118A8EE200A56AA6 /* SDL_power.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_power.c; path = ../../src/power/SDL_power.c; sourceTree = SOURCE_ROOT; }; 56ED04E0118A8EE200A56AA6 /* SDL_power.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_power.c; path = ../../src/power/SDL_power.c; sourceTree = SOURCE_ROOT; };
56ED04E2118A8EFD00A56AA6 /* SDL_syspower.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SDL_syspower.m; path = ../../src/power/uikit/SDL_syspower.m; sourceTree = SOURCE_ROOT; }; 56ED04E2118A8EFD00A56AA6 /* SDL_syspower.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SDL_syspower.m; path = ../../src/power/uikit/SDL_syspower.m; sourceTree = SOURCE_ROOT; };
FD0BBFEF0E3933DD00D833B1 /* SDL_uikitview.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_uikitview.h; sourceTree = "<group>"; }; FD0BBFEF0E3933DD00D833B1 /* SDL_uikitview.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_uikitview.h; sourceTree = "<group>"; };
...@@ -392,8 +394,6 @@ ...@@ -392,8 +394,6 @@
FD5F9D1F0E0E08B3008E885B /* SDL_joystick_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_joystick_c.h; sourceTree = "<group>"; }; FD5F9D1F0E0E08B3008E885B /* SDL_joystick_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_joystick_c.h; sourceTree = "<group>"; };
FD5F9D200E0E08B3008E885B /* SDL_sysjoystick.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_sysjoystick.h; sourceTree = "<group>"; }; FD5F9D200E0E08B3008E885B /* SDL_sysjoystick.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_sysjoystick.h; sourceTree = "<group>"; };
FD6526630DE8FCCB002AD96B /* libSDL.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libSDL.a; sourceTree = BUILT_PRODUCTS_DIR; }; FD6526630DE8FCCB002AD96B /* libSDL.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libSDL.a; sourceTree = BUILT_PRODUCTS_DIR; };
FD689EF90E26E57800F90B21 /* SDL_coreaudio_iphone.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_coreaudio_iphone.c; sourceTree = "<group>"; };
FD689EFA0E26E57800F90B21 /* SDL_coreaudio_iphone.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_coreaudio_iphone.h; sourceTree = "<group>"; };
FD689F000E26E5B600F90B21 /* SDL_sysjoystick.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDL_sysjoystick.m; sourceTree = "<group>"; }; FD689F000E26E5B600F90B21 /* SDL_sysjoystick.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDL_sysjoystick.m; sourceTree = "<group>"; };
FD689F010E26E5B600F90B21 /* SDLUIAccelerationDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDLUIAccelerationDelegate.h; sourceTree = "<group>"; }; FD689F010E26E5B600F90B21 /* SDLUIAccelerationDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDLUIAccelerationDelegate.h; sourceTree = "<group>"; };
FD689F020E26E5B600F90B21 /* SDLUIAccelerationDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLUIAccelerationDelegate.m; sourceTree = "<group>"; }; FD689F020E26E5B600F90B21 /* SDLUIAccelerationDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLUIAccelerationDelegate.m; sourceTree = "<group>"; };
...@@ -785,6 +785,15 @@ ...@@ -785,6 +785,15 @@
name = Frameworks; name = Frameworks;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
56EA86F813E9EBF9002E47EB /* coreaudio */ = {
isa = PBXGroup;
children = (
56EA86F913E9EC2B002E47EB /* SDL_coreaudio.c */,
56EA86FA13E9EC2B002E47EB /* SDL_coreaudio.h */,
);
name = coreaudio;
sourceTree = "<group>";
};
56ED04DE118A8E9A00A56AA6 /* power */ = { 56ED04DE118A8E9A00A56AA6 /* power */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
...@@ -828,15 +837,6 @@ ...@@ -828,15 +837,6 @@
path = ../../src/joystick; path = ../../src/joystick;
sourceTree = SOURCE_ROOT; sourceTree = SOURCE_ROOT;
}; };
FD689EF80E26E57800F90B21 /* iphoneos */ = {
isa = PBXGroup;
children = (
FD689EF90E26E57800F90B21 /* SDL_coreaudio_iphone.c */,
FD689EFA0E26E57800F90B21 /* SDL_coreaudio_iphone.h */,
);
path = iphoneos;
sourceTree = "<group>";
};
FD689EFF0E26E5B600F90B21 /* iphoneos */ = { FD689EFF0E26E5B600F90B21 /* iphoneos */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
...@@ -983,7 +983,7 @@ ...@@ -983,7 +983,7 @@
FD99B8FB0DD52EDC00FB1D6B /* audio */ = { FD99B8FB0DD52EDC00FB1D6B /* audio */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
FD689EF80E26E57800F90B21 /* iphoneos */, 56EA86F813E9EBF9002E47EB /* coreaudio */,
FD99B91C0DD52EDC00FB1D6B /* dummy */, FD99B91C0DD52EDC00FB1D6B /* dummy */,
FD99B9440DD52EDC00FB1D6B /* SDL_audio.c */, FD99B9440DD52EDC00FB1D6B /* SDL_audio.c */,
FD99B9450DD52EDC00FB1D6B /* SDL_audio_c.h */, FD99B9450DD52EDC00FB1D6B /* SDL_audio_c.h */,
...@@ -1196,7 +1196,6 @@ ...@@ -1196,7 +1196,6 @@
FDA686000DF244C800F98A1A /* SDL_nullvideo.h in Headers */, FDA686000DF244C800F98A1A /* SDL_nullvideo.h in Headers */,
FD5F9D300E0E08B3008E885B /* SDL_joystick_c.h in Headers */, FD5F9D300E0E08B3008E885B /* SDL_joystick_c.h in Headers */,
FD5F9D310E0E08B3008E885B /* SDL_sysjoystick.h in Headers */, FD5F9D310E0E08B3008E885B /* SDL_sysjoystick.h in Headers */,
FD689EFC0E26E57800F90B21 /* SDL_coreaudio_iphone.h in Headers */,
FD689F040E26E5B600F90B21 /* SDLUIAccelerationDelegate.h in Headers */, FD689F040E26E5B600F90B21 /* SDLUIAccelerationDelegate.h in Headers */,
FD689F1C0E26E5D900F90B21 /* SDL_uikitevents.h in Headers */, FD689F1C0E26E5D900F90B21 /* SDL_uikitevents.h in Headers */,
FD689F1E0E26E5D900F90B21 /* SDL_uikitopengles.h in Headers */, FD689F1E0E26E5D900F90B21 /* SDL_uikitopengles.h in Headers */,
...@@ -1245,6 +1244,7 @@ ...@@ -1245,6 +1244,7 @@
04BAC09C1300C1290055DE28 /* SDL_assert_c.h in Headers */, 04BAC09C1300C1290055DE28 /* SDL_assert_c.h in Headers */,
0417A516130C988500578583 /* SDL_keycode.h in Headers */, 0417A516130C988500578583 /* SDL_keycode.h in Headers */,
22C905CD13A22646003FE4E4 /* SDL_hints_c.h in Headers */, 22C905CD13A22646003FE4E4 /* SDL_hints_c.h in Headers */,
56EA86FC13E9EC2B002E47EB /* SDL_coreaudio.h in Headers */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
...@@ -1433,7 +1433,6 @@ ...@@ -1433,7 +1433,6 @@
FDA685FB0DF244C800F98A1A /* SDL_nullevents.c in Sources */, FDA685FB0DF244C800F98A1A /* SDL_nullevents.c in Sources */,
FDA685FF0DF244C800F98A1A /* SDL_nullvideo.c in Sources */, FDA685FF0DF244C800F98A1A /* SDL_nullvideo.c in Sources */,
FD5F9D2F0E0E08B3008E885B /* SDL_joystick.c in Sources */, FD5F9D2F0E0E08B3008E885B /* SDL_joystick.c in Sources */,
FD689EFB0E26E57800F90B21 /* SDL_coreaudio_iphone.c in Sources */,
FD689F030E26E5B600F90B21 /* SDL_sysjoystick.m in Sources */, FD689F030E26E5B600F90B21 /* SDL_sysjoystick.m in Sources */,
FD689F050E26E5B600F90B21 /* SDLUIAccelerationDelegate.m in Sources */, FD689F050E26E5B600F90B21 /* SDLUIAccelerationDelegate.m in Sources */,
FD689F1D0E26E5D900F90B21 /* SDL_uikitevents.m in Sources */, FD689F1D0E26E5D900F90B21 /* SDL_uikitevents.m in Sources */,
...@@ -1474,6 +1473,7 @@ ...@@ -1474,6 +1473,7 @@
0402A85812FE70C600CECEE3 /* SDL_render_gles2.c in Sources */, 0402A85812FE70C600CECEE3 /* SDL_render_gles2.c in Sources */,
0402A85912FE70C600CECEE3 /* SDL_shaders_gles2.c in Sources */, 0402A85912FE70C600CECEE3 /* SDL_shaders_gles2.c in Sources */,
04BAC09D1300C1290055DE28 /* SDL_log.c in Sources */, 04BAC09D1300C1290055DE28 /* SDL_log.c in Sources */,
56EA86FB13E9EC2B002E47EB /* SDL_coreaudio.c in Sources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
......
...@@ -1139,7 +1139,7 @@ ...@@ -1139,7 +1139,7 @@
children = ( children = (
04BDFD8712E6671700899322 /* disk */, 04BDFD8712E6671700899322 /* disk */,
04BDFD9312E6671700899322 /* dummy */, 04BDFD9312E6671700899322 /* dummy */,
04BDFD9F12E6671700899322 /* macosx */, 04BDFD9F12E6671700899322 /* coreaudio */,
04BDFDB412E6671700899322 /* SDL_audio.c */, 04BDFDB412E6671700899322 /* SDL_audio.c */,
04BDFDB512E6671700899322 /* SDL_audio_c.h */, 04BDFDB512E6671700899322 /* SDL_audio_c.h */,
04BDFDB612E6671700899322 /* SDL_audiocvt.c */, 04BDFDB612E6671700899322 /* SDL_audiocvt.c */,
...@@ -1174,13 +1174,13 @@ ...@@ -1174,13 +1174,13 @@
path = dummy; path = dummy;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
04BDFD9F12E6671700899322 /* macosx */ = { 04BDFD9F12E6671700899322 /* coreaudio */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
04BDFDA012E6671700899322 /* SDL_coreaudio.c */, 04BDFDA012E6671700899322 /* SDL_coreaudio.c */,
04BDFDA112E6671700899322 /* SDL_coreaudio.h */, 04BDFDA112E6671700899322 /* SDL_coreaudio.h */,
); );
path = macosx; path = coreaudio;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
04BDFDD312E6671700899322 /* cpuinfo */ = { 04BDFDD312E6671700899322 /* cpuinfo */ = {
......
...@@ -2306,7 +2306,7 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau ...@@ -2306,7 +2306,7 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau
# Set up files for the audio library # Set up files for the audio library
if test x$enable_audio = xyes; then if test x$enable_audio = xyes; then
AC_DEFINE(SDL_AUDIO_DRIVER_COREAUDIO, 1, [ ]) AC_DEFINE(SDL_AUDIO_DRIVER_COREAUDIO, 1, [ ])
SOURCES="$SOURCES $srcdir/src/audio/macosx/*.c" SOURCES="$SOURCES $srcdir/src/audio/coreaudio/*.c"
have_audio=yes have_audio=yes
fi fi
# Set up files for the joystick library # Set up files for the joystick library
......
...@@ -58,7 +58,6 @@ extern AudioBootStrap WINMM_bootstrap; ...@@ -58,7 +58,6 @@ extern AudioBootStrap WINMM_bootstrap;
extern AudioBootStrap PAUDIO_bootstrap; extern AudioBootStrap PAUDIO_bootstrap;
extern AudioBootStrap BEOSAUDIO_bootstrap; extern AudioBootStrap BEOSAUDIO_bootstrap;
extern AudioBootStrap COREAUDIO_bootstrap; extern AudioBootStrap COREAUDIO_bootstrap;
extern AudioBootStrap COREAUDIOIPHONE_bootstrap;
extern AudioBootStrap SNDMGR_bootstrap; extern AudioBootStrap SNDMGR_bootstrap;
extern AudioBootStrap DISKAUD_bootstrap; extern AudioBootStrap DISKAUD_bootstrap;
extern AudioBootStrap DUMMYAUD_bootstrap; extern AudioBootStrap DUMMYAUD_bootstrap;
...@@ -116,9 +115,6 @@ static const AudioBootStrap *const bootstrap[] = { ...@@ -116,9 +115,6 @@ static const AudioBootStrap *const bootstrap[] = {
#if SDL_AUDIO_DRIVER_COREAUDIO #if SDL_AUDIO_DRIVER_COREAUDIO
&COREAUDIO_bootstrap, &COREAUDIO_bootstrap,
#endif #endif
#if SDL_AUDIO_DRIVER_COREAUDIOIPHONE
&COREAUDIOIPHONE_bootstrap,
#endif
#if SDL_AUDIO_DRIVER_DISK #if SDL_AUDIO_DRIVER_DISK
&DISKAUD_bootstrap, &DISKAUD_bootstrap,
#endif #endif
......
...@@ -20,12 +20,15 @@ ...@@ -20,12 +20,15 @@
*/ */
#include "SDL_config.h" #include "SDL_config.h"
#if MACOSX_COREAUDIO
#include <CoreAudio/CoreAudio.h> #include <CoreAudio/CoreAudio.h>
#include <CoreServices/CoreServices.h> #include <CoreServices/CoreServices.h>
#include <AudioUnit/AudioUnit.h>
#if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_5 #if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_5
#include <AudioUnit/AUNTComponent.h> #include <AudioUnit/AUNTComponent.h>
#endif #endif
#endif
#include <AudioUnit/AudioUnit.h>
#include "SDL_audio.h" #include "SDL_audio.h"
#include "../SDL_audio_c.h" #include "../SDL_audio_c.h"
...@@ -34,6 +37,16 @@ ...@@ -34,6 +37,16 @@
#define DEBUG_COREAUDIO 0 #define DEBUG_COREAUDIO 0
static void COREAUDIO_CloseDevice(_THIS);
#define CHECK_RESULT(msg) \
if (result != noErr) { \
COREAUDIO_CloseDevice(this); \
SDL_SetError("CoreAudio error (%s): %d", msg, (int) result); \
return 0; \
}
#if MACOSX_COREAUDIO
typedef void (*addDevFn)(const char *name, AudioDeviceID devId, void *data); typedef void (*addDevFn)(const char *name, AudioDeviceID devId, void *data);
static void static void
...@@ -172,6 +185,62 @@ COREAUDIO_DetectDevices(int iscapture, SDL_AddAudioDevice addfn) ...@@ -172,6 +185,62 @@ COREAUDIO_DetectDevices(int iscapture, SDL_AddAudioDevice addfn)
build_device_list(iscapture, addToDevList, addfn); build_device_list(iscapture, addToDevList, addfn);
} }
static int
find_device_by_name(_THIS, const char *devname, int iscapture)
{
AudioDeviceID devid = 0;
OSStatus result = noErr;
UInt32 size = 0;
UInt32 alive = 0;
pid_t pid = 0;
if (devname == NULL) {
size = sizeof(AudioDeviceID);
const AudioHardwarePropertyID propid =
((iscapture) ? kAudioHardwarePropertyDefaultInputDevice :
kAudioHardwarePropertyDefaultOutputDevice);
result = AudioHardwareGetProperty(propid, &size, &devid);
CHECK_RESULT("AudioHardwareGetProperty (default device)");
} else {
FindDevIdData data;
SDL_zero(data);
data.findname = devname;
build_device_list(iscapture, findDevId, &data);
if (!data.found) {
SDL_SetError("CoreAudio: No such audio device.");
return 0;
}
devid = data.devId;
}
size = sizeof(alive);
result = AudioDeviceGetProperty(devid, 0, iscapture,
kAudioDevicePropertyDeviceIsAlive,
&size, &alive);
CHECK_RESULT
("AudioDeviceGetProperty (kAudioDevicePropertyDeviceIsAlive)");
if (!alive) {
SDL_SetError("CoreAudio: requested device exists, but isn't alive.");
return 0;
}
size = sizeof(pid);
result = AudioDeviceGetProperty(devid, 0, iscapture,
kAudioDevicePropertyHogMode, &size, &pid);
/* some devices don't support this property, so errors are fine here. */
if ((result == noErr) && (pid != -1)) {
SDL_SetError("CoreAudio: requested device is being hogged.");
return 0;
}
this->hidden->deviceID = devid;
return 1;
}
#endif
/* The CoreAudio callback */ /* The CoreAudio callback */
static OSStatus static OSStatus
outputCallback(void *inRefCon, outputCallback(void *inRefCon,
...@@ -272,7 +341,11 @@ COREAUDIO_CloseDevice(_THIS) ...@@ -272,7 +341,11 @@ COREAUDIO_CloseDevice(_THIS)
scope, bus, &callback, scope, bus, &callback,
sizeof(callback)); sizeof(callback));
/* !!! FIXME: how does iOS free this? */
#if MACOSX_COREAUDIO
CloseComponent(this->hidden->audioUnit); CloseComponent(this->hidden->audioUnit);
#endif
this->hidden->audioUnitOpened = 0; this->hidden->audioUnitOpened = 0;
} }
SDL_free(this->hidden->buffer); SDL_free(this->hidden->buffer);
...@@ -282,105 +355,65 @@ COREAUDIO_CloseDevice(_THIS) ...@@ -282,105 +355,65 @@ COREAUDIO_CloseDevice(_THIS)
} }
#define CHECK_RESULT(msg) \
if (result != noErr) { \
COREAUDIO_CloseDevice(this); \
SDL_SetError("CoreAudio error (%s): %d", msg, (int) result); \
return 0; \
}
static int
find_device_by_name(_THIS, const char *devname, int iscapture)
{
AudioDeviceID devid = 0;
OSStatus result = noErr;
UInt32 size = 0;
UInt32 alive = 0;
pid_t pid = 0;
if (devname == NULL) {
size = sizeof(AudioDeviceID);
const AudioHardwarePropertyID propid =
((iscapture) ? kAudioHardwarePropertyDefaultInputDevice :
kAudioHardwarePropertyDefaultOutputDevice);
result = AudioHardwareGetProperty(propid, &size, &devid);
CHECK_RESULT("AudioHardwareGetProperty (default device)");
} else {
FindDevIdData data;
SDL_zero(data);
data.findname = devname;
build_device_list(iscapture, findDevId, &data);
if (!data.found) {
SDL_SetError("CoreAudio: No such audio device.");
return 0;
}
devid = data.devId;
}
size = sizeof(alive);
result = AudioDeviceGetProperty(devid, 0, iscapture,
kAudioDevicePropertyDeviceIsAlive,
&size, &alive);
CHECK_RESULT
("AudioDeviceGetProperty (kAudioDevicePropertyDeviceIsAlive)");
if (!alive) {
SDL_SetError("CoreAudio: requested device exists, but isn't alive.");
return 0;
}
size = sizeof(pid);
result = AudioDeviceGetProperty(devid, 0, iscapture,
kAudioDevicePropertyHogMode, &size, &pid);
/* some devices don't support this property, so errors are fine here. */
if ((result == noErr) && (pid != -1)) {
SDL_SetError("CoreAudio: requested device is being hogged.");
return 0;
}
this->hidden->deviceID = devid;
return 1;
}
static int static int
prepare_audiounit(_THIS, const char *devname, int iscapture, prepare_audiounit(_THIS, const char *devname, int iscapture,
const AudioStreamBasicDescription * strdesc) const AudioStreamBasicDescription * strdesc)
{ {
OSStatus result = noErr; OSStatus result = noErr;
AURenderCallbackStruct callback; AURenderCallbackStruct callback;
#if MACOSX_COREAUDIO
ComponentDescription desc; ComponentDescription desc;
Component comp = NULL; Component comp = NULL;
#else
AudioComponentDescription desc;
AudioComponent comp = NULL;
#endif
const AudioUnitElement output_bus = 0; const AudioUnitElement output_bus = 0;
const AudioUnitElement input_bus = 1; const AudioUnitElement input_bus = 1;
const AudioUnitElement bus = ((iscapture) ? input_bus : output_bus); const AudioUnitElement bus = ((iscapture) ? input_bus : output_bus);
const AudioUnitScope scope = ((iscapture) ? kAudioUnitScope_Output : const AudioUnitScope scope = ((iscapture) ? kAudioUnitScope_Output :
kAudioUnitScope_Input); kAudioUnitScope_Input);
#if MACOSX_COREAUDIO
if (!find_device_by_name(this, devname, iscapture)) { if (!find_device_by_name(this, devname, iscapture)) {
SDL_SetError("Couldn't find requested CoreAudio device"); SDL_SetError("Couldn't find requested CoreAudio device");
return 0; return 0;
} }
#endif
SDL_memset(&desc, '\0', sizeof(ComponentDescription));
SDL_zero(desc);
desc.componentType = kAudioUnitType_Output; desc.componentType = kAudioUnitType_Output;
desc.componentSubType = kAudioUnitSubType_DefaultOutput;
desc.componentManufacturer = kAudioUnitManufacturer_Apple; desc.componentManufacturer = kAudioUnitManufacturer_Apple;
#if MACOSX_COREAUDIO
desc.componentSubType = kAudioUnitSubType_DefaultOutput;
comp = FindNextComponent(NULL, &desc); comp = FindNextComponent(NULL, &desc);
#else
desc.componentSubType = kAudioUnitSubType_RemoteIO; /* !!! FIXME: ? */
comp = AudioComponentFindNext(NULL, &desc);
#endif
if (comp == NULL) { if (comp == NULL) {
SDL_SetError("Couldn't find requested CoreAudio component"); SDL_SetError("Couldn't find requested CoreAudio component");
return 0; return 0;
} }
/* Open & initialize the audio unit */ /* Open & initialize the audio unit */
#if MACOSX_COREAUDIO
result = OpenAComponent(comp, &this->hidden->audioUnit); result = OpenAComponent(comp, &this->hidden->audioUnit);
CHECK_RESULT("OpenAComponent"); CHECK_RESULT("OpenAComponent");
#else
/*
AudioComponentInstanceNew only available on iPhone OS 2.0 and Mac OS X 10.6
We can't use OpenAComponent on iPhone because it is not present
*/
result = AudioComponentInstanceNew(comp, &this->hidden->audioUnit);
CHECK_RESULT("AudioComponentInstanceNew");
#endif
this->hidden->audioUnitOpened = 1; this->hidden->audioUnitOpened = 1;
#if MACOSX_COREAUDIO
result = AudioUnitSetProperty(this->hidden->audioUnit, result = AudioUnitSetProperty(this->hidden->audioUnit,
kAudioOutputUnitProperty_CurrentDevice, kAudioOutputUnitProperty_CurrentDevice,
kAudioUnitScope_Global, 0, kAudioUnitScope_Global, 0,
...@@ -388,6 +421,7 @@ prepare_audiounit(_THIS, const char *devname, int iscapture, ...@@ -388,6 +421,7 @@ prepare_audiounit(_THIS, const char *devname, int iscapture,
sizeof(AudioDeviceID)); sizeof(AudioDeviceID));
CHECK_RESULT CHECK_RESULT
("AudioUnitSetProperty (kAudioOutputUnitProperty_CurrentDevice)"); ("AudioUnitSetProperty (kAudioOutputUnitProperty_CurrentDevice)");
#endif
/* Set the data format of the audio unit. */ /* Set the data format of the audio unit. */
result = AudioUnitSetProperty(this->hidden->audioUnit, result = AudioUnitSetProperty(this->hidden->audioUnit,
...@@ -498,16 +532,22 @@ static int ...@@ -498,16 +532,22 @@ static int
COREAUDIO_Init(SDL_AudioDriverImpl * impl) COREAUDIO_Init(SDL_AudioDriverImpl * impl)
{ {
/* Set the function pointers */ /* Set the function pointers */
impl->DetectDevices = COREAUDIO_DetectDevices;
impl->OpenDevice = COREAUDIO_OpenDevice; impl->OpenDevice = COREAUDIO_OpenDevice;
impl->CloseDevice = COREAUDIO_CloseDevice; impl->CloseDevice = COREAUDIO_CloseDevice;
#if MACOSX_COREAUDIO
impl->DetectDevices = COREAUDIO_DetectDevices;
#else
impl->OnlyHasDefaultOutputDevice = 1;
#endif
impl->ProvidesOwnCallbackThread = 1; impl->ProvidesOwnCallbackThread = 1;
return 1; /* this audio target is available. */ return 1; /* this audio target is available. */
} }
AudioBootStrap COREAUDIO_bootstrap = { AudioBootStrap COREAUDIO_bootstrap = {
"coreaudio", "Mac OS X CoreAudio", COREAUDIO_Init, 0 "coreaudio", "CoreAudio", COREAUDIO_Init, 0
}; };
/* vi: set ts=4 sw=4 expandtab: */ /* vi: set ts=4 sw=4 expandtab: */
...@@ -25,6 +25,10 @@ ...@@ -25,6 +25,10 @@
#include "../SDL_sysaudio.h" #include "../SDL_sysaudio.h"
#if !defined(__IPHONEOS__)
#define MACOSX_COREAUDIO 1
#endif
/* Hidden "this" pointer for the audio functions */ /* Hidden "this" pointer for the audio functions */
#define _THIS SDL_AudioDevice *this #define _THIS SDL_AudioDevice *this
...@@ -35,7 +39,9 @@ struct SDL_PrivateAudioData ...@@ -35,7 +39,9 @@ struct SDL_PrivateAudioData
void *buffer; void *buffer;
UInt32 bufferOffset; UInt32 bufferOffset;
UInt32 bufferSize; UInt32 bufferSize;
#if MACOSX_COREAUDIO
AudioDeviceID deviceID; AudioDeviceID deviceID;
#endif
}; };
#endif /* _SDL_coreaudio_h */ #endif /* _SDL_coreaudio_h */
......
This diff is collapsed.
/*
Simple DirectMedia Layer
Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#include "SDL_config.h"
#ifndef _SDL_coreaudio_h
#define _SDL_coreaudio_h
#include "../SDL_sysaudio.h"
/* Hidden "this" pointer for the audio functions */
#define _THIS SDL_AudioDevice *this
struct SDL_PrivateAudioData
{
AudioUnit audioUnit;
int audioUnitOpened;
void *buffer;
UInt32 bufferOffset;
UInt32 bufferSize;
// AudioDeviceID deviceID;
};
#endif /* _SDL_coreaudio_h */
/* vi: set ts=4 sw=4 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment