summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/audio_core/sdl2_sink.cpp16
-rw-r--r--src/yuzu_cmd/default_ini.h4
2 files changed, 9 insertions, 11 deletions
diff --git a/src/audio_core/sdl2_sink.cpp b/src/audio_core/sdl2_sink.cpp
index 75c6202ef..62d3716a6 100644
--- a/src/audio_core/sdl2_sink.cpp
+++ b/src/audio_core/sdl2_sink.cpp
@@ -37,10 +37,11 @@ public:
37 spec.callback = nullptr; 37 spec.callback = nullptr;
38 38
39 SDL_AudioSpec obtained; 39 SDL_AudioSpec obtained;
40 if (output_device.empty()) 40 if (output_device.empty()) {
41 dev = SDL_OpenAudioDevice(nullptr, 0, &spec, &obtained, 0); 41 dev = SDL_OpenAudioDevice(nullptr, 0, &spec, &obtained, 0);
42 else 42 } else {
43 dev = SDL_OpenAudioDevice(output_device.c_str(), 0, &spec, &obtained, 0); 43 dev = SDL_OpenAudioDevice(output_device.c_str(), 0, &spec, &obtained, 0);
44 }
44 45
45 if (dev == 0) { 46 if (dev == 0) {
46 LOG_CRITICAL(Audio_Sink, "Error opening sdl audio device: {}", SDL_GetError()); 47 LOG_CRITICAL(Audio_Sink, "Error opening sdl audio device: {}", SDL_GetError());
@@ -55,7 +56,6 @@ public:
55 return; 56 return;
56 } 57 }
57 58
58 SDL_PauseAudioDevice(dev, 1);
59 SDL_CloseAudioDevice(dev); 59 SDL_CloseAudioDevice(dev);
60 } 60 }
61 61
@@ -134,11 +134,7 @@ SDLSink::SDLSink(std::string_view target_device_name) {
134 } 134 }
135} 135}
136 136
137SDLSink::~SDLSink() { 137SDLSink::~SDLSink() = default;
138 for (auto& sink_stream : sink_streams) {
139 sink_stream.reset();
140 }
141}
142 138
143SinkStream& SDLSink::AcquireSinkStream(u32 sample_rate, u32 num_channels, const std::string&) { 139SinkStream& SDLSink::AcquireSinkStream(u32 sample_rate, u32 num_channels, const std::string&) {
144 sink_streams.push_back( 140 sink_streams.push_back(
@@ -152,11 +148,11 @@ std::vector<std::string> ListSDLSinkDevices() {
152 if (!SDL_WasInit(SDL_INIT_AUDIO)) { 148 if (!SDL_WasInit(SDL_INIT_AUDIO)) {
153 if (SDL_InitSubSystem(SDL_INIT_AUDIO) < 0) { 149 if (SDL_InitSubSystem(SDL_INIT_AUDIO) < 0) {
154 LOG_CRITICAL(Audio_Sink, "SDL_InitSubSystem audio failed: {}", SDL_GetError()); 150 LOG_CRITICAL(Audio_Sink, "SDL_InitSubSystem audio failed: {}", SDL_GetError());
155 return std::vector<std::string>(); 151 return {};
156 } 152 }
157 } 153 }
158 154
159 int device_count = SDL_GetNumAudioDevices(0); 155 const int device_count = SDL_GetNumAudioDevices(0);
160 for (int i = 0; i < device_count; ++i) { 156 for (int i = 0; i < device_count; ++i) {
161 device_list.emplace_back(SDL_GetAudioDeviceName(i, 0)); 157 device_list.emplace_back(SDL_GetAudioDeviceName(i, 0));
162 } 158 }
diff --git a/src/yuzu_cmd/default_ini.h b/src/yuzu_cmd/default_ini.h
index 095078c79..6b673b935 100644
--- a/src/yuzu_cmd/default_ini.h
+++ b/src/yuzu_cmd/default_ini.h
@@ -236,8 +236,10 @@ swap_screen =
236 236
237[Audio] 237[Audio]
238# Which audio output engine to use. 238# Which audio output engine to use.
239# auto (default): Auto-select, null: No audio output, cubeb: Cubeb audio engine (if available), 239# auto (default): Auto-select
240# cubeb: Cubeb audio engine (if available)
240# sdl2: SDL2 audio engine (if available) 241# sdl2: SDL2 audio engine (if available)
242# null: No audio output
241output_engine = 243output_engine =
242 244
243# Whether or not to enable the audio-stretching post-processing effect. 245# Whether or not to enable the audio-stretching post-processing effect.