mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-23 23:17:46 +01:00
merge (squash) with scenechange topic branch to provide MIDI-driven scene change markers
This commit is contained in:
parent
b945cda558
commit
2cf411e4be
22 changed files with 852 additions and 36 deletions
|
|
@ -50,6 +50,7 @@ AsyncMIDIPort::AsyncMIDIPort (string const & name, PortFlags flags)
|
|||
, MIDI::Port (name, MIDI::Port::Flags (0))
|
||||
, _currently_in_cycle (false)
|
||||
, _last_write_timestamp (0)
|
||||
, have_timer (false)
|
||||
, output_fifo (512)
|
||||
, input_fifo (1024)
|
||||
#ifndef PLATFORM_WINDOWS
|
||||
|
|
@ -62,6 +63,13 @@ AsyncMIDIPort::~AsyncMIDIPort ()
|
|||
{
|
||||
}
|
||||
|
||||
void
|
||||
AsyncMIDIPort::set_timer (boost::function<framecnt_t (void)>& f)
|
||||
{
|
||||
timer = f;
|
||||
have_timer = true;
|
||||
}
|
||||
|
||||
void
|
||||
AsyncMIDIPort::flush_output_fifo (MIDI::pframes_t nframes)
|
||||
{
|
||||
|
|
@ -113,9 +121,18 @@ AsyncMIDIPort::cycle_start (MIDI::pframes_t nframes)
|
|||
|
||||
if (ARDOUR::Port::receives_input()) {
|
||||
MidiBuffer& mb (get_midi_buffer (nframes));
|
||||
pframes_t when = AudioEngine::instance()->sample_time_at_cycle_start();
|
||||
framecnt_t when;
|
||||
|
||||
if (have_timer) {
|
||||
when = timer ();
|
||||
} else {
|
||||
when = AudioEngine::instance()->sample_time_at_cycle_start();
|
||||
}
|
||||
|
||||
for (MidiBuffer::iterator b = mb.begin(); b != mb.end(); ++b) {
|
||||
if (!have_timer) {
|
||||
when += (*b).time();
|
||||
}
|
||||
input_fifo.write (when, (Evoral::EventType) 0, (*b).size(), (*b).buffer());
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue