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/libardour_visibility.h"
27 #include "ardour/types.h"
28 #include "ardour/session_handle.h"
31 #ifndef __libardour_ticker_h__
32 #define __libardour_ticker_h__
39 class LIBARDOUR_API MidiClockTicker : public SessionHandlePtr, boost::noncopyable
43 virtual ~MidiClockTicker();
45 void tick (const samplepos_t& transport_samples, pframes_t nframes);
47 bool has_midi_port() const { return _midi_port != 0; }
49 void set_session (Session* s);
50 void session_going_away();
52 /// slot for the signal session::MIDIClock_PortChanged
53 void update_midi_clock_port();
55 /// slot for the signal session::TransportStateChange
56 void transport_state_changed();
58 /// slot for the signal session::TransportLooped
59 void transport_looped();
61 /// slot for the signal session::Located
62 void session_located();
64 /// pulses per quarter note (default 24)
65 void set_ppqn(int ppqn) { _ppqn = ppqn; }
68 boost::shared_ptr<MidiPort> _midi_port;
75 boost::scoped_ptr<Position> _pos;
77 double one_ppqn_in_samples (samplepos_t transport_position);
79 void send_midi_clock_event (pframes_t offset, pframes_t nframes);
80 void send_start_event (pframes_t offset, pframes_t nframes);
81 void send_continue_event (pframes_t offset, pframes_t nframes);
82 void send_stop_event (pframes_t offset, pframes_t nframes);
83 void send_position_event (uint32_t midi_clocks, pframes_t offset, pframes_t nframes);
88 #endif /* __libardour_ticker_h__ */