1
0
Fork 0

sink: Make auto device name a constant

This commit is contained in:
MerryMage 2018-07-12 15:52:06 +01:00
parent d269beab0d
commit 7d642b25e9
4 changed files with 5 additions and 3 deletions

View File

@ -44,7 +44,7 @@ CubebSink::CubebSink(std::string target_device_name) : impl(std::make_unique<Imp
if (cubeb_get_min_latency(impl->ctx, &params, &minimum_latency) != CUBEB_OK)
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;
if (cubeb_enumerate_devices(impl->ctx, CUBEB_DEVICE_TYPE_OUTPUT, &collection) != CUBEB_OK) {
LOG_WARNING(Audio_Sink, "Audio output device enumeration not supported");

View File

@ -42,7 +42,7 @@ SDL2Sink::SDL2Sink(std::string device_name) : impl(std::make_unique<Impl>()) {
SDL_zero(obtained_audiospec);
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();
}

View File

@ -9,6 +9,8 @@
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
* PCM16 format to be output. Sinks *do not* handle resampling and expect the correct sample rate.

View File

@ -66,7 +66,7 @@ void ConfigureAudio::applyConfiguration() {
void ConfigureAudio::updateAudioDevices(int sink_index) {
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::vector<std::string> device_list = AudioCore::GetSinkDetails(sink_id).list_devices();