ardour
ticker.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2008 Hans Baier
3 
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.
8 
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.
13 
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.
17 
18  $Id$
19 */
20 
21 #include <boost/noncopyable.hpp>
22 #include <boost/scoped_ptr.hpp>
23 
24 #include "pbd/signals.h"
25 
27 #include "ardour/types.h"
28 #include "ardour/session_handle.h"
29 
30 
31 #ifndef __libardour_ticker_h__
32 #define __libardour_ticker_h__
33 
34 namespace ARDOUR {
35 
36 class Session;
37 class MidiPort;
38 
39 class LIBARDOUR_API MidiClockTicker : public SessionHandlePtr, boost::noncopyable
40 {
41 public:
42  MidiClockTicker ();
43  virtual ~MidiClockTicker();
44 
45  void tick (const framepos_t& transport_frames, pframes_t nframes);
46 
47  bool has_midi_port() const { return _midi_port != 0; }
48 
49  void set_session (Session* s);
50  void session_going_away();
51 
53  void update_midi_clock_port();
54 
56  void transport_state_changed();
57 
59  void transport_looped();
60 
62  void session_located();
63 
65  void set_ppqn(int ppqn) { _ppqn = ppqn; }
66 
67  private:
69  int _ppqn;
70  double _last_tick;
71  bool _send_pos;
73 
74  class Position;
75  boost::scoped_ptr<Position> _pos;
76 
77  double one_ppqn_in_frames (framepos_t transport_position);
78 
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);
84 };
85 }
86  // namespace
87 
88 #endif /* __libardour_ticker_h__ */
boost::shared_ptr< MidiPort > _midi_port
Definition: ticker.h:68
bool has_midi_port() const
Definition: ticker.h:47
uint32_t pframes_t
Definition: types.h:61
void set_ppqn(int ppqn)
pulses per quarter note (default 24)
Definition: ticker.h:65
Definition: amp.h:29
int64_t framepos_t
Definition: types.h:66
#define LIBARDOUR_API
boost::scoped_ptr< Position > _pos
Definition: ticker.h:74