2 Copyright (C) 2008 Hans Baier
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 #include "pbd/signals.h"
24 #include "ardour/types.h"
25 #include "ardour/session_handle.h"
40 class Ticker : public SessionHandlePtr
47 const framepos_t& transport_frames,
48 const BBT_Time& transport_bbt,
49 const Timecode::Time& transport_timecode) = 0;
51 void set_session (Session* s);
54 class MidiClockTicker : public Ticker
58 MidiClockTicker() : _midi_port(0), _ppqn(24), _last_tick(0.0) {};
59 MidiClockTicker( const MidiClockTicker& );
60 MidiClockTicker& operator= (const MidiClockTicker&);
63 virtual ~MidiClockTicker() {};
65 static MidiClockTicker& instance() {
66 static MidiClockTicker _instance;
71 const framepos_t& transport_frames,
72 const BBT_Time& transport_bbt,
73 const Timecode::Time& transport_timecode);
75 void set_session (Session* s);
76 void session_going_away();
78 /// slot for the signal session::MIDIClock_PortChanged
79 void update_midi_clock_port();
81 /// slot for the signal session::TransportStateChange
82 void transport_state_changed();
84 /// slot for the signal session::PositionChanged
85 void position_changed (framepos_t position);
87 /// slot for the signal session::TransportLooped
88 void transport_looped();
90 /// pulses per quarter note (default 24)
91 void set_ppqn(int ppqn) { _ppqn = ppqn; }
94 MIDI::Port* _midi_port;
98 double one_ppqn_in_frames (framepos_t transport_position);
100 void send_midi_clock_event (pframes_t offset);
101 void send_start_event (pframes_t offset);
102 void send_continue_event (pframes_t offset);
103 void send_stop_event (pframes_t offset);
108 #endif /* TICKER_H_ */