From 528d8fd9a64d1e39850161f3acfa6361a98da7e2 Mon Sep 17 00:00:00 2001 From: scawful Date: Tue, 23 Apr 2024 11:27:03 -0400 Subject: [PATCH] Remove SDL_Mixer in favor of core SDL audio device --- cmake/sdl2.cmake | 14 +------------- src/app/CMakeLists.txt | 2 -- src/app/core/controller.cc | 7 ------- src/app/editor/modules/music_editor.cc | 2 -- src/app/editor/modules/music_editor.h | 1 - src/cli/CMakeLists.txt | 2 -- 6 files changed, 1 insertion(+), 27 deletions(-) diff --git a/cmake/sdl2.cmake b/cmake/sdl2.cmake index 3b2299e2..2e9fa7bc 100644 --- a/cmake/sdl2.cmake +++ b/cmake/sdl2.cmake @@ -1,19 +1,7 @@ -# SDL2, SDL2_image and SDL2_mixer +# SDL2, SDL2_image if (UNIX) add_subdirectory(src/lib/SDL) else() find_package(SDL2) endif() -set(SDL2MIXER_OPUS OFF) -set(SDL2MIXER_FLAC OFF) -set(SDL2MIXER_MOD OFF) -set(SDL2MIXER_MIDI_FLUIDSYNTH OFF) -find_library(SDL_MIXER_LIBRARY - NAMES SDL_mixer - HINTS - ENV SDLMIXERDIR - ENV SDLDIR - PATH_SUFFIXES lib ${VC_LIB_PATH_SUFFIX} - ) -add_subdirectory(src/lib/SDL_mixer) find_package(SDL2_image) \ No newline at end of file diff --git a/src/app/CMakeLists.txt b/src/app/CMakeLists.txt index 4e9dd430..15446a6a 100644 --- a/src/app/CMakeLists.txt +++ b/src/app/CMakeLists.txt @@ -15,7 +15,6 @@ target_include_directories( yaze PUBLIC lib/ app/ - lib/SDL_mixer/include/ ${CMAKE_SOURCE_DIR}/src/ ${PNG_INCLUDE_DIRS} ${SDL2_INCLUDE_DIR} @@ -27,7 +26,6 @@ target_link_libraries( ${SDL_TARGETS} ${PNG_LIBRARIES} ${CMAKE_DL_LIBS} - SDL2_mixer ImGui ) diff --git a/src/app/core/controller.cc b/src/app/core/controller.cc index ad68f868..7b159357 100644 --- a/src/app/core/controller.cc +++ b/src/app/core/controller.cc @@ -1,7 +1,6 @@ #include "controller.h" #include -#include #include #include #include @@ -188,7 +187,6 @@ void Controller::DoRender() const { void Controller::OnExit() { master_editor_.Shutdown(); - Mix_CloseAudio(); SDL_PauseAudioDevice(audio_device_, 1); SDL_CloseAudioDevice(audio_device_); delete audio_buffer_; @@ -220,11 +218,6 @@ absl::Status Controller::CreateSDL_Window() { return absl::InternalError( absl::StrFormat("SDL_CreateWindow: %s\n", SDL_GetError())); } - // Initialize SDL_mixer - if (Mix_OpenAudio(32000, MIX_DEFAULT_FORMAT, 2, 1024) < 0) { - printf("SDL_mixer could not initialize! SDL_mixer Error: %s\n", - Mix_GetError()); - } } return absl::OkStatus(); } diff --git a/src/app/editor/modules/music_editor.cc b/src/app/editor/modules/music_editor.cc index e29f2c7f..754eec5d 100644 --- a/src/app/editor/modules/music_editor.cc +++ b/src/app/editor/modules/music_editor.cc @@ -1,6 +1,5 @@ #include "music_editor.h" -#include #include #include "absl/strings/str_format.h" @@ -264,7 +263,6 @@ void MusicEditor::DrawToolset() { ImGui::TableNextColumn(); if (ImGui::Button(is_playing ? ICON_MD_STOP : ICON_MD_PLAY_ARROW)) { if (is_playing) { - Mix_HaltMusic(); has_loaded_song = false; } is_playing = !is_playing; diff --git a/src/app/editor/modules/music_editor.h b/src/app/editor/modules/music_editor.h index 579d9089..849a584f 100644 --- a/src/app/editor/modules/music_editor.h +++ b/src/app/editor/modules/music_editor.h @@ -1,7 +1,6 @@ #ifndef YAZE_APP_EDITOR_MUSIC_EDITOR_H #define YAZE_APP_EDITOR_MUSIC_EDITOR_H -#include #include #include "absl/strings/str_format.h" diff --git a/src/cli/CMakeLists.txt b/src/cli/CMakeLists.txt index e47a43b5..404bc855 100644 --- a/src/cli/CMakeLists.txt +++ b/src/cli/CMakeLists.txt @@ -19,7 +19,6 @@ target_include_directories( z3ed PUBLIC lib/ app/ - lib/SDL_mixer/include/ ${CMAKE_SOURCE_DIR}/src/ ${PNG_INCLUDE_DIRS} ${SDL2_INCLUDE_DIR} @@ -34,6 +33,5 @@ target_link_libraries( ${GLEW_LIBRARIES} ${OPENGL_LIBRARIES} ${CMAKE_DL_LIBS} - SDL2_mixer ImGui ) \ No newline at end of file