projects
/
ardour.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
properly handle integer steps in plugin controls
[ardour.git]
/
libs
/
ardour
/
async_midi_port.cc
diff --git
a/libs/ardour/async_midi_port.cc
b/libs/ardour/async_midi_port.cc
index bd583328c30f1781a768d3268f27c1053bb64265..d6d9a953aaa61ca471aa90ae3857356765669c01 100644
(file)
--- a/
libs/ardour/async_midi_port.cc
+++ b/
libs/ardour/async_midi_port.cc
@@
-37,10
+37,6
@@
using namespace ARDOUR;
using namespace std;
using namespace PBD;
using namespace std;
using namespace PBD;
-namespace Evoral {
- template class EventRingBuffer<MIDI::timestamp_t>;
-}
-
pthread_t AsyncMIDIPort::_process_thread;
#define port_engine AudioEngine::instance()->port_engine()
pthread_t AsyncMIDIPort::_process_thread;
#define port_engine AudioEngine::instance()->port_engine()
@@
-50,11
+46,10
@@
AsyncMIDIPort::AsyncMIDIPort (string const & name, PortFlags flags)
, MIDI::Port (name, MIDI::Port::Flags (0))
, _currently_in_cycle (false)
, _last_write_timestamp (0)
, MIDI::Port (name, MIDI::Port::Flags (0))
, _currently_in_cycle (false)
, _last_write_timestamp (0)
+ , have_timer (false)
, output_fifo (512)
, input_fifo (1024)
, output_fifo (512)
, input_fifo (1024)
-#ifndef PLATFORM_WINDOWS
- , xthread (true)
-#endif
+ , _xthread (true)
{
}
{
}
@@
-62,6
+57,13
@@
AsyncMIDIPort::~AsyncMIDIPort ()
{
}
{
}
+void
+AsyncMIDIPort::set_timer (boost::function<MIDI::framecnt_t (void)>& f)
+{
+ timer = f;
+ have_timer = true;
+}
+
void
AsyncMIDIPort::flush_output_fifo (MIDI::pframes_t nframes)
{
void
AsyncMIDIPort::flush_output_fifo (MIDI::pframes_t nframes)
{
@@
-113,17
+115,24
@@
AsyncMIDIPort::cycle_start (MIDI::pframes_t nframes)
if (ARDOUR::Port::receives_input()) {
MidiBuffer& mb (get_midi_buffer (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) {
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());
}
input_fifo.write (when, (Evoral::EventType) 0, (*b).size(), (*b).buffer());
}
-#ifndef PLATFORM_WINDOWS
if (!mb.empty()) {
if (!mb.empty()) {
- xthread.wakeup ();
+
_
xthread.wakeup ();
}
}
-#endif
}
}
}
}