Ardour  8.12
ticker.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2008-2009 Hans Baier <hansfbaier@googlemail.com>
3  * Copyright (C) 2009-2010 David Robillard <d@drobilla.net>
4  * Copyright (C) 2009-2017 Paul Davis <paul@linuxaudiosystems.com>
5  * Copyright (C) 2010 Carl Hetherington <carl@carlh.net>
6  * Copyright (C) 2013 Michael Fisher <mfisher31@gmail.com>
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program; if not, write to the Free Software Foundation, Inc.,
20  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21  */
22 
23 #include <boost/noncopyable.hpp>
24 #include <boost/scoped_ptr.hpp>
25 
26 #include "pbd/signals.h"
27 
29 #include "ardour/session_handle.h"
30 #include "ardour/types.h"
31 
32 #ifndef __libardour_ticker_h__
33 #define __libardour_ticker_h__
34 
35 namespace ARDOUR
36 {
37 class Session;
38 class MidiPort;
39 
40 class LIBARDOUR_API MidiClockTicker : boost::noncopyable
41 {
42 public:
44  virtual ~MidiClockTicker ();
45 
47 
48 private:
50  std::shared_ptr<MidiPort> _midi_port;
51  bool _rolling;
53  uint32_t _beat_pos;
54  uint32_t _clock_cnt;
58 
59  void reset ();
60  void resync_latency (bool);
61  double one_ppqn_in_samples (samplepos_t transport_position) const;
62 
63  void send_midi_clock_event (pframes_t offset, pframes_t nframes);
64  void send_start_event (pframes_t offset, pframes_t nframes);
65  void send_continue_event (pframes_t offset, pframes_t nframes);
66  void send_stop_event (pframes_t offset, pframes_t nframes);
67  void send_position_event (uint32_t midi_clocks, pframes_t offset, pframes_t nframes);
68 };
69 
70 } // namespace ARDOUR
71 
72 #endif /* __libardour_ticker_h__ */
samplepos_t _transport_pos
Definition: ticker.h:55
double one_ppqn_in_samples(samplepos_t transport_position) const
std::shared_ptr< MidiPort > _midi_port
Definition: ticker.h:50
void send_position_event(uint32_t midi_clocks, pframes_t offset, pframes_t nframes)
void tick(samplepos_t, samplepos_t, pframes_t, samplecnt_t)
void send_midi_clock_event(pframes_t offset, pframes_t nframes)
void send_stop_event(pframes_t offset, pframes_t nframes)
void send_continue_event(pframes_t offset, pframes_t nframes)
LatencyRange _mclk_out_latency
Definition: ticker.h:56
void send_start_event(pframes_t offset, pframes_t nframes)
samplepos_t _next_tick
Definition: ticker.h:52
uint32_t _clock_cnt
Definition: ticker.h:54
uint32_t _beat_pos
Definition: ticker.h:53
PBD::ScopedConnection _latency_connection
Definition: ticker.h:57
ARDOUR::Session & _session
Definition: ticker.h:49
#define LIBARDOUR_API
uint32_t pframes_t
Temporal::samplecnt_t samplecnt_t
Temporal::samplepos_t samplepos_t