summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2007-01-23 04:48:55 +0000
committerDavid Robillard <d@drobilla.net>2007-01-23 04:48:55 +0000
commit86637e192ca87a2c0562122b371dacdfc0572c70 (patch)
tree25eb44b21af49d215081808d9bc520bbef07bfd3
parenta4ba7bcf194bcbdee622dd1fed76dfd47e50a0f0 (diff)
downloadingen-86637e192ca87a2c0562122b371dacdfc0572c70.tar.gz
ingen-86637e192ca87a2c0562122b371dacdfc0572c70.tar.bz2
ingen-86637e192ca87a2c0562122b371dacdfc0572c70.zip
Jack MIDI fixes, "fixed" (increased) ranges on control dialog range spinners.
git-svn-id: http://svn.drobilla.net/lad/ingen@269 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r--src/libs/client/Serializer.cpp2
-rw-r--r--src/libs/engine/InputPort.cpp1
-rw-r--r--src/libs/engine/JackAudioDriver.cpp8
-rw-r--r--src/libs/engine/JackMidiDriver.cpp6
-rw-r--r--src/libs/engine/MidiNoteNode.cpp20
-rw-r--r--src/libs/engine/MidiNoteNode.h4
-rw-r--r--src/progs/ingenuity/ingenuity.glade4
7 files changed, 23 insertions, 22 deletions
diff --git a/src/libs/client/Serializer.cpp b/src/libs/client/Serializer.cpp
index 65dd7b78..d2d18d01 100644
--- a/src/libs/client/Serializer.cpp
+++ b/src/libs/client/Serializer.cpp
@@ -52,7 +52,7 @@ Serializer::Serializer()
{
_writer.add_prefix("ingen", "http://codeson.net/ns/ingen#");
_writer.add_prefix("ingenuity", "http://codeson.net/ns/ingenuity#");
- _writer.add_prefix("lv2", "http://lv2plug.in/ontology#>");
+ _writer.add_prefix("lv2", "http://lv2plug.in/ontology#");
}
diff --git a/src/libs/engine/InputPort.cpp b/src/libs/engine/InputPort.cpp
index 178a111c..6fbd500f 100644
--- a/src/libs/engine/InputPort.cpp
+++ b/src/libs/engine/InputPort.cpp
@@ -248,7 +248,6 @@ InputPort<MidiMessage>::process(SampleCount nframes, FrameTime start, FrameTime
do_mixdown = true;
} else {
// zero-copy
- assert(m_buffers.at(0)->is_joined());
m_buffers.at(0)->join((*m_connections.begin())->buffer(0));
//if (m_is_tied)
// m_tied_port->buffer(0)->join(m_buffers.at(0));
diff --git a/src/libs/engine/JackAudioDriver.cpp b/src/libs/engine/JackAudioDriver.cpp
index 45269b7d..d148a549 100644
--- a/src/libs/engine/JackAudioDriver.cpp
+++ b/src/libs/engine/JackAudioDriver.cpp
@@ -297,14 +297,16 @@ JackAudioDriver::_process_cb(jack_nframes_t nframes)
if (_engine.event_source())
_engine.event_source()->process(*_engine.post_processor(), nframes, start_of_last_cycle, start_of_current_cycle);
- assert(_engine.midi_driver());
- _engine.midi_driver()->prepare_block(start_of_last_cycle, start_of_current_cycle);
-
// Set buffers of patch ports to Jack port buffers (zero-copy processing)
for (List<JackAudioPort*>::iterator i = _ports.begin(); i != _ports.end(); ++i) {
assert(*i);
(*i)->prepare_buffer(nframes);
}
+
+ assert(_engine.midi_driver());
+ //_engine.midi_driver()->prepare_block(start_of_last_cycle, start_of_current_cycle);
+ _engine.midi_driver()->prepare_block(start_of_current_cycle, start_of_current_cycle + nframes);
+
// Run root patch
if (_root_patch)
diff --git a/src/libs/engine/JackMidiDriver.cpp b/src/libs/engine/JackMidiDriver.cpp
index c21484e3..a976464e 100644
--- a/src/libs/engine/JackMidiDriver.cpp
+++ b/src/libs/engine/JackMidiDriver.cpp
@@ -64,10 +64,6 @@ JackMidiPort::~JackMidiPort()
*
* This is basically trivial (as opposed to AlsaMidiPort) since Jack MIDI
* data is in-band with the audio thread.
- *
- * Prepares all events that occurred during the time interval passed
- * (which ideally are the events from the previous cycle with an exact
- * 1 cycle delay).
*/
void
JackMidiPort::prepare_block(const SampleCount block_start, const SampleCount block_end)
@@ -94,6 +90,8 @@ JackMidiPort::prepare_block(const SampleCount block_start, const SampleCount blo
message->time = ev->time;
message->size = ev->size;
message->buffer = ev->buffer;
+
+ assert(message->time < nframes);
}
//cerr << "Jack MIDI got " << event_count << " events." << endl;
diff --git a/src/libs/engine/MidiNoteNode.cpp b/src/libs/engine/MidiNoteNode.cpp
index 956c1494..bc6a344a 100644
--- a/src/libs/engine/MidiNoteNode.cpp
+++ b/src/libs/engine/MidiNoteNode.cpp
@@ -80,27 +80,29 @@ MidiNoteNode::process(SampleCount nframes, FrameTime start, FrameTime end)
for (size_t i=0; i < _midi_in_port->buffer(0)->filled_size(); ++i) {
ev = _midi_in_port->buffer(0)->value_at(i);
+ const FrameTime time = ev.time + start;
+
switch (ev.buffer[0] & 0xF0) {
case MIDI_CMD_NOTE_ON:
if (ev.buffer[2] == 0)
- note_off(ev.buffer[1], ev.time, nframes, start, end);
+ note_off(ev.buffer[1], time, nframes, start, end);
else
- note_on(ev.buffer[1], ev.buffer[2], ev.time, nframes, start, end);
+ note_on(ev.buffer[1], ev.buffer[2], time, nframes, start, end);
break;
case MIDI_CMD_NOTE_OFF:
- note_off(ev.buffer[1], ev.time, nframes, start, end);
+ note_off(ev.buffer[1], time, nframes, start, end);
break;
case MIDI_CMD_CONTROL:
switch (ev.buffer[1]) {
case MIDI_CTL_ALL_NOTES_OFF:
case MIDI_CTL_ALL_SOUNDS_OFF:
- all_notes_off(ev.time, nframes, start, end);
+ all_notes_off(time, nframes, start, end);
break;
case MIDI_CTL_SUSTAIN:
if (ev.buffer[2] > 63)
- sustain_on(ev.time, nframes, start, end);
+ sustain_on(time, nframes, start, end);
else
- sustain_off(ev.time, nframes, start, end);
+ sustain_off(time, nframes, start, end);
break;
case MIDI_CMD_BENDER:
@@ -114,7 +116,7 @@ MidiNoteNode::process(SampleCount nframes, FrameTime start, FrameTime end)
void
-MidiNoteNode::note_on(uchar note_num, uchar velocity, SampleCount nframes, FrameTime time, FrameTime start, FrameTime end)
+MidiNoteNode::note_on(uchar note_num, uchar velocity, FrameTime time, SampleCount nframes, FrameTime start, FrameTime end)
{
assert(time >= start && time <= end);
assert(time - start < _buffer_size);
@@ -210,7 +212,7 @@ MidiNoteNode::note_off(uchar note_num, FrameTime time, SampleCount nframes, Fram
key->state = Key::OFF;
if ( ! _sustain)
- free_voice(key->voice, time - start, nframes, start, end);
+ free_voice(key->voice, time, nframes, start, end);
else
_voices[key->voice].state = Voice::HOLDING;
}
@@ -260,7 +262,7 @@ MidiNoteNode::free_voice(size_t voice, FrameTime time, SampleCount nframes, Fram
void
-MidiNoteNode::all_notes_off(SampleCount nframes, FrameTime time, FrameTime start, FrameTime end)
+MidiNoteNode::all_notes_off(FrameTime time, SampleCount nframes, FrameTime start, FrameTime end)
{
assert(time >= start && time <= end);
assert(time - start < _buffer_size);
diff --git a/src/libs/engine/MidiNoteNode.h b/src/libs/engine/MidiNoteNode.h
index ba86455d..2a44d55f 100644
--- a/src/libs/engine/MidiNoteNode.h
+++ b/src/libs/engine/MidiNoteNode.h
@@ -44,9 +44,9 @@ public:
void process(SampleCount nframes, FrameTime start, FrameTime end);
- void note_on(uchar note_num, uchar velocity, SampleCount nframes, FrameTime time, FrameTime start, FrameTime end);
+ void note_on(uchar note_num, uchar velocity, FrameTime time, SampleCount nframes, FrameTime start, FrameTime end);
void note_off(uchar note_num, FrameTime time, SampleCount nframes, FrameTime start, FrameTime end);
- void all_notes_off(SampleCount nframes, FrameTime time, FrameTime start, FrameTime end);
+ void all_notes_off(FrameTime time, SampleCount nframes, FrameTime start, FrameTime end);
void sustain_on(FrameTime time, SampleCount nframes, FrameTime start, FrameTime end);
void sustain_off(FrameTime time, SampleCount nframes, FrameTime start, FrameTime end);
diff --git a/src/progs/ingenuity/ingenuity.glade b/src/progs/ingenuity/ingenuity.glade
index 64c6bb8c..de785fad 100644
--- a/src/progs/ingenuity/ingenuity.glade
+++ b/src/progs/ingenuity/ingenuity.glade
@@ -2092,7 +2092,7 @@
<property name="update_policy">GTK_UPDATE_ALWAYS</property>
<property name="snap_to_ticks">False</property>
<property name="wrap">False</property>
- <property name="adjustment">1 0 100 1 10 10</property>
+ <property name="adjustment">1 0 99999 1 10 10</property>
</widget>
<packing>
<property name="padding">0</property>
@@ -2181,7 +2181,7 @@
<property name="update_policy">GTK_UPDATE_ALWAYS</property>
<property name="snap_to_ticks">False</property>
<property name="wrap">False</property>
- <property name="adjustment">1 0 100 1 10 10</property>
+ <property name="adjustment">1 0 99999 1 10 10</property>
</widget>
<packing>
<property name="padding">0</property>