Update the audio reader benchmark
This commit is contained in:
parent
c6090d44fc
commit
ae48eda57e
1 changed files with 5 additions and 9 deletions
|
|
@ -146,16 +146,12 @@ static void doReaderBenchmark(const fs::path& path, std::vector<float> &buffer,
|
||||||
|
|
||||||
static void doEntireRead(const fs::path& path)
|
static void doEntireRead(const fs::path& path)
|
||||||
{
|
{
|
||||||
#if !defined(_WIN32)
|
sfz::AudioReaderPtr reader = sfz::createAudioReader(path, false);
|
||||||
SndfileHandle handle(path.c_str());
|
if (!reader)
|
||||||
#else
|
return;
|
||||||
SndfileHandle handle(path.wstring().c_str());
|
|
||||||
#endif
|
|
||||||
if (handle.error())
|
|
||||||
throw std::runtime_error("cannot open sound file for reading");
|
|
||||||
|
|
||||||
std::vector<float> buffer(static_cast<size_t>(2 * handle.frames()));
|
std::vector<float> buffer(static_cast<size_t>(2 * reader->frames()));
|
||||||
handle.read(buffer.data(), buffer.size());
|
reader->readNextBlock(buffer.data(), buffer.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
BENCHMARK_DEFINE_F(AudioReaderFixture, EntireWav)(benchmark::State& state)
|
BENCHMARK_DEFINE_F(AudioReaderFixture, EntireWav)(benchmark::State& state)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue