yuzu-emu
/
yuzu
Archived
1
0
Fork 0

Various suggestions by v1993 and lioncash

This commit is contained in:
Clément Gallet 2021-06-07 12:51:59 +02:00
parent df8a2e3ad8
commit f611506dca
2 changed files with 9 additions and 11 deletions

View File

@ -37,10 +37,11 @@ public:
spec.callback = nullptr; spec.callback = nullptr;
SDL_AudioSpec obtained; SDL_AudioSpec obtained;
if (output_device.empty()) if (output_device.empty()) {
dev = SDL_OpenAudioDevice(nullptr, 0, &spec, &obtained, 0); dev = SDL_OpenAudioDevice(nullptr, 0, &spec, &obtained, 0);
else } else {
dev = SDL_OpenAudioDevice(output_device.c_str(), 0, &spec, &obtained, 0); dev = SDL_OpenAudioDevice(output_device.c_str(), 0, &spec, &obtained, 0);
}
if (dev == 0) { if (dev == 0) {
LOG_CRITICAL(Audio_Sink, "Error opening sdl audio device: {}", SDL_GetError()); LOG_CRITICAL(Audio_Sink, "Error opening sdl audio device: {}", SDL_GetError());
@ -55,7 +56,6 @@ public:
return; return;
} }
SDL_PauseAudioDevice(dev, 1);
SDL_CloseAudioDevice(dev); SDL_CloseAudioDevice(dev);
} }
@ -134,11 +134,7 @@ SDLSink::SDLSink(std::string_view target_device_name) {
} }
} }
SDLSink::~SDLSink() { SDLSink::~SDLSink() = default;
for (auto& sink_stream : sink_streams) {
sink_stream.reset();
}
}
SinkStream& SDLSink::AcquireSinkStream(u32 sample_rate, u32 num_channels, const std::string&) { SinkStream& SDLSink::AcquireSinkStream(u32 sample_rate, u32 num_channels, const std::string&) {
sink_streams.push_back( sink_streams.push_back(
@ -152,11 +148,11 @@ std::vector<std::string> ListSDLSinkDevices() {
if (!SDL_WasInit(SDL_INIT_AUDIO)) { if (!SDL_WasInit(SDL_INIT_AUDIO)) {
if (SDL_InitSubSystem(SDL_INIT_AUDIO) < 0) { if (SDL_InitSubSystem(SDL_INIT_AUDIO) < 0) {
LOG_CRITICAL(Audio_Sink, "SDL_InitSubSystem audio failed: {}", SDL_GetError()); 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) { for (int i = 0; i < device_count; ++i) {
device_list.emplace_back(SDL_GetAudioDeviceName(i, 0)); device_list.emplace_back(SDL_GetAudioDeviceName(i, 0));
} }

View File

@ -236,8 +236,10 @@ swap_screen =
[Audio] [Audio]
# Which audio output engine to use. # 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) # sdl2: SDL2 audio engine (if available)
# null: No audio output
output_engine = output_engine =
# Whether or not to enable the audio-stretching post-processing effect. # Whether or not to enable the audio-stretching post-processing effect.