wasapi: added client option for selecting shared/exclusive mode

This commit is contained in:
Stijn Van der Borght 2020-04-03 22:55:01 +01:00 committed by Johannes Pohl
parent 95a369be79
commit 9737c1ac44
5 changed files with 70 additions and 28 deletions

View file

@ -115,6 +115,9 @@ int main(int argc, char** argv)
#ifdef HAS_SOXR
auto sample_format = op.add<Value<string>>("", "sampleformat", "resample audio stream to <rate>:<bits>:<channels>", "");
#endif
#ifdef HAS_WASAPI
auto wasapi_mode = op.add<Value<string>>("", "wasapimode", "WASAPI mode to use [shared/exclusive]", "shared");
#endif
try
{
@ -225,10 +228,6 @@ int main(int argc, char** argv)
}
#endif
#if defined(HAS_WASAPI)
settings.player.player_name = "wasapi";
#endif
#ifdef HAS_SOXR
if (sample_format->is_set())
{
@ -241,6 +240,15 @@ int main(int argc, char** argv)
}
#endif
#ifdef HAS_WASAPI
settings.player.player_name = "wasapi";
if (wasapi_mode->is_set())
{
settings.player.wasapi_mode = (strcmp(wasapi_mode->value().c_str(), "exclusive") == 0) ?
ClientSettings::WasapiMode::EXCLUSIVE : ClientSettings::WasapiMode::SHARED;
}
#endif
bool active = true;
std::shared_ptr<Controller> controller;
auto signal_handler = install_signal_handler({