summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2008-01-13 00:27:13 +0000
committerDavid Robillard <d@drobilla.net>2008-01-13 00:27:13 +0000
commitc78c44ccd7bb5ce4903385b1c18613160fbb61bf (patch)
tree28b1386f39ba3d665f186f05e3c33771c0fc4ba5
parente92c1669c1cdf857b8a3900abb9f891e6ca9fdad (diff)
Fix MIDI playback.
git-svn-id: svn://localhost/ardour2/trunk@2905 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r--libs/ardour/ardour/midi_port.h1
-rw-r--r--libs/ardour/audioengine.cc10
-rw-r--r--libs/ardour/jack_midi_port.cc27
-rw-r--r--libs/ardour/midi_port.cc12
4 files changed, 26 insertions, 24 deletions
diff --git a/libs/ardour/ardour/midi_port.h b/libs/ardour/ardour/midi_port.h
index c9bcb056f4..485834aaff 100644
--- a/libs/ardour/ardour/midi_port.h
+++ b/libs/ardour/ardour/midi_port.h
@@ -34,6 +34,7 @@ class MidiPort : public BaseMidiPort, public PortFacade {
void reset ();
void cycle_start (nframes_t nframes, nframes_t offset);
+ void cycle_end (nframes_t nframes, nframes_t offset);
protected:
friend class AudioEngine;
diff --git a/libs/ardour/audioengine.cc b/libs/ardour/audioengine.cc
index 08d18c7cab..8ec97debd4 100644
--- a/libs/ardour/audioengine.cc
+++ b/libs/ardour/audioengine.cc
@@ -337,11 +337,6 @@ AudioEngine::process_callback (nframes_t nframes)
if (session) {
session->process (nframes);
}
-
- if (!_running) {
- _processed_frames = next_processed_frames;
- return 0;
- }
// Finalize ports (ie write data if necessary)
@@ -349,6 +344,11 @@ AudioEngine::process_callback (nframes_t nframes)
(*i)->cycle_end (nframes, 0);
}
+ if (!_running) {
+ _processed_frames = next_processed_frames;
+ return 0;
+ }
+
if (last_monitor_check + monitor_check_interval < next_processed_frames) {
boost::shared_ptr<Ports> p = ports.reader();
diff --git a/libs/ardour/jack_midi_port.cc b/libs/ardour/jack_midi_port.cc
index c9471c9d0c..0b8d96f4db 100644
--- a/libs/ardour/jack_midi_port.cc
+++ b/libs/ardour/jack_midi_port.cc
@@ -25,31 +25,22 @@ JackMidiPort::JackMidiPort (const std::string& name, Flags flgs, MidiBuffer* buf
, JackPort (name, DataType::MIDI, flgs)
, BaseMidiPort (name, flgs)
{
- if (buf) {
+ // MIDI ports always need a buffer since jack buffer format is different
+ assert(buf);
- cout << name << " BUFFER" << endl;
-
- _buffer = buf;
- _own_buffer = false;
-
- } else {
-
- cout << name << " NO BUFFER" << endl;
-
- /* data space will be provided by JACK */
- _buffer = new MidiBuffer (0);
- _own_buffer = true;
- }
+ _buffer = buf;
+ _own_buffer = false;
}
void
-JackMidiPort::cycle_start (nframes_t nframes, nframes_t offset_ignored_but_probably_should_not_be)
+JackMidiPort::cycle_start (nframes_t nframes, nframes_t offset)
{
+ /* FIXME: offset */
+
_buffer->clear();
assert(_buffer->size() == 0);
if (_flags & IsOutput) {
- // no buffer, nothing to do
return;
}
@@ -76,8 +67,10 @@ JackMidiPort::cycle_start (nframes_t nframes, nframes_t offset_ignored_but_proba
}
void
-JackMidiPort::cycle_end (nframes_t nframes, nframes_t offset_ignored_but_probably_should_not_be)
+JackMidiPort::cycle_end (nframes_t nframes, nframes_t offset)
{
+ /* FIXME: offset */
+
if (_flags & IsInput) {
return;
}
diff --git a/libs/ardour/midi_port.cc b/libs/ardour/midi_port.cc
index 3e8dea4f62..7a045dc829 100644
--- a/libs/ardour/midi_port.cc
+++ b/libs/ardour/midi_port.cc
@@ -67,8 +67,6 @@ MidiPort::reset()
void
MidiPort::cycle_start (nframes_t nframes, nframes_t offset)
{
- /* caller must hold process lock */
-
if (_ext_port) {
_ext_port->cycle_start (nframes, offset);
}
@@ -99,3 +97,13 @@ MidiPort::cycle_start (nframes_t nframes, nframes_t offset)
_buffer->silence (nframes, offset);
}
}
+
+
+void
+MidiPort::cycle_end (nframes_t nframes, nframes_t offset)
+{
+ if (_ext_port) {
+ _ext_port->cycle_end (nframes, offset);
+ }
+}
+