mirror of
https://github.com/Lime3DS/Lime3DS
synced 2024-12-27 17:42:40 -06:00
sink: Make auto device name a constant
This commit is contained in:
parent
d269beab0d
commit
7d642b25e9
4 changed files with 5 additions and 3 deletions
|
@ -44,7 +44,7 @@ CubebSink::CubebSink(std::string target_device_name) : impl(std::make_unique<Imp
|
||||||
if (cubeb_get_min_latency(impl->ctx, ¶ms, &minimum_latency) != CUBEB_OK)
|
if (cubeb_get_min_latency(impl->ctx, ¶ms, &minimum_latency) != CUBEB_OK)
|
||||||
LOG_CRITICAL(Audio_Sink, "Error getting minimum latency");
|
LOG_CRITICAL(Audio_Sink, "Error getting minimum latency");
|
||||||
|
|
||||||
if (target_device_name != "auto" && !target_device_name.empty()) {
|
if (target_device_name != auto_device_name && !target_device_name.empty()) {
|
||||||
cubeb_device_collection collection;
|
cubeb_device_collection collection;
|
||||||
if (cubeb_enumerate_devices(impl->ctx, CUBEB_DEVICE_TYPE_OUTPUT, &collection) != CUBEB_OK) {
|
if (cubeb_enumerate_devices(impl->ctx, CUBEB_DEVICE_TYPE_OUTPUT, &collection) != CUBEB_OK) {
|
||||||
LOG_WARNING(Audio_Sink, "Audio output device enumeration not supported");
|
LOG_WARNING(Audio_Sink, "Audio output device enumeration not supported");
|
||||||
|
|
|
@ -42,7 +42,7 @@ SDL2Sink::SDL2Sink(std::string device_name) : impl(std::make_unique<Impl>()) {
|
||||||
SDL_zero(obtained_audiospec);
|
SDL_zero(obtained_audiospec);
|
||||||
|
|
||||||
const char* device = nullptr;
|
const char* device = nullptr;
|
||||||
if (device_name != "auto" && !device_name.empty()) {
|
if (device_name != auto_device_name && !device_name.empty()) {
|
||||||
device = device_name.c_str();
|
device = device_name.c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
|
|
||||||
namespace AudioCore {
|
namespace AudioCore {
|
||||||
|
|
||||||
|
constexpr char auto_device_name[] = "auto";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class is an interface for an audio sink. An audio sink accepts samples in stereo signed
|
* This class is an interface for an audio sink. An audio sink accepts samples in stereo signed
|
||||||
* PCM16 format to be output. Sinks *do not* handle resampling and expect the correct sample rate.
|
* PCM16 format to be output. Sinks *do not* handle resampling and expect the correct sample rate.
|
||||||
|
|
|
@ -66,7 +66,7 @@ void ConfigureAudio::applyConfiguration() {
|
||||||
|
|
||||||
void ConfigureAudio::updateAudioDevices(int sink_index) {
|
void ConfigureAudio::updateAudioDevices(int sink_index) {
|
||||||
ui->audio_device_combo_box->clear();
|
ui->audio_device_combo_box->clear();
|
||||||
ui->audio_device_combo_box->addItem("auto");
|
ui->audio_device_combo_box->addItem(AudioCore::auto_device_name);
|
||||||
|
|
||||||
std::string sink_id = ui->output_sink_combo_box->itemText(sink_index).toStdString();
|
std::string sink_id = ui->output_sink_combo_box->itemText(sink_index).toStdString();
|
||||||
std::vector<std::string> device_list = AudioCore::GetSinkDetails(sink_id).list_devices();
|
std::vector<std::string> device_list = AudioCore::GetSinkDetails(sink_id).list_devices();
|
||||||
|
|
Loading…
Reference in a new issue