class library: Reset has been renamed to OnError
[supercollider.git] / testsuite / supernova / sndfile_backend_test.cpp
bloba5e073d309597878f0eee8a5e300e48b5b36e3ea
1 #include <boost/test/unit_test.hpp>
2 #include <boost/thread.hpp>
4 #include "audio_backend/sndfile_backend.hpp"
6 using namespace nova;
8 namespace
11 aligned_storage_ptr<float> data(nova::calloc_aligned<float>(64));
13 struct engine_functor;
15 struct engine_functor
17 void init_tick(void)
20 void run_tick(void);
23 sndfile_backend<engine_functor> be;
25 void engine_functor::run_tick(void)
27 float * data_ptr = data.get();
28 be.output_mapping(&data_ptr, &data_ptr + 1);
33 BOOST_AUTO_TEST_CASE( sndfile_backend_test_1 )
35 BOOST_REQUIRE(!be.audio_is_opened());
36 BOOST_REQUIRE(!be.audio_is_active());
38 be.open_client("", "./output.wav", 44100, SF_FORMAT_WAV | SF_FORMAT_PCM_16, 1);
39 BOOST_REQUIRE(be.audio_is_opened());
41 be.activate_audio();
42 BOOST_REQUIRE(be.audio_is_active());
45 boost::xtime xt;
46 boost::xtime_get(&xt, boost::TIME_UTC);
47 xt.sec += 1;
48 boost::thread::sleep(xt);
50 be.deactivate_audio();
51 BOOST_REQUIRE(!be.audio_is_active());
53 be.close_client();
54 BOOST_REQUIRE(!be.audio_is_opened());