Skip to content

Commit c0d22f3

Browse files
author
Jay
committed
Checkpoint sdl audio update
1 parent e4fc091 commit c0d22f3

File tree

162 files changed

+42738
-617
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

162 files changed

+42738
-617
lines changed

.github/workflows/test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ jobs:
1212
- uses: actions/checkout@v3
1313
- uses: mlugg/setup-zig@v2
1414
with:
15-
version: 0.14.1
15+
version: 0.15.2
1616
- run: zig build test
1717

build.zig

Lines changed: 15 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -108,28 +108,16 @@ pub fn add_translatec_headers(
108108
const sdk = std.zig.system.darwin.getSdk(b.allocator, &target.result) orelse
109109
@panic("macOS SDK is missing");
110110
std.log.info("engine using macos c headers: {s}", .{sdk});
111-
lib.addSystemIncludePath(.{ .cwd_relative = b.pathJoin(&.{
112-
sdk,
113-
"/usr/include",
114-
}) });
115-
lib.addSystemFrameworkPath(.{ .cwd_relative = b.pathJoin(&.{
116-
sdk,
117-
"/System/Library/Frameworks",
118-
}) });
111+
lib.addSystemIncludePath(.{ .cwd_relative = b.pathJoin(&.{ sdk, "/usr/include" }) });
112+
lib.addSystemFrameworkPath(.{ .cwd_relative = b.pathJoin(&.{ sdk, "/System/Library/Frameworks" }) });
119113
},
120114
.ios => {
121115
//const sdk = std.zig.system.darwin.getSdk(b.allocator, b.graph.host.result) orelse
122116
const sdk = std.zig.system.darwin.getSdk(b.allocator, &target.result) orelse
123117
@panic("iOS SDK is missing");
124118
std.log.info("engine using iphoneos c headers: {s}", .{sdk});
125-
lib.addSystemIncludePath(.{ .cwd_relative = b.pathJoin(&.{
126-
sdk,
127-
"/usr/include",
128-
}) });
129-
lib.addSystemFrameworkPath(.{ .cwd_relative = b.pathJoin(&.{
130-
sdk,
131-
"/System/Library/Frameworks",
132-
}) });
119+
lib.addSystemIncludePath(.{ .cwd_relative = b.pathJoin(&.{ sdk, "/usr/include" }) });
120+
lib.addSystemFrameworkPath(.{ .cwd_relative = b.pathJoin(&.{ sdk, "/System/Library/Frameworks" }) });
133121
},
134122
.linux => {
135123
// When building for android, we need to use the android linux headers
@@ -172,27 +160,15 @@ pub fn add_libs(
172160
const sdk = std.zig.system.darwin.getSdk(b.allocator, &target.result) orelse
173161
@panic("macOS SDK is missing");
174162
std.log.info("engine using macos c headers: {s}", .{sdk});
175-
lib.addSystemIncludePath(.{ .cwd_relative = b.pathJoin(&.{
176-
sdk,
177-
"/usr/include",
178-
}) });
179-
lib.addSystemFrameworkPath(.{ .cwd_relative = b.pathJoin(&.{
180-
sdk,
181-
"/System/Library/Frameworks",
182-
}) });
163+
lib.addSystemIncludePath(.{ .cwd_relative = b.pathJoin(&.{ sdk, "/usr/include" }) });
164+
lib.addSystemFrameworkPath(.{ .cwd_relative = b.pathJoin(&.{ sdk, "/System/Library/Frameworks" }) });
183165
},
184166
.ios => {
185167
const sdk = std.zig.system.darwin.getSdk(b.allocator, &target.result) orelse
186168
@panic("iOS SDK is missing");
187169
std.log.info("engine using iphoneos c headers: {s}", .{sdk});
188-
lib.addSystemIncludePath(.{ .cwd_relative = b.pathJoin(&.{
189-
sdk,
190-
"/usr/include",
191-
}) });
192-
lib.addSystemFrameworkPath(.{ .cwd_relative = b.pathJoin(&.{
193-
sdk,
194-
"/System/Library/Frameworks",
195-
}) });
170+
lib.addSystemIncludePath(.{ .cwd_relative = b.pathJoin(&.{ sdk, "/usr/include" }) });
171+
lib.addSystemFrameworkPath(.{ .cwd_relative = b.pathJoin(&.{ sdk, "/System/Library/Frameworks" }) });
196172
},
197173
.linux => {
198174
// When building for android, we need to use the android linux headers
@@ -238,6 +214,13 @@ pub fn link_sdl_framework(
238214
lib.addRPath(b.path("libs/SDL3_ttf.xcframework/macos-arm64_x86_64/"));
239215
lib.linkFramework("SDL3", .{});
240216
lib.linkFramework("SDL3_ttf", .{});
217+
//lib.addSystemIncludePath(b.path("libs/SDL3_mixer/"));
218+
//lib.addSystemFrameworkPath(b.path("libs/SDL3_mixer/"));
219+
lib.addLibraryPath(b.path("libs/SDL3_mixer/"));
220+
lib.linkSystemLibrary("SDL3_mixer.0.1.0", .{});
221+
lib.linkSystemLibrary("vorbis.0.4.9", .{});
222+
lib.linkSystemLibrary("ogg.0.8.5", .{});
223+
lib.linkSystemLibrary("vorbisfile.3.3.8", .{});
241224
},
242225
.ios => {
243226
if (target.result.abi == .simulator) {

build.zig.zon

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,10 @@
2929
"README.md",
3030
"libs/SDL3.xcframework",
3131
"libs/SDL3_ttf.xcframework",
32+
"libs/SDL3_mixer/libSDL3_mixer.0.1.0.dylib",
33+
"libs/SDL3_mixer/libvorbisfile.3.3.8.dylib",
34+
"libs/SDL3_mixer/libogg.0.8.5.dylib",
35+
"libs/SDL3_mixer/libvorbis.0.4.9.dylib",
36+
"libs/SDL3_mixer/SDL_mixer.h",
3237
},
3338
}

libs/SDL3.xcframework/Info.plist

Lines changed: 27 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,68 +7,80 @@
77
<dict>
88
<key>BinaryPath</key>
99
<string>SDL3.framework/SDL3</string>
10+
<key>DebugSymbolsPath</key>
11+
<string>dSYMs</string>
1012
<key>LibraryIdentifier</key>
11-
<string>tvos-arm64</string>
13+
<string>ios-arm64_x86_64-simulator</string>
1214
<key>LibraryPath</key>
1315
<string>SDL3.framework</string>
1416
<key>SupportedArchitectures</key>
1517
<array>
1618
<string>arm64</string>
19+
<string>x86_64</string>
1720
</array>
1821
<key>SupportedPlatform</key>
19-
<string>tvos</string>
22+
<string>ios</string>
23+
<key>SupportedPlatformVariant</key>
24+
<string>simulator</string>
2025
</dict>
2126
<dict>
2227
<key>BinaryPath</key>
2328
<string>SDL3.framework/SDL3</string>
29+
<key>DebugSymbolsPath</key>
30+
<string>dSYMs</string>
2431
<key>LibraryIdentifier</key>
25-
<string>tvos-arm64_x86_64-simulator</string>
32+
<string>tvos-arm64</string>
2633
<key>LibraryPath</key>
2734
<string>SDL3.framework</string>
2835
<key>SupportedArchitectures</key>
2936
<array>
3037
<string>arm64</string>
31-
<string>x86_64</string>
3238
</array>
3339
<key>SupportedPlatform</key>
3440
<string>tvos</string>
35-
<key>SupportedPlatformVariant</key>
36-
<string>simulator</string>
3741
</dict>
3842
<dict>
3943
<key>BinaryPath</key>
4044
<string>SDL3.framework/SDL3</string>
45+
<key>DebugSymbolsPath</key>
46+
<string>dSYMs</string>
4147
<key>LibraryIdentifier</key>
42-
<string>ios-arm64</string>
48+
<string>tvos-arm64_x86_64-simulator</string>
4349
<key>LibraryPath</key>
4450
<string>SDL3.framework</string>
4551
<key>SupportedArchitectures</key>
4652
<array>
4753
<string>arm64</string>
54+
<string>x86_64</string>
4855
</array>
4956
<key>SupportedPlatform</key>
50-
<string>ios</string>
57+
<string>tvos</string>
58+
<key>SupportedPlatformVariant</key>
59+
<string>simulator</string>
5160
</dict>
5261
<dict>
5362
<key>BinaryPath</key>
54-
<string>SDL3.framework/Versions/A/SDL3</string>
63+
<string>SDL3.framework/SDL3</string>
64+
<key>DebugSymbolsPath</key>
65+
<string>dSYMs</string>
5566
<key>LibraryIdentifier</key>
56-
<string>macos-arm64_x86_64</string>
67+
<string>ios-arm64</string>
5768
<key>LibraryPath</key>
5869
<string>SDL3.framework</string>
5970
<key>SupportedArchitectures</key>
6071
<array>
6172
<string>arm64</string>
62-
<string>x86_64</string>
6373
</array>
6474
<key>SupportedPlatform</key>
65-
<string>macos</string>
75+
<string>ios</string>
6676
</dict>
6777
<dict>
6878
<key>BinaryPath</key>
69-
<string>SDL3.framework/SDL3</string>
79+
<string>SDL3.framework/Versions/A/SDL3</string>
80+
<key>DebugSymbolsPath</key>
81+
<string>dSYMs</string>
7082
<key>LibraryIdentifier</key>
71-
<string>ios-arm64_x86_64-simulator</string>
83+
<string>macos-arm64_x86_64</string>
7284
<key>LibraryPath</key>
7385
<string>SDL3.framework</string>
7486
<key>SupportedArchitectures</key>
@@ -77,9 +89,7 @@
7789
<string>x86_64</string>
7890
</array>
7991
<key>SupportedPlatform</key>
80-
<string>ios</string>
81-
<key>SupportedPlatformVariant</key>
82-
<string>simulator</string>
92+
<string>macos</string>
8393
</dict>
8494
</array>
8595
<key>CFBundlePackageType</key>

libs/SDL3.xcframework/ios-arm64/SDL3.framework/CMake/SDL3Config.cmake

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
# SDL3 CMake configuration file:
2-
# This file is meant to be placed in Resources/CMake of a SDL3 framework
2+
# This file is meant to be placed in Resources/CMake of a SDL3 framework for macOS,
3+
# or in the CMake directory of a SDL3 framework for iOS / tvOS / visionOS.
34

45
# INTERFACE_LINK_OPTIONS needs CMake 3.12
5-
cmake_minimum_required(VERSION 3.12)
6+
cmake_minimum_required(VERSION 3.12...4.0)
67

78
include(FeatureSummary)
89
set_package_properties(SDL3 PROPERTIES
@@ -31,16 +32,31 @@ endmacro()
3132

3233
set(SDL3_FOUND TRUE)
3334

34-
# Compute the installation prefix relative to this file.
35-
set(_sdl3_framework_path "${CMAKE_CURRENT_LIST_DIR}") # > /SDL3.framework/Resources/CMake/
36-
get_filename_component(_sdl3_framework_path "${_sdl3_framework_path}" REALPATH) # > /SDL3.framework/Versions/Current/Resources/CMake
37-
get_filename_component(_sdl3_framework_path "${_sdl3_framework_path}" REALPATH) # > /SDL3.framework/Versions/A/Resources/CMake/
38-
get_filename_component(_sdl3_framework_path "${_sdl3_framework_path}" PATH) # > /SDL3.framework/Versions/A/Resources/
39-
get_filename_component(_sdl3_framework_path "${_sdl3_framework_path}" PATH) # > /SDL3.framework/Versions/A/
40-
get_filename_component(_sdl3_framework_path "${_sdl3_framework_path}" PATH) # > /SDL3.framework/Versions/
41-
get_filename_component(_sdl3_framework_path "${_sdl3_framework_path}" PATH) # > /SDL3.framework/
42-
get_filename_component(_sdl3_framework_parent_path "${_sdl3_framework_path}" PATH) # > /
35+
# Compute the installation prefix relative to this file:
36+
# search upwards for the .framework directory
37+
set(_current_path "${CMAKE_CURRENT_LIST_DIR}")
38+
get_filename_component(_current_path "${_current_path}" REALPATH)
39+
set(_sdl3_framework_path "")
4340

41+
while(NOT _sdl3_framework_path)
42+
if(IS_DIRECTORY "${_current_path}" AND "${_current_path}" MATCHES "/SDL3\\.framework$")
43+
set(_sdl3_framework_path "${_current_path}")
44+
break()
45+
endif()
46+
get_filename_component(_next_current_path "${_current_path}" DIRECTORY)
47+
if("${_current_path}" STREQUAL "${_next_current_path}")
48+
break()
49+
endif()
50+
set(_current_path "${_next_current_path}")
51+
endwhile()
52+
unset(_current_path)
53+
unset(_next_current_path)
54+
55+
if(NOT _sdl3_framework_path)
56+
message(FATAL_ERROR "Could not find SDL3.framework root from ${CMAKE_CURRENT_LIST_DIR}")
57+
endif()
58+
59+
get_filename_component(_sdl3_framework_parent_path "${_sdl3_framework_path}" PATH)
4460

4561
# All targets are created, even when some might not be requested though COMPONENTS.
4662
# This is done for compatibility with CMake generated SDL3-target.cmake files.

libs/SDL3.xcframework/ios-arm64/SDL3.framework/CMake/SDL3ConfigVersion.cmake

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,26 @@
11
# based on the files generated by CMake's write_basic_package_version_file
22

33
# SDL CMake version configuration file:
4-
# This file is meant to be placed in Resources/CMake of a SDL3 framework
4+
# This file is meant to be placed in Resources/CMake of a SDL3 framework for macOS,
5+
# or in the CMake directory of a SDL3 framework for iOS / tvOS / visionOS.
56

6-
cmake_minimum_required(VERSION 3.12)
7+
cmake_minimum_required(VERSION 3.12...4.0)
78

8-
if(NOT EXISTS "${CMAKE_CURRENT_LIST_DIR}/../../Headers/SDL_version.h")
9-
message(AUTHOR_WARNING "Could not find SDL_version.h. This script is meant to be placed in the Resources/CMake directory of SDL2.framework")
9+
# Find SDL_version.h
10+
set(_sdl_version_h_path "")
11+
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/../../Headers/SDL_version.h")
12+
set(_sdl_version_h_path "${CMAKE_CURRENT_LIST_DIR}/../../Headers/SDL_version.h")
13+
elseif(EXISTS "${CMAKE_CURRENT_LIST_DIR}/../Headers/SDL_version.h")
14+
set(_sdl_version_h_path "${CMAKE_CURRENT_LIST_DIR}/../Headers/SDL_version.h")
15+
endif()
16+
17+
if(NOT _sdl_version_h_path)
18+
message(AUTHOR_WARNING "Could not find SDL_version.h. This script is meant to be placed in the Resources/CMake directory or the CMake directory of SDL3.framework.")
19+
set(PACKAGE_VERSION_UNSUITABLE TRUE)
1020
return()
1121
endif()
1222

13-
file(READ "${CMAKE_CURRENT_LIST_DIR}/../../Headers/SDL_version.h" _sdl_version_h)
23+
file(READ "${_sdl_version_h_path}" _sdl_version_h)
1424
string(REGEX MATCH "#define[ \t]+SDL_MAJOR_VERSION[ \t]+([0-9]+)" _sdl_major_re "${_sdl_version_h}")
1525
set(_sdl_major "${CMAKE_MATCH_1}")
1626
string(REGEX MATCH "#define[ \t]+SDL_MINOR_VERSION[ \t]+([0-9]+)" _sdl_minor_re "${_sdl_version_h}")
@@ -21,9 +31,12 @@ if(_sdl_major_re AND _sdl_minor_re AND _sdl_micro_re)
2131
set(PACKAGE_VERSION "${_sdl_major}.${_sdl_minor}.${_sdl_micro}")
2232
else()
2333
message(AUTHOR_WARNING "Could not extract version from SDL_version.h.")
34+
set(PACKAGE_VERSION_UNSUITABLE TRUE)
2435
return()
2536
endif()
2637

38+
unset(_sdl_version_h)
39+
unset(_sdl_version_h_path)
2740
unset(_sdl_major_re)
2841
unset(_sdl_major)
2942
unset(_sdl_minor_re)

libs/SDL3.xcframework/ios-arm64/SDL3.framework/Headers/SDL.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
*/
2121

2222
/**
23-
* Main include header for the SDL library, version 3.2.16
23+
* Main include header for the SDL library, version 3.2.28
2424
*
2525
* It is almost always best to include just this one header instead of
2626
* picking out individual headers included here. There are exceptions to

libs/SDL3.xcframework/ios-arm64/SDL3.framework/Headers/SDL_assert.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ extern "C" {
126126
*/
127127
#define SDL_TriggerBreakpoint() TriggerABreakpointInAPlatformSpecificManner
128128

129-
#elif defined(_MSC_VER) && _MSC_VER >= 1310
129+
#elif defined(__MINGW32__) || (defined(_MSC_VER) && _MSC_VER >= 1310)
130130
/* Don't include intrin.h here because it contains C++ code */
131131
extern void __cdecl __debugbreak(void);
132132
#define SDL_TriggerBreakpoint() __debugbreak()
@@ -362,7 +362,7 @@ extern SDL_DECLSPEC SDL_AssertState SDLCALL SDL_ReportAssertion(SDL_AssertData *
362362
#define SDL_enabled_assert(condition) \
363363
do { \
364364
while ( !(condition) ) { \
365-
static struct SDL_AssertData sdl_assert_data = { 0, 0, #condition, 0, 0, 0, 0 }; \
365+
static struct SDL_AssertData sdl_assert_data = { false, 0, #condition, NULL, 0, NULL, NULL }; \
366366
const SDL_AssertState sdl_assert_state = SDL_ReportAssertion(&sdl_assert_data, SDL_FUNCTION, SDL_FILE, SDL_LINE); \
367367
if (sdl_assert_state == SDL_ASSERTION_RETRY) { \
368368
continue; /* go again. */ \

libs/SDL3.xcframework/ios-arm64/SDL3.framework/Headers/SDL_audio.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -942,7 +942,10 @@ extern SDL_DECLSPEC void SDLCALL SDL_CloseAudioDevice(SDL_AudioDeviceID devid);
942942
* Binding a stream to a device will set its output format for playback
943943
* devices, and its input format for recording devices, so they match the
944944
* device's settings. The caller is welcome to change the other end of the
945-
* stream's format at any time with SDL_SetAudioStreamFormat().
945+
* stream's format at any time with SDL_SetAudioStreamFormat(). If the other
946+
* end of the stream's format has never been set (the audio stream was created
947+
* with a NULL audio spec), this function will set it to match the device
948+
* end's format.
946949
*
947950
* \param devid an audio device to bind a stream to.
948951
* \param streams an array of audio streams to bind.
@@ -1021,7 +1024,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_UnbindAudioStream(SDL_AudioStream *stream);
10211024
/**
10221025
* Query an audio stream for its currently-bound device.
10231026
*
1024-
* This reports the audio device that an audio stream is currently bound to.
1027+
* This reports the logical audio device that an audio stream is currently bound to.
10251028
*
10261029
* If not bound, or invalid, this returns zero, which is not a valid device
10271030
* ID.

libs/SDL3.xcframework/ios-arm64/SDL3.framework/Headers/SDL_camera.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ typedef struct SDL_CameraSpec
119119
int width; /**< Frame width */
120120
int height; /**< Frame height */
121121
int framerate_numerator; /**< Frame rate numerator ((num / denom) == FPS, (denom / num) == duration in seconds) */
122-
int framerate_denominator; /**< Frame rate demoninator ((num / denom) == FPS, (denom / num) == duration in seconds) */
122+
int framerate_denominator; /**< Frame rate denominator ((num / denom) == FPS, (denom / num) == duration in seconds) */
123123
} SDL_CameraSpec;
124124

125125
/**

0 commit comments

Comments
 (0)