summaryrefslogtreecommitdiff
path: root/libs/ardour
diff options
context:
space:
mode:
authorHans Baier <hansfbaier@googlemail.com>2010-01-29 05:18:22 +0000
committerHans Baier <hansfbaier@googlemail.com>2010-01-29 05:18:22 +0000
commitfc4c3211735bc4c52aa3ab4d065c501e8de6e910 (patch)
tree3c03ff5b8d4fa781c0571c9db127a5c866b65a9f /libs/ardour
parent8ee52628fc18ebf86a6bac6d7176faf98b73ed3d (diff)
MIDIClock_SlaveTest: first working testcase
git-svn-id: svn://localhost/ardour2/branches/3.0@6589 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour')
-rw-r--r--libs/ardour/test/midi_clock_slave_test.cpp26
-rw-r--r--libs/ardour/test/midi_clock_slave_test.h17
2 files changed, 34 insertions, 9 deletions
diff --git a/libs/ardour/test/midi_clock_slave_test.cpp b/libs/ardour/test/midi_clock_slave_test.cpp
index 260b60d3b3..1fc0ef7dc1 100644
--- a/libs/ardour/test/midi_clock_slave_test.cpp
+++ b/libs/ardour/test/midi_clock_slave_test.cpp
@@ -9,9 +9,33 @@ CPPUNIT_TEST_SUITE_REGISTRATION( MIDIClock_SlaveTest );
void
MIDIClock_SlaveTest::testStepResponse ()
{
+ double speed = 1.0;
+ nframes64_t position = 0;
+ MIDI::Parser* parser = 0;
+
+ TestSlaveSessionProxy *sess = (TestSlaveSessionProxy *) session;
+ nframes64_t period_size = 1024;
+ sess->set_period_size (period_size);
+
+
+ nframes64_t start_time = 1000000;
+ start (*parser, start_time);
+
+ update_midi_clock (*parser, start_time);
+
+ for (nframes64_t i = 1; i<= 100 * period_size; i++) {
+ if (i % nframes64_t(one_ppqn_in_frames) == 0) {
+ update_midi_clock (*parser, start_time + i);
+ }
+
+ if (i % period_size == 0) {
+ sess->next_period ();
+ speed_and_position (speed, position);
+ sess->request_transport_speed (speed);
+ }
+ }
- //CPPUNIT_ASSERT_EQUAL ((uint32_t)(NUM_SAMPLES * linear.speed()), result);
}
diff --git a/libs/ardour/test/midi_clock_slave_test.h b/libs/ardour/test/midi_clock_slave_test.h
index ebc2c67345..0340594218 100644
--- a/libs/ardour/test/midi_clock_slave_test.h
+++ b/libs/ardour/test/midi_clock_slave_test.h
@@ -33,34 +33,35 @@ class TestSlaveSessionProxy : public ISlaveSessionProxy {
double transport_speed;
nframes64_t _transport_frame;
nframes64_t _frame_time;
- TempoMap _tempo_map;
+ TempoMap *_tempo_map;
Tempo tempo;
Meter meter;
- BBT_Time zero;
public:
TestSlaveSessionProxy() :
transport_speed (1.0),
_transport_frame (0),
_frame_time (1000000),
- _tempo_map (FRAME_RATE),
+ _tempo_map (0),
tempo (120),
meter (4.0, 4.0)
{
- _tempo_map.add_tempo (tempo, zero);
- _tempo_map.add_meter (meter, zero);
+ _tempo_map = new TempoMap (FRAME_RATE);
+ _tempo_map->add_tempo (tempo, BBT_Time(1, 1, 0));
+ _tempo_map->add_meter (meter, BBT_Time(1, 1, 0));
}
// Controlling the mock object
- void set_period_size (nframes64_t a_size) { _period_size = a_size; }
+ void set_period_size (nframes64_t a_size) { _period_size = a_size; }
+ nframes64_t period_size () const { return _period_size; }
void next_period () {
- _transport_frame += _period_size;
+ _transport_frame += double(_period_size) * double(transport_speed);
_frame_time += _period_size;
}
// Implementation
- TempoMap& tempo_map () { return _tempo_map; }
+ TempoMap& tempo_map () const { return *_tempo_map; }
nframes_t frame_rate () const { return FRAME_RATE; }
nframes64_t audible_frame () const { return _transport_frame; }
nframes64_t transport_frame () const { return _transport_frame; }