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.
21 #include <boost/noncopyable.hpp>
22 #include <boost/scoped_ptr.hpp>
24 #include "pbd/signals.h"
26 #include "ardour/types.h"
27 #include "ardour/session_handle.h"
30 #ifndef __libardour_ticker_h__
31 #define __libardour_ticker_h__
38 class MidiClockTicker : public SessionHandlePtr, boost::noncopyable
42 virtual ~MidiClockTicker();
44 void tick (const framepos_t& transport_frames, pframes_t nframes);
46 bool has_midi_port() const { return _midi_port != 0; }
48 void set_session (Session* s);
49 void session_going_away();
51 /// slot for the signal session::MIDIClock_PortChanged
52 void update_midi_clock_port();
54 /// slot for the signal session::TransportStateChange
55 void transport_state_changed();
57 /// slot for the signal session::TransportLooped
58 void transport_looped();
60 /// slot for the signal session::Located
61 void session_located();
63 /// pulses per quarter note (default 24)
64 void set_ppqn(int ppqn) { _ppqn = ppqn; }
67 boost::shared_ptr<MidiPort> _midi_port;
74 boost::scoped_ptr<Position> _pos;
76 double one_ppqn_in_frames (framepos_t transport_position);
78 void send_midi_clock_event (pframes_t offset, pframes_t nframes);
79 void send_start_event (pframes_t offset, pframes_t nframes);
80 void send_continue_event (pframes_t offset, pframes_t nframes);
81 void send_stop_event (pframes_t offset, pframes_t nframes);
82 void send_position_event (uint32_t midi_clocks, pframes_t offset, pframes_t nframes);
87 #endif /* __libardour_ticker_h__ */