class library: Reset has been renamed to OnError
[supercollider.git] / testsuite / supernova / audio_backend_test.cpp
blob57e341edf598af7168afbc288174b855ec6731aa
1 #define BOOST_TEST_MAIN
2 #include <boost/test/included/unit_test.hpp>
3 #include <boost/thread.hpp>
5 #define protected public
7 #include "audio_backend/audio_backend.hpp"
8 #include "audio_backend/portaudio.hpp"
10 using namespace nova;
12 namespace
14 void tick(void)
18 template <typename backend>
19 void test_backend(void)
21 backend be;
23 BOOST_REQUIRE(!be.audiostream_ready());
25 device_list devs = be.list_devices();
26 be.open_audio_stream(devs[0], devs[0].inchannels, devs[0], devs[0].outchannels, devs[0].defaultSampleRate);
28 BOOST_REQUIRE(be.audiostream_ready());
30 BOOST_REQUIRE(!be.is_active());
31 be.activate();
32 BOOST_REQUIRE(be.is_active());
34 boost::xtime xt;
35 boost::xtime_get(&xt, boost::TIME_UTC);
36 xt.sec += 1;
38 boost::thread::sleep(xt);
41 be.deactivate();
42 BOOST_REQUIRE(!be.is_active());
43 be.close_audio_stream();
44 BOOST_REQUIRE(!be.audiostream_ready());
47 BOOST_AUTO_TEST_CASE( dummy_test_1 )
49 test_backend<dummy_backend<&tick> >();
52 BOOST_AUTO_TEST_CASE( pa_test_1 )
54 test_backend<portaudio_backend<&tick> >();