Skip to content

Commit

Permalink
Get sample rate 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 da1aaa0 commit e65f710
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions ASIOHost/ASIOHost.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
<ClInclude Include="..\ASIOSDK2.3.1\common\asiosys.h" />
<ClInclude Include="..\ASIOSDK2.3.1\common\iasiodrv.h" />
<ClInclude Include="..\ASIOSDK2.3.1\host\asiodrivers.h" />
<ClInclude Include="..\ASIOSDK2.3.1\host\ginclude.h" />
<ClInclude Include="..\ASIOSDK2.3.1\host\pc\asiolist.h" />
</ItemGroup>
<PropertyGroup Label="Globals">
Expand Down
14 changes: 14 additions & 0 deletions FlexASIOTest/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include <optional>
#include <string_view>

#include "..\ASIOSDK2.3.1\host\ginclude.h"
#include "..\ASIOSDK2.3.1\common\asio.h"
#include "..\FlexASIO\flexasio.h"

Expand Down Expand Up @@ -70,6 +71,15 @@ namespace flexasio_test {
return bufferSize;
}

std::optional<ASIOSampleRate> GetSampleRate() {
std::cout << "ASIOGetSampleRate()" << std::endl;
ASIOSampleRate sampleRate = NAN;
const auto error = PrintError(ASIOGetSampleRate(&sampleRate));
if (error != ASE_OK) return std::nullopt;
std::cout << "Sample rate: " << sampleRate << std::endl;
return sampleRate;
}

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

Expand All @@ -83,6 +93,10 @@ namespace flexasio_test {
const auto bufferSize = GetBufferSize();
if (!bufferSize.has_value()) return false;

std::cout << std::endl;

GetSampleRate();

// 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 e65f710

Please sign in to comment.