Skip to content

Commit

Permalink
Get buffer size in FlexASIOTest.
Browse files Browse the repository at this point in the history
See #7.
  • Loading branch information
dechamps committed Oct 21, 2018
1 parent 121666d commit da1aaa0
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions FlexASIOTest/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,22 @@ namespace flexasio_test {
return { numInputChannels, numOutputChannels };
}

struct BufferSize {
long min = LONG_MIN;
long max = LONG_MIN;
long preferred = LONG_MIN;
long granularity = LONG_MIN;
};

std::optional<BufferSize> GetBufferSize() {
std::cout << "ASIOGetBufferSize()" << std::endl;
BufferSize bufferSize;
const auto error = PrintError(ASIOGetBufferSize(&bufferSize.min, &bufferSize.max, &bufferSize.preferred, &bufferSize.granularity));
if (error != ASE_OK) return std::nullopt;
std::cout << "Buffer size: min " << bufferSize.min << " max " << bufferSize.max << " preferred " << bufferSize.preferred << " granularity " << bufferSize.granularity << std::endl;
return bufferSize;
}

bool Run() {
if (!Init()) return false;

Expand All @@ -62,6 +78,11 @@ namespace flexasio_test {
const auto channelCounts = GetChannels();
if (channelCounts.first == 0 && channelCounts.second == 0) return false;

std::cout << std::endl;

const auto bufferSize = GetBufferSize();
if (!bufferSize.has_value()) return false;

// Note: we don't call ASIOExit() because it gets confused by our driver setup trickery (see InitAndRun()).
// That said, this doesn't really matter because ASIOExit() is basically a no-op in our case, anyway.
return true;
Expand Down

0 comments on commit da1aaa0

Please sign in to comment.