1 #include <boost/test/unit_test.hpp>
2 
3 #include <iostream>
4 
5 #include <boost/filesystem.hpp>
6 
7 #include "sc/sc_ugen_factory.hpp"
8 #include "server/memory_pool.hpp"
9 #include "server/server_args.hpp"
10 
11 using namespace nova;
12 using namespace std;
13 
14 boost::filesystem::path base_path("/home/tim/workspace/nova-server/debug_plugins/");
15 
BOOST_AUTO_TEST_CASE(ugen_factory_test_1)16 BOOST_AUTO_TEST_CASE(ugen_factory_test_1) {
17     server_arguments::initialize(0, 0);
18     rt_pool.init(1024 * 1024);
19     sc_factory.initialize();
20 
21     sc_factory.load_plugin(base_path / "BinaryOpUGens.so");
22     sc_factory.load_plugin(base_path / "ChaosUGens.so");
23     sc_factory.load_plugin(base_path / "DelayUGens.so");
24     sc_factory.load_plugin(base_path / "DemandUGens.so");
25     sc_factory.load_plugin(base_path / "DiskIO_UGens.so");
26     sc_factory.load_plugin(base_path / "DynNoiseUGens.so");
27     sc_factory.load_plugin(base_path / "FFT_UGens.so");
28     sc_factory.load_plugin(base_path / "FilterUGens.so");
29     sc_factory.load_plugin(base_path / "GendynUGens.so");
30     sc_factory.load_plugin(base_path / "GrainUGens.so");
31     sc_factory.load_plugin(base_path / "IOUGens.so");
32     sc_factory.load_plugin(base_path / "KeyboardUGens.so");
33     sc_factory.load_plugin(base_path / "LFUGens.so");
34     sc_factory.load_plugin(base_path / "ML_UGens.so");
35     sc_factory.load_plugin(base_path / "MouseUGens.so");
36     sc_factory.load_plugin(base_path / "MulAddUGens.so");
37     sc_factory.load_plugin(base_path / "NoiseUGens.so");
38     sc_factory.load_plugin(base_path / "OscUGens.so");
39     sc_factory.load_plugin(base_path / "PanUGens.so");
40     sc_factory.load_plugin(base_path / "PhysicalModelingUGens.so");
41     sc_factory.load_plugin(base_path / "PV_ThirdParty.so");
42     sc_factory.load_plugin(base_path / "ReverbUGens.so");
43     sc_factory.load_plugin(base_path / "TestUGens.so");
44     sc_factory.load_plugin(base_path / "TriggerUGens.so");
45     sc_factory.load_plugin(base_path / "UnaryOpUGens.so");
46     sc_factory.load_plugin(base_path / "UnpackFFTUGens.so");
47 
48     rt_pool.init(1024 * 1024 * 16, true);
49 }
50 
51 
52 const char* test_synthdefs[] = {
53     "default.scsyndef",       "help-In.scsyndef",         "help_out.scsyndef",
54     "help_out2.scsyndef",     "help_InFeedback.scsyndef", "help_LocalIn.scsyndef",
55     "help_PlayBuf.scsyndef",  "help_RecordBuf.scsyndef",  "help_RecordBuf_overdub.scsyndef",
56     "help_LocalBuf.scsyndef", "help_Demand.scsyndef",
57 };
58 
59 
60 #if 0 /* doesn't work anymore because of increased sanity checks */
61 BOOST_AUTO_TEST_CASE( ugen_construct_test_1 )
62 {
63     for (int i = 0; i != sizeof(test_synthdefs)/sizeof(const char*); ++i) {
64         const char * synthdef = test_synthdefs[i];
65 
66         try {
67             std::vector<nova::sc_synthdef> defs =
68                 nova::read_synthdef_file(base_path / ".." / "testsuite" / synthdef);
69             sc_synth_prototype_ptr prtype(new sc_synth_prototype(defs[0]));
70 
71             sc_synth * s = new sc_synth(1000, prtype);
72 
73             dsp_context context(44100, 64, 0);
74             for (int i = 0; i != 1000; ++i)
75                 s->run(context);
76             delete s;
77         }
78         catch(std::runtime_error const & e)
79         {
80             std::cerr << e.what() << std::endl;
81         }
82     }
83 }
84 #endif
85