summaryrefslogtreecommitdiffstats
path: root/src/audio_core
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 /src/audio_core
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
Diffstat (limited to 'src/audio_core')
-rw-r--r--src/audio_core/sdl2_sink.cpp16
1 files changed, 6 insertions, 10 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));
}