Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SDL3 Support #1478

Merged
merged 34 commits into from
Feb 8, 2025
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
63f66ec
SDL3 Support
andyvand Jan 26, 2025
369286d
Merge pull request #1 from FluidSynth/master
andyvand Jan 27, 2025
a4ccc92
Update sources
andyvand Jan 27, 2025
7c796c4
Merge branch 'master' of https://github.com/andyvand/fluidsynth
andyvand Jan 27, 2025
11c5781
Fix callback
andyvand Jan 28, 2025
c74e2ea
Remove .DS_Store
andyvand Feb 1, 2025
801c118
Fix init SDL3 subsystem
andyvand Feb 1, 2025
fc7dc1d
Fix SDL3 linking
andyvand Feb 1, 2025
1ec0dfe
Fix for finding SDL3 config and components
andyvand Feb 1, 2025
99e7d2e
Remove SDL3_VERSION not defined check
andyvand Feb 1, 2025
76a1875
Update CMakeLists.txt
andyvand Feb 1, 2025
f7b09ee
Remove GetSDL3VersionFromHeaders
andyvand Feb 1, 2025
05da5c8
Fix init subsystem
andyvand Feb 1, 2025
95a62a9
Fix return
andyvand Feb 1, 2025
4bb8d97
Remove version check
andyvand Feb 2, 2025
93d604f
Remove version check
andyvand Feb 2, 2025
433369a
Fix to work with buffer
andyvand Feb 2, 2025
070458e
Set SDL3 standard on
andyvand Feb 2, 2025
6249be8
Add SDL3 to unit tests
andyvand Feb 2, 2025
46839ba
Revert
andyvand Feb 2, 2025
f7dbf46
Fix SDL3 no malloc
andyvand Feb 7, 2025
9214a91
Fix target link libraries
andyvand Feb 7, 2025
65c1879
Fix
andyvand Feb 7, 2025
d7b54c4
Merge pull request #2 from FluidSynth/master
andyvand Feb 7, 2025
c21e4bd
Fix dependencies
andyvand Feb 7, 2025
5c13cc9
Fix buffer and SDL_min
andyvand Feb 7, 2025
aeb573e
Fix CMake
andyvand Feb 7, 2025
e8ed2eb
Move SDL3
andyvand Feb 7, 2025
ea6228e
Fix SDL3 playback
andyvand Feb 7, 2025
ac3ac8a
Update buffer
andyvand Feb 8, 2025
bc33fa4
Fix SDL buffer length
andyvand Feb 8, 2025
09b5f64
Fix MinGW compile
andyvand Feb 8, 2025
0981634
Revert to malloc for buffer
andyvand Feb 8, 2025
5a42534
Buffer check
andyvand Feb 8, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
derselbst marked this conversation as resolved.
Show resolved Hide resolved
Binary file not shown.
21 changes: 21 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ option ( enable-wasapi "compile Windows WASAPI support (if it is available)" on
option ( enable-waveout "compile Windows WaveOut support (if it is available)" on )
option ( enable-winmidi "compile Windows MIDI support (if it is available)" on )
option ( enable-sdl2 "compile SDL2 audio support (if it is available)" off )
option ( enable-sdl3 "compile SDL3 audio support (if it is available)" off )
derselbst marked this conversation as resolved.
Show resolved Hide resolved
option ( enable-pulseaudio "compile PulseAudio support (if it is available)" on )
option ( enable-pipewire "compile PipeWire support (if it is available)" on )
option ( enable-readline "compile readline lib line editing (if it is available)" on )
Expand Down Expand Up @@ -683,6 +684,26 @@ if ( enable-sdl2 )
endif ( SDL2_FOUND )
endif ( enable-sdl2 )

unset ( SDL3_SUPPORT CACHE )
if ( enable-sdl3 )
find_package ( SDL3 QUIET )
derselbst marked this conversation as resolved.
Show resolved Hide resolved
if ( SDL3_FOUND )
if ( NOT DEFINED SDL3_VERSION )
derselbst marked this conversation as resolved.
Show resolved Hide resolved
include ( GetSDL3VersionFromHeaders )
get_sdl3_version_from_headers("${SDL2_INCLUDE_DIRS}" SDL3_VERSION)
endif ( NOT DEFINED SDL3_VERSION )
if ( SDL3_VERSION VERSION_LESS "3.2.0" )
message ( STATUS "Found SDL3 version ${SDL3_VERSION}, but the minimum required is 3.2.0" )
else ( SDL3_VERSION VERSION_LESS "3.2.0" )
message ( STATUS "Found SDL3: ${SDL3_LIBRARIES} (version: ${SDL3_VERSION})" )
set ( SDL3_SUPPORT TRUE )
list ( APPEND PC_REQUIRES_PRIV "sdl3")
endif ( SDL2_VERSION VERSION_LESS "3.2.0" )
else ( SDL3_FOUND )
message ( STATUS "Could NOT find SDL3 (Set SDL3_DIR to the directory containing its CMake config)" )
endif ( SDL3_FOUND )
endif ( enable-sdl3 )

unset ( OBOE_SUPPORT CACHE )
if ( enable-oboe )
find_package ( oboe )
Expand Down
21 changes: 21 additions & 0 deletions cmake_admin/GetSDL3VersionFromHeaders.cmake
derselbst marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Get the version of SDL2 through headers
# This is needed for autotools builds before 2.0.12
function(get_sdl3_version_from_headers INCLUDE_DIR OUT_VAR)
file(READ "${INCLUDE_DIR}/SDL_version.h" SDL_VERSION_H)
string(REGEX MATCH "#define[ \t]+SDL_MAJOR_VERSION[ \t]+([0-9]+)"
SDL3_MAJOR_RE "${SDL_VERSION_H}")
set(SDL3_MAJOR "${CMAKE_MATCH_1}")
string(REGEX MATCH "#define[ \t]+SDL_MINOR_VERSION[ \t]+([0-9]+)"
SDL3_MINOR_RE "${SDL_VERSION_H}")
set(SDL3_MINOR "${CMAKE_MATCH_1}")
string(REGEX MATCH "#define[ \t]+SDL_PATCHLEVEL[ \t]+([0-9]+)" SDL3_PATCH_RE
"${SDL_VERSION_H}")
set(SDL3_PATCH "${CMAKE_MATCH_1}")
if(SDL3_MAJOR_RE
AND SDL3_MINOR_RE
AND SDL3_PATCH_RE)
set(${OUT_VAR}
"${SDL3_MAJOR}.${SDL3_MINOR}.${SDL3_PATCH}"
PARENT_SCOPE)
endif()
endfunction()
6 changes: 6 additions & 0 deletions cmake_admin/report.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,12 @@ else ( SDL2_SUPPORT )
set ( AUDIO_MIDI_REPORT "${AUDIO_MIDI_REPORT} SDL2: no\n" )
endif ( SDL2_SUPPORT )

if ( SDL3_SUPPORT )
set ( AUDIO_MIDI_REPORT "${AUDIO_MIDI_REPORT} SDL3: yes\n" )
else ( SDL3_SUPPORT )
set ( AUDIO_MIDI_REPORT "${AUDIO_MIDI_REPORT} SDL3: no\n" )
endif ( SDL3_SUPPORT )

if ( WASAPI_SUPPORT )
set ( AUDIO_MIDI_REPORT "${AUDIO_MIDI_REPORT} WASAPI: yes\n" )
else ( WASAPI_SUPPORT )
Expand Down
Binary file added src/.DS_Store
derselbst marked this conversation as resolved.
Show resolved Hide resolved
Binary file not shown.
5 changes: 5 additions & 0 deletions src/CMakeLists.txt
derselbst marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ if ( SDL2_SUPPORT )
set ( fluid_sdl2_SOURCES drivers/fluid_sdl2.c )
endif ( SDL2_SUPPORT )

if ( SDL3_SUPPORT )
set ( fluid_sdl3_SOURCES drivers/fluid_sdl3.c )
endif ( SDL3_SUPPORT )

if ( OSS_SUPPORT )
set ( fluid_oss_SOURCES drivers/fluid_oss.c )
endif ( OSS_SUPPORT )
Expand Down Expand Up @@ -240,6 +244,7 @@ add_library ( libfluidsynth-OBJ OBJECT
${fluid_waveout_SOURCES}
${fluid_winmidi_SOURCES}
${fluid_sdl2_SOURCES}
${fluid_sdl3_SOURCES}
${fluid_libinstpatch_SOURCES}
${libfluidsynth_SOURCES}
${public_HEADERS}
Expand Down
3 changes: 3 additions & 0 deletions src/config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,9 @@
/* Define to enable SDL2 audio driver */
#cmakedefine SDL2_SUPPORT @SDL2_SUPPORT@

/* Define to enable SDL3 audio driver */
#cmakedefine SDL3_SUPPORT @SDL3_SUPPORT@

/* Define to 1 if you have the ANSI C header files. */
#cmakedefine STDC_HEADERS @STDC_HEADERS@

Expand Down
10 changes: 10 additions & 0 deletions src/drivers/fluid_adriver.c
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,16 @@ static const fluid_audriver_definition_t fluid_audio_drivers[] =
},
#endif

#if SDL3_SUPPORT
{
"sdl3",
new_fluid_sdl3_audio_driver,
NULL,
delete_fluid_sdl3_audio_driver,
fluid_sdl3_audio_driver_settings
},
#endif

#if SDL2_SUPPORT
{
"sdl2",
Expand Down
7 changes: 7 additions & 0 deletions src/drivers/fluid_adriver.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,13 @@ void delete_fluid_sdl2_audio_driver(fluid_audio_driver_t *p);
void fluid_sdl2_audio_driver_settings(fluid_settings_t *settings);
#endif

#if SDL3_SUPPORT
fluid_audio_driver_t *new_fluid_sdl3_audio_driver(fluid_settings_t *settings,
fluid_synth_t *synth);
void delete_fluid_sdl3_audio_driver(fluid_audio_driver_t *p);
void fluid_sdl3_audio_driver_settings(fluid_settings_t *settings);
#endif

#if AUFILE_SUPPORT
fluid_audio_driver_t *new_fluid_file_audio_driver(fluid_settings_t *settings,
fluid_synth_t *synth);
Expand Down
Loading
Loading