2 * Copyright(C) 2000-2008 Paul Davis
5 * Evoral is free software; you can redistribute it and/or modify it under the
6 * terms of the GNU General Public License as published by the Free Software
7 * Foundation; either version 2 of the License, or(at your option) any later
10 * Evoral is distributed in the hope that it will be useful, but WITHOUT ANY
11 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 #include <cppunit/TestFixture.h>
22 #include <cppunit/extensions/HelperMacros.h>
24 #include "ardour/tempo.h"
25 #include "ardour/slave.h"
29 class TestSlaveSessionProxy : public ISlaveSessionProxy {
30 #define FRAME_RATE 44100
31 nframes64_t _period_size;
33 double transport_speed;
34 nframes64_t _transport_frame;
35 nframes64_t _frame_time;
43 TestSlaveSessionProxy() :
44 transport_speed (1.0),
46 _frame_time (1000000),
47 _tempo_map (FRAME_RATE),
51 _tempo_map.add_tempo (tempo, zero);
52 _tempo_map.add_meter (meter, zero);
55 // Controlling the mock object
56 void set_period_size (nframes64_t a_size) { _period_size = a_size; }
58 _transport_frame += _period_size;
59 _frame_time += _period_size;
63 TempoMap& tempo_map () { return _tempo_map; }
64 nframes_t frame_rate () const { return FRAME_RATE; }
65 nframes64_t audible_frame () const { return _transport_frame; }
66 nframes64_t transport_frame () const { return _transport_frame; }
67 nframes_t frames_since_cycle_start () const { return 0; }
68 nframes64_t frame_time () const { return _frame_time; }
70 void request_locate (nframes64_t frame, bool with_roll = false) {
71 _transport_frame = frame;
74 void request_transport_speed (const double speed) { transport_speed = speed; }
77 class MIDIClock_SlaveTest : public CppUnit::TestFixture, ARDOUR::MIDIClock_Slave
79 CPPUNIT_TEST_SUITE(MIDIClock_SlaveTest);
80 CPPUNIT_TEST(testStepResponse);
81 CPPUNIT_TEST_SUITE_END();
86 session = new TestSlaveSessionProxy ();
92 void testStepResponse();