summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClément Gallet <clement.gallet@ens-lyon.org>2021-06-07 12:51:59 +0200
committerClément Gallet <clement.gallet@ens-lyon.org>2021-06-07 12:51:59 +0200
commitf611506dca7004cd86086f0e22acd5a55f0ca25c (patch)
treef221163aab9b817e512d39d09b50058c64befddf
parentAdd sdl2 audio description in the yuzu-cmd config file (diff)
downloadyuzu-f611506dca7004cd86086f0e22acd5a55f0ca25c.tar
yuzu-f611506dca7004cd86086f0e22acd5a55f0ca25c.tar.gz
yuzu-f611506dca7004cd86086f0e22acd5a55f0ca25c.tar.bz2
yuzu-f611506dca7004cd86086f0e22acd5a55f0ca25c.tar.lz
yuzu-f611506dca7004cd86086f0e22acd5a55f0ca25c.tar.xz
yuzu-f611506dca7004cd86086f0e22acd5a55f0ca25c.tar.zst
yuzu-f611506dca7004cd86086f0e22acd5a55f0ca25c.zip
-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:
spec.callback = nullptr;
SDL_AudioSpec obtained;
- if (output_device.empty())
+ if (output_device.empty()) {
dev = SDL_OpenAudioDevice(nullptr, 0, &spec, &obtained, 0);
- else
+ } else {
dev = SDL_OpenAudioDevice(output_device.c_str(), 0, &spec, &obtained, 0);
+ }
if (dev == 0) {
LOG_CRITICAL(Audio_Sink, "Error opening sdl audio device: {}", SDL_GetError());
@@ -55,7 +56,6 @@ public:
return;
}
- SDL_PauseAudioDevice(dev, 1);
SDL_CloseAudioDevice(dev);
}
@@ -134,11 +134,7 @@ SDLSink::SDLSink(std::string_view target_device_name) {
}
}
-SDLSink::~SDLSink() {
- for (auto& sink_stream : sink_streams) {
- sink_stream.reset();
- }
-}
+SDLSink::~SDLSink() = default;
SinkStream& SDLSink::AcquireSinkStream(u32 sample_rate, u32 num_channels, const std::string&) {
sink_streams.push_back(
@@ -152,11 +148,11 @@ std::vector<std::string> ListSDLSinkDevices() {
if (!SDL_WasInit(SDL_INIT_AUDIO)) {
if (SDL_InitSubSystem(SDL_INIT_AUDIO) < 0) {
LOG_CRITICAL(Audio_Sink, "SDL_InitSubSystem audio failed: {}", SDL_GetError());
- return std::vector<std::string>();
+ return {};
}
}
- int device_count = SDL_GetNumAudioDevices(0);
+ const int device_count = SDL_GetNumAudioDevices(0);
for (int i = 0; i < device_count; ++i) {
device_list.emplace_back(SDL_GetAudioDeviceName(i, 0));
}
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 =
[Audio]
# Which audio output engine to use.
-# auto (default): Auto-select, null: No audio output, cubeb: Cubeb audio engine (if available),
+# auto (default): Auto-select
+# cubeb: Cubeb audio engine (if available)
# sdl2: SDL2 audio engine (if available)
+# null: No audio output
output_engine =
# Whether or not to enable the audio-stretching post-processing effect.