From 5442ffac4610edf8cd599001245821d6d5ca057c Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sun, 18 Sep 2022 10:15:16 +0300 Subject: [PATCH] add sndfile test [skip build] --- test/sndfile.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 test/sndfile.cpp diff --git a/test/sndfile.cpp b/test/sndfile.cpp new file mode 100644 index 00000000..f3b248ff --- /dev/null +++ b/test/sndfile.cpp @@ -0,0 +1,20 @@ +#include +#include + +int main() +{ + constexpr int CHANNELS = 1; + constexpr int SAMPLE_RATE = 44100; + constexpr int SAMPLE_COUNT = SAMPLE_RATE; + constexpr int BUFFER_SIZE = SAMPLE_RATE; + + const std::vector buffer(BUFFER_SIZE, 0); + SF_INFO info = { SAMPLE_COUNT, SAMPLE_RATE, CHANNELS, SF_FORMAT_WAV | SF_FORMAT_PCM_24, 0, 0 }; + SNDFILE* file = sf_open("test.wav", SFM_WRITE, &info); + + AEDI_EXPECT(file != nullptr); + AEDI_EXPECT(sf_write_int(file, &buffer[0], BUFFER_SIZE) == BUFFER_SIZE); + AEDI_EXPECT(sf_close(file) == 0); + + return 0; +}