summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2007-04-08 19:04:12 +0000
committerDavid Robillard <d@drobilla.net>2007-04-08 19:04:12 +0000
commit40e4cf5d669a654728881a00a3659fc3bca0e546 (patch)
tree90bbb4f8e35a96a8911a3ff4c834a48dfd577628 /src
parentc2a43092234a32cfea8ba50d607494273624af07 (diff)
downloadingen-40e4cf5d669a654728881a00a3659fc3bca0e546.tar.gz
ingen-40e4cf5d669a654728881a00a3659fc3bca0e546.tar.bz2
ingen-40e4cf5d669a654728881a00a3659fc3bca0e546.zip
Alsa MIDI compile fixes.
make distcheck fixes. git-svn-id: http://svn.drobilla.net/lad/ingen@424 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r--src/libs/client/PluginModel.h2
-rw-r--r--src/libs/engine/AlsaMidiDriver.cpp33
-rw-r--r--src/libs/engine/AlsaMidiDriver.h10
-rw-r--r--src/libs/engine/JackMidiDriver.cpp3
-rw-r--r--src/libs/engine/Makefile.am2
5 files changed, 24 insertions, 26 deletions
diff --git a/src/libs/client/PluginModel.h b/src/libs/client/PluginModel.h
index 4c769fdb..d6ffb2cc 100644
--- a/src/libs/client/PluginModel.h
+++ b/src/libs/client/PluginModel.h
@@ -18,7 +18,7 @@
#ifndef PLUGINMODEL_H
#define PLUGINMODEL_H
-#include "../../config.h"
+#include "../../../config.h"
#include <string>
#include <iostream>
#include "raul/Path.h"
diff --git a/src/libs/engine/AlsaMidiDriver.cpp b/src/libs/engine/AlsaMidiDriver.cpp
index bbec1ab1..a1638077 100644
--- a/src/libs/engine/AlsaMidiDriver.cpp
+++ b/src/libs/engine/AlsaMidiDriver.cpp
@@ -35,7 +35,7 @@ namespace Ingen {
//// AlsaMidiPort ////
-AlsaMidiPort::AlsaMidiPort(AlsaMidiDriver* driver, DuplexPort<MidiBuffer>* patch_port)
+AlsaMidiPort::AlsaMidiPort(AlsaMidiDriver* driver, DuplexPort* patch_port)
: DriverPort(patch_port->is_input()),
Raul::ListNode<AlsaMidiPort*>(this),
_driver(driver),
@@ -125,16 +125,20 @@ AlsaMidiPort::prepare_block(const SampleCount block_start, const SampleCount blo
{
assert(block_end >= block_start);
- snd_seq_event_t* ev = NULL;
- MidiMessage* message = NULL;
- size_t nu_events = 0;
- size_t event_size = 0; // decoded length of Alsa event in bytes
- int timestamp = 0;
+ const SampleCount nframes = block_end - block_start;
+ snd_seq_event_t* ev = NULL;
+ size_t num_events = 0;
+ size_t event_size = 0; // decoded length of Alsa event in bytes
+ int timestamp = 0;
+ MidiBuffer* patch_buf = dynamic_cast<MidiBuffer*>(_patch_port->buffer(0));
+ assert(patch_buf);
+
+ patch_buf->prepare_write(nframes);
+
while (!_events.empty() && _events.front().time.tick < block_end) {
- assert(nu_events < _patch_port->buffer_size());
+ assert(num_events < _patch_port->buffer_size());
ev = &_events.front();
- message = &_patch_port->buffer(0)->data()[nu_events];
timestamp = ev->time.tick - block_start;
if (timestamp < 0) {
@@ -149,20 +153,17 @@ AlsaMidiPort::prepare_block(const SampleCount block_start, const SampleCount blo
// FIXME: is this realtime safe?
if ((event_size = snd_midi_event_decode(_driver->event_coder(),
- _midi_pool[nu_events], MAX_MIDI_EVENT_SIZE, ev)) > 0) {
- message->size = event_size;
- message->time = timestamp;
- message->buffer = _midi_pool[nu_events];
- ++nu_events;
+ _midi_pool[num_events], MAX_MIDI_EVENT_SIZE, ev)) > 0) {
+
+ patch_buf->put_event(timestamp, event_size, _midi_pool[num_events]);
+ ++num_events;
+
} else {
cerr << "[AlsaMidiPort] Unable to decode MIDI event" << endl;
}
_events.pop();
}
-
- _patch_port->buffer(0)->filled_size(nu_events);
- //_patch_port->tied_port()->buffer(0)->filled_size(nu_events);
}
diff --git a/src/libs/engine/AlsaMidiDriver.h b/src/libs/engine/AlsaMidiDriver.h
index 6c6debee..88daf94a 100644
--- a/src/libs/engine/AlsaMidiDriver.h
+++ b/src/libs/engine/AlsaMidiDriver.h
@@ -43,7 +43,7 @@ static const int MAX_MIDI_EVENT_SIZE = 3;
class AlsaMidiPort : public DriverPort, public Raul::ListNode<AlsaMidiPort*>
{
public:
- AlsaMidiPort(AlsaMidiDriver* driver, DuplexPort<MidiBuffer>* port);
+ AlsaMidiPort(AlsaMidiDriver* driver, DuplexPort* port);
virtual ~AlsaMidiPort();
void event(snd_seq_event_t* const ev);
@@ -52,12 +52,12 @@ public:
void set_name(const std::string& name);
- int port_id() const { return _port_id; }
- DuplexPort<MidiBuffer>* patch_port() const { return _patch_port; }
+ int port_id() const { return _port_id; }
+ DuplexPort* patch_port() const { return _patch_port; }
private:
AlsaMidiDriver* _driver;
- DuplexPort<MidiBuffer>* _patch_port;
+ DuplexPort* _patch_port;
int _port_id;
unsigned char** _midi_pool; ///< Pool of raw MIDI events for MidiMessage::buffer
Raul::SRSWQueue<snd_seq_event_t> _events;
@@ -86,7 +86,7 @@ public:
AudioDriver* audio_driver() { return _audio_driver; }
- DriverPort* create_port(DuplexPort<MidiBuffer>* patch_port)
+ DriverPort* create_port(DuplexPort* patch_port)
{ return new AlsaMidiPort(this, patch_port); }
void add_port(DriverPort* port);
diff --git a/src/libs/engine/JackMidiDriver.cpp b/src/libs/engine/JackMidiDriver.cpp
index 7170753f..0ec2170b 100644
--- a/src/libs/engine/JackMidiDriver.cpp
+++ b/src/libs/engine/JackMidiDriver.cpp
@@ -92,9 +92,6 @@ JackMidiPort::prepare_block(const SampleCount block_start, const SampleCount blo
}
//cerr << "Jack MIDI got " << event_count << " events." << endl;
-
- //_patch_port->buffer(0)->filled_size(event_count);
- //_patch_port->tied_port()->buffer(0)->filled_size(event_count);
}
diff --git a/src/libs/engine/Makefile.am b/src/libs/engine/Makefile.am
index 49308afa..98737957 100644
--- a/src/libs/engine/Makefile.am
+++ b/src/libs/engine/Makefile.am
@@ -42,6 +42,7 @@ libingen_la_SOURCES = \
AudioBuffer.cpp \
MidiBuffer.h \
MidiBuffer.cpp \
+ BufferFactory.h \
BufferFactory.cpp \
Port.h \
Port.cpp \
@@ -51,7 +52,6 @@ libingen_la_SOURCES = \
OutputPort.cpp \
DuplexPort.h \
DuplexPort.cpp \
- MidiMessage.h \
MidiNoteNode.h \
MidiNoteNode.cpp \
MidiTriggerNode.h \