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 <sigc++/sigc++.h>
23 #include "ardour/types.h"
24 #include "midi++/jack.h"
34 class Ticker : public sigc::trackable
37 Ticker() : _session(0) {};
41 const nframes_t& transport_frames,
42 const BBT_Time& transport_bbt,
43 const SMPTE::Time& transport_smpte) = 0;
45 virtual void set_session(Session& s);
46 virtual void going_away() { _session = 0; delete this; }
52 class MidiClockTicker : public Ticker
55 MidiClockTicker() : _jack_port(0), _ppqn(24), _last_tick(0.0) {};
56 virtual ~MidiClockTicker() {};
59 const nframes_t& transport_frames,
60 const BBT_Time& transport_bbt,
61 const SMPTE::Time& transport_smpte);
63 void set_session(Session& s);
64 void going_away() { Ticker::going_away(); _jack_port = 0;}
66 /// slot for the signal session::MIDIClock_PortChanged
67 void update_midi_clock_port();
69 /// slot for the signal session::TransportStateChange
70 void transport_state_changed();
72 /// slot for the signal session::PositionChanged
73 void position_changed(nframes_t position);
75 /// slot for the signal session::TransportLooped
76 void transport_looped();
78 /// pulses per quarter note (default 24)
79 void set_ppqn(int ppqn) { _ppqn = ppqn; }
82 MIDI::JACK_MidiPort* _jack_port;
86 void send_midi_clock_event(nframes_t offset);
87 void send_start_event(nframes_t offset);
88 void send_continue_event(nframes_t offset);
89 void send_stop_event(nframes_t offset);
94 #endif /* TICKER_H_ */