Skip to content

Commit

Permalink
[settings] always use default microphone & speaker
Browse files Browse the repository at this point in the history
  • Loading branch information
ffiirree committed Jun 11, 2023
1 parent f7f49db commit 637dba6
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions src/common/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ Config::Config()
IF_NULL_SET(settings_["gif"]["framerate"], 6);
// clang-format on

// cameras
if ((settings_["devices"]["cameras"].is_null() ||
settings_["devices"]["cameras"].get<std::string>().empty()) &&
!av::cameras().empty()) {
Expand All @@ -86,20 +87,15 @@ Config::Config()
#endif
}

if (settings_["devices"]["microphones"].is_null()) {
auto asrc = av::default_audio_source();
if (asrc.has_value()) {
settings_["devices"]["microphones"] = asrc.value().id;
}
}
// microphones: default or null
auto asrc = av::default_audio_source();
settings_["devices"]["microphones"] = asrc.value_or(av::device_t{}).id;

if (settings_["devices"]["speakers"].is_null()) {
auto asink = av::default_audio_sink();
if (asink.has_value()) {
settings_["devices"]["speakers"] = asink.value().id;
}
}
// speakers: default or null
auto asink = av::default_audio_sink();
settings_["devices"]["speakers"] = asink.value_or(av::device_t{}).id;

//
connect(this, &Config::changed, this, &Config::save);
connect(this, &Config::SYSTEM_THEME_CHANGED, this, [this](int theme) {
if (settings_["theme"].get<std::string>() == "auto") {
Expand Down

0 comments on commit 637dba6

Please sign in to comment.