Ardour  9.0-pre0-822-g12e3bc5c20
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 "pbd/signals.h"
24 
26 #include "ardour/session_handle.h"
27 #include "ardour/types.h"
28 
29 #pragma once
30 
31 namespace ARDOUR
32 {
33 class Session;
34 class MidiPort;
35 
37 {
38 public:
40  MidiClockTicker (const MidiClockTicker&) = delete;
41  MidiClockTicker& operator= (const MidiClockTicker&) = delete;
42  virtual ~MidiClockTicker ();
43 
45 
46 private:
48  std::shared_ptr<MidiPort> _midi_port;
49  bool _rolling;
50  double _next_tick;
51  uint32_t _beat_pos;
52  uint32_t _clock_cnt;
56 
57  void reset ();
58  void resync_latency (bool);
59  double one_ppqn_in_samples (samplepos_t transport_position) const;
60 
61  void send_midi_clock_event (pframes_t offset, pframes_t nframes);
62  void send_start_event (pframes_t offset, pframes_t nframes);
63  void send_continue_event (pframes_t offset, pframes_t nframes);
64  void send_stop_event (pframes_t offset, pframes_t nframes);
65  void send_position_event (uint32_t midi_clocks, pframes_t offset, pframes_t nframes);
66 };
67 
68 } // namespace ARDOUR
69 
samplepos_t _transport_pos
Definition: ticker.h:53
double one_ppqn_in_samples(samplepos_t transport_position) const
std::shared_ptr< MidiPort > _midi_port
Definition: ticker.h:48
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:54
void send_start_event(pframes_t offset, pframes_t nframes)
uint32_t _clock_cnt
Definition: ticker.h:52
uint32_t _beat_pos
Definition: ticker.h:51
MidiClockTicker(const MidiClockTicker &)=delete
PBD::ScopedConnection _latency_connection
Definition: ticker.h:55
ARDOUR::Session & _session
Definition: ticker.h:47
#define LIBARDOUR_API
uint32_t pframes_t
Temporal::samplecnt_t samplecnt_t
Temporal::samplepos_t samplepos_t