summaryrefslogtreecommitdiff
path: root/libs/ardour/ticker.cc
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2009-12-01 19:08:59 +0000
committerCarl Hetherington <carl@carlh.net>2009-12-01 19:08:59 +0000
commit66ee16d7c867fc6243721a774602f19987409958 (patch)
treea35521aabfc045e93bc63070fbb2d93d61013b7c /libs/ardour/ticker.cc
parent7eb3cb0bed268d976197ea895b2cffc7ddfde6b5 (diff)
Prevent some segfaults when trying to send MTC when there is no port to send it to.
git-svn-id: svn://localhost/ardour2/branches/3.0@6257 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/ticker.cc')
-rw-r--r--libs/ardour/ticker.cc16
1 files changed, 16 insertions, 0 deletions
diff --git a/libs/ardour/ticker.cc b/libs/ardour/ticker.cc
index 97e44ebf7b..7f7ca32907 100644
--- a/libs/ardour/ticker.cc
+++ b/libs/ardour/ticker.cc
@@ -181,6 +181,10 @@ double MidiClockTicker::one_ppqn_in_frames(nframes_t transport_position)
void MidiClockTicker::send_midi_clock_event(nframes_t offset)
{
+ if (!_midi_port) {
+ return;
+ }
+
#ifdef WITH_JACK_MIDI
assert (MIDI::JACK_MidiPort::is_process_thread());
#endif // WITH_JACK_MIDI
@@ -193,18 +197,30 @@ void MidiClockTicker::send_midi_clock_event(nframes_t offset)
void MidiClockTicker::send_start_event(nframes_t offset)
{
+ if (!_midi_port) {
+ return;
+ }
+
static uint8_t _midi_clock_tick[1] = { MIDI_CMD_COMMON_START };
_midi_port->write(_midi_clock_tick, 1, offset);
}
void MidiClockTicker::send_continue_event(nframes_t offset)
{
+ if (!_midi_port) {
+ return;
+ }
+
static uint8_t _midi_clock_tick[1] = { MIDI_CMD_COMMON_CONTINUE };
_midi_port->write(_midi_clock_tick, 1, offset);
}
void MidiClockTicker::send_stop_event(nframes_t offset)
{
+ if (!_midi_port) {
+ return;
+ }
+
static uint8_t _midi_clock_tick[1] = { MIDI_CMD_COMMON_STOP };
_midi_port->write(_midi_clock_tick, 1, offset);
}