Remove SDL_Mixer in favor of core SDL audio device
This commit is contained in:
@@ -1,19 +1,7 @@
|
|||||||
# SDL2, SDL2_image and SDL2_mixer
|
# SDL2, SDL2_image
|
||||||
if (UNIX)
|
if (UNIX)
|
||||||
add_subdirectory(src/lib/SDL)
|
add_subdirectory(src/lib/SDL)
|
||||||
else()
|
else()
|
||||||
find_package(SDL2)
|
find_package(SDL2)
|
||||||
endif()
|
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)
|
find_package(SDL2_image)
|
||||||
@@ -15,7 +15,6 @@ target_include_directories(
|
|||||||
yaze PUBLIC
|
yaze PUBLIC
|
||||||
lib/
|
lib/
|
||||||
app/
|
app/
|
||||||
lib/SDL_mixer/include/
|
|
||||||
${CMAKE_SOURCE_DIR}/src/
|
${CMAKE_SOURCE_DIR}/src/
|
||||||
${PNG_INCLUDE_DIRS}
|
${PNG_INCLUDE_DIRS}
|
||||||
${SDL2_INCLUDE_DIR}
|
${SDL2_INCLUDE_DIR}
|
||||||
@@ -27,7 +26,6 @@ target_link_libraries(
|
|||||||
${SDL_TARGETS}
|
${SDL_TARGETS}
|
||||||
${PNG_LIBRARIES}
|
${PNG_LIBRARIES}
|
||||||
${CMAKE_DL_LIBS}
|
${CMAKE_DL_LIBS}
|
||||||
SDL2_mixer
|
|
||||||
ImGui
|
ImGui
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
#include "controller.h"
|
#include "controller.h"
|
||||||
|
|
||||||
#include <SDL.h>
|
#include <SDL.h>
|
||||||
#include <SDL_mixer.h>
|
|
||||||
#include <imgui/backends/imgui_impl_sdl2.h>
|
#include <imgui/backends/imgui_impl_sdl2.h>
|
||||||
#include <imgui/backends/imgui_impl_sdlrenderer2.h>
|
#include <imgui/backends/imgui_impl_sdlrenderer2.h>
|
||||||
#include <imgui/imgui.h>
|
#include <imgui/imgui.h>
|
||||||
@@ -188,7 +187,6 @@ void Controller::DoRender() const {
|
|||||||
|
|
||||||
void Controller::OnExit() {
|
void Controller::OnExit() {
|
||||||
master_editor_.Shutdown();
|
master_editor_.Shutdown();
|
||||||
Mix_CloseAudio();
|
|
||||||
SDL_PauseAudioDevice(audio_device_, 1);
|
SDL_PauseAudioDevice(audio_device_, 1);
|
||||||
SDL_CloseAudioDevice(audio_device_);
|
SDL_CloseAudioDevice(audio_device_);
|
||||||
delete audio_buffer_;
|
delete audio_buffer_;
|
||||||
@@ -220,11 +218,6 @@ absl::Status Controller::CreateSDL_Window() {
|
|||||||
return absl::InternalError(
|
return absl::InternalError(
|
||||||
absl::StrFormat("SDL_CreateWindow: %s\n", SDL_GetError()));
|
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();
|
return absl::OkStatus();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
#include "music_editor.h"
|
#include "music_editor.h"
|
||||||
|
|
||||||
#include <SDL_mixer.h>
|
|
||||||
#include <imgui/imgui.h>
|
#include <imgui/imgui.h>
|
||||||
|
|
||||||
#include "absl/strings/str_format.h"
|
#include "absl/strings/str_format.h"
|
||||||
@@ -264,7 +263,6 @@ void MusicEditor::DrawToolset() {
|
|||||||
ImGui::TableNextColumn();
|
ImGui::TableNextColumn();
|
||||||
if (ImGui::Button(is_playing ? ICON_MD_STOP : ICON_MD_PLAY_ARROW)) {
|
if (ImGui::Button(is_playing ? ICON_MD_STOP : ICON_MD_PLAY_ARROW)) {
|
||||||
if (is_playing) {
|
if (is_playing) {
|
||||||
Mix_HaltMusic();
|
|
||||||
has_loaded_song = false;
|
has_loaded_song = false;
|
||||||
}
|
}
|
||||||
is_playing = !is_playing;
|
is_playing = !is_playing;
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
#ifndef YAZE_APP_EDITOR_MUSIC_EDITOR_H
|
#ifndef YAZE_APP_EDITOR_MUSIC_EDITOR_H
|
||||||
#define YAZE_APP_EDITOR_MUSIC_EDITOR_H
|
#define YAZE_APP_EDITOR_MUSIC_EDITOR_H
|
||||||
|
|
||||||
#include <SDL_mixer.h>
|
|
||||||
#include <imgui/imgui.h>
|
#include <imgui/imgui.h>
|
||||||
|
|
||||||
#include "absl/strings/str_format.h"
|
#include "absl/strings/str_format.h"
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ target_include_directories(
|
|||||||
z3ed PUBLIC
|
z3ed PUBLIC
|
||||||
lib/
|
lib/
|
||||||
app/
|
app/
|
||||||
lib/SDL_mixer/include/
|
|
||||||
${CMAKE_SOURCE_DIR}/src/
|
${CMAKE_SOURCE_DIR}/src/
|
||||||
${PNG_INCLUDE_DIRS}
|
${PNG_INCLUDE_DIRS}
|
||||||
${SDL2_INCLUDE_DIR}
|
${SDL2_INCLUDE_DIR}
|
||||||
@@ -34,6 +33,5 @@ target_link_libraries(
|
|||||||
${GLEW_LIBRARIES}
|
${GLEW_LIBRARIES}
|
||||||
${OPENGL_LIBRARIES}
|
${OPENGL_LIBRARIES}
|
||||||
${CMAKE_DL_LIBS}
|
${CMAKE_DL_LIBS}
|
||||||
SDL2_mixer
|
|
||||||
ImGui
|
ImGui
|
||||||
)
|
)
|
||||||
Reference in New Issue
Block a user