ardour
midi_clock_slave_test.cc
Go to the documentation of this file.
1 #include <sigc++/sigc++.h>
3 
4 using namespace std;
5 using namespace ARDOUR;
6 
8 
9 void
10 MIDIClock_SlaveTest::testStepResponse ()
11 {
12  double speed = 1.0;
13  framepos_t position = 0;
14 
15  MIDI::Parser* parser = 0;
16 
17  TestSlaveSessionProxy *sess = (TestSlaveSessionProxy *) session;
18  framecnt_t period_size = 4096;
19  sess->set_period_size (period_size);
20 
21  bandwidth = 1.0 / 60.0;
22 
23  framepos_t start_time = 1000000;
24  start (*parser, start_time);
25 
26  update_midi_clock (*parser, start_time);
27 
28  for (framecnt_t i = 1; i<= 100 * period_size; i++) {
29  // simulate jitter
30  framecnt_t input_delta = framecnt_t (one_ppqn_in_frames + 0.1 * (double(g_random_int()) / double (RAND_MAX)) * one_ppqn_in_frames);
31 
32  if (i % input_delta == 0) {
33  update_midi_clock (*parser, start_time + i);
34  }
35 
36  if (i % period_size == 0) {
37  sess->next_period ();
38  speed_and_position (speed, position);
39  sess->request_transport_speed (speed);
40  }
41  }
42 
43 }
44 
45 
Definition: Beats.hpp:239
void request_transport_speed(const double speed)
LIBARDOUR_API PBD::PropertyDescriptor< framepos_t > start
Definition: region.cc:63
CPPUNIT_TEST_SUITE_REGISTRATION(MIDIClock_SlaveTest)
void set_period_size(framecnt_t a_size)
int64_t framecnt_t
Definition: types.h:76
Definition: amp.h:29
int64_t framepos_t
Definition: types.h:66
LIBARDOUR_API PBD::PropertyDescriptor< framepos_t > position
Definition: region.cc:65