change MidiClockTicker to use Session& not Session*
This commit is contained in:
parent
33047987a7
commit
bcc1aeeb86
@ -40,13 +40,21 @@ class MidiPort;
|
||||
class LIBARDOUR_API MidiClockTicker : boost::noncopyable
|
||||
{
|
||||
public:
|
||||
MidiClockTicker (Session*);
|
||||
MidiClockTicker (Session&);
|
||||
virtual ~MidiClockTicker ();
|
||||
|
||||
void tick (samplepos_t, samplepos_t, pframes_t, samplecnt_t);
|
||||
|
||||
private:
|
||||
ARDOUR::Session& _session;
|
||||
std::shared_ptr<MidiPort> _midi_port;
|
||||
bool _rolling;
|
||||
samplepos_t _next_tick;
|
||||
uint32_t _beat_pos;
|
||||
uint32_t _clock_cnt;
|
||||
samplepos_t _transport_pos;
|
||||
LatencyRange _mclk_out_latency;
|
||||
PBD::ScopedConnection _latency_connection;
|
||||
|
||||
void reset ();
|
||||
void resync_latency (bool);
|
||||
@ -57,17 +65,6 @@ private:
|
||||
void send_continue_event (pframes_t offset, pframes_t nframes);
|
||||
void send_stop_event (pframes_t offset, pframes_t nframes);
|
||||
void send_position_event (uint32_t midi_clocks, pframes_t offset, pframes_t nframes);
|
||||
|
||||
bool _rolling;
|
||||
double _next_tick;
|
||||
uint32_t _beat_pos;
|
||||
uint32_t _clock_cnt;
|
||||
samplepos_t _transport_pos;
|
||||
|
||||
ARDOUR::Session* _session;
|
||||
|
||||
LatencyRange _mclk_out_latency;
|
||||
PBD::ScopedConnection _latency_connection;
|
||||
};
|
||||
|
||||
} // namespace ARDOUR
|
||||
|
@ -267,7 +267,7 @@ Session::post_engine_init ()
|
||||
/* MidiClock requires a tempo map */
|
||||
|
||||
delete midi_clock;
|
||||
midi_clock = new MidiClockTicker (this);
|
||||
midi_clock = new MidiClockTicker (*this);
|
||||
|
||||
/* crossfades require sample rate knowledge */
|
||||
|
||||
|
@ -40,13 +40,17 @@ using namespace ARDOUR;
|
||||
using namespace PBD;
|
||||
using namespace Temporal;
|
||||
|
||||
MidiClockTicker::MidiClockTicker (Session* s)
|
||||
MidiClockTicker::MidiClockTicker (Session& s)
|
||||
: _session (s)
|
||||
, _midi_port (s.midi_clock_output_port ())
|
||||
, _rolling (false)
|
||||
, _next_tick (0)
|
||||
, _beat_pos (0)
|
||||
, _clock_cnt (0)
|
||||
, _transport_pos (-1)
|
||||
{
|
||||
_session = s;
|
||||
_midi_port = s->midi_clock_output_port ();
|
||||
reset ();
|
||||
resync_latency (true);
|
||||
s->LatencyUpdated.connect_same_thread (_latency_connection, boost::bind (&MidiClockTicker::resync_latency, this, _1));
|
||||
_session.LatencyUpdated.connect_same_thread (_latency_connection, boost::bind (&MidiClockTicker::resync_latency, this, _1));
|
||||
}
|
||||
|
||||
MidiClockTicker::~MidiClockTicker ()
|
||||
@ -66,7 +70,7 @@ MidiClockTicker::reset ()
|
||||
void
|
||||
MidiClockTicker::resync_latency (bool playback)
|
||||
{
|
||||
if (_session->deletion_in_progress() || !playback) {
|
||||
if (_session.deletion_in_progress() || !playback) {
|
||||
return;
|
||||
}
|
||||
assert (_midi_port);
|
||||
|
Loading…
Reference in New Issue
Block a user