Skip to content

Commit

Permalink
Add an option to open the ASIO Control Panel.
Browse files Browse the repository at this point in the history
  • Loading branch information
dechamps committed Oct 16, 2021
1 parent db41648 commit 5e8c576
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ namespace ASIOTest {
// Run enough buffer switches such that we can trigger failure modes like https://github.com/dechamps/FlexASIO/issues/29.
static constexpr size_t defaultBufferSwitchCount = 30;

bool openControlPanel = false;
std::optional<long> bufferSizeFrames;
std::optional<size_t> bufferSwitchCount;
double bufferSwitchDelayMs = 0;
Expand All @@ -80,6 +81,7 @@ namespace ASIOTest {
std::optional<std::string> outputChannels;
std::string logMode = "async";
options.add_options()
("open-control-panel", "Open the ASIO Control Panel, then exit", cxxopts::value(config.openControlPanel))
("buffer-size-frames", "ASIO buffer size to use, in frames; default is to use the preferred size suggested by the driver", cxxopts::value(config.bufferSizeFrames))
("buffer-switch-count", "Stop after this many ASIO buffers have been switched; default is to stop when reaching the end of the input file, if any; otherwise, " + std::to_string(config.defaultBufferSwitchCount), cxxopts::value(config.bufferSwitchCount))
("buffer-switch-delay-ms", "Sleep for this many milliseconds before processing a buffer switch callback; default is " + std::to_string(config.bufferSwitchDelayMs), cxxopts::value(config.bufferSwitchDelayMs))
Expand Down Expand Up @@ -404,6 +406,11 @@ namespace ASIOTest {
return asioDriverInfo;
}

bool ControlPanel() {
Log() << "ASIOControlPanel()";
return PrintError(ASIOControlPanel()) != ASE_OK;
}

struct ChannelCounts {
long input;
long output;
Expand Down Expand Up @@ -592,6 +599,10 @@ namespace ASIOTest {

Log();

if (config.openControlPanel) {
return ControlPanel();
}

const auto availableChannelCounts = GetChannels();
const auto inputChannels = PopulateChannels(config.inputChannels, availableChannelCounts.input, "Input");
const auto outputChannels = PopulateChannels(config.outputChannels, availableChannelCounts.output, "Output");
Expand Down

0 comments on commit 5e8c576

Please sign in to comment.