summaryrefslogtreecommitdiffstats
path: root/src/server
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-04-28 18:02:23 +0000
committerDavid Robillard <d@drobilla.net>2012-04-28 18:02:23 +0000
commit7477318adc8de5244fc314939c296ae74605eaa5 (patch)
tree36798177af008cf6c9331ac88347bead2c685cbe /src/server
parent6d16e5689c3249c18fea9c7e2454e2d527afdb09 (diff)
downloadingen-7477318adc8de5244fc314939c296ae74605eaa5.tar.gz
ingen-7477318adc8de5244fc314939c296ae74605eaa5.tar.bz2
ingen-7477318adc8de5244fc314939c296ae74605eaa5.zip
Fix MIDI input.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4306 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/server')
-rw-r--r--src/server/Buffer.cpp10
-rw-r--r--src/server/internals/Note.cpp4
2 files changed, 8 insertions, 6 deletions
diff --git a/src/server/Buffer.cpp b/src/server/Buffer.cpp
index fa8a2c0e..b112d8ea 100644
--- a/src/server/Buffer.cpp
+++ b/src/server/Buffer.cpp
@@ -139,7 +139,9 @@ Buffer::port_data(PortType port_type, SampleCount offset) const
void
Buffer::prepare_write(Context& context)
{
- _atom->size = 0;
+ if (_type == _factory.uris().atom_Sequence) {
+ _atom->size = sizeof(LV2_Atom_Sequence_Body);
+ }
}
bool
@@ -154,14 +156,14 @@ Buffer::append_event(int64_t frames,
LV2_Atom_Sequence* seq = (LV2_Atom_Sequence*)_atom;
LV2_Atom_Event* ev = (LV2_Atom_Event*)(
- (uint8_t*)seq + sizeof(LV2_Atom) + lv2_atom_pad_size(seq->atom.size));
+ (uint8_t*)seq + lv2_atom_total_size(&seq->atom));
ev->time.frames = frames;
ev->body.size = size;
ev->body.type = type;
- memcpy(LV2_ATOM_BODY(&ev->body), data, size);
+ memcpy(ev + 1, data, size);
- _atom->size += lv2_atom_pad_size(size);
+ _atom->size += sizeof(LV2_Atom_Event) + lv2_atom_pad_size(size);
return true;
}
diff --git a/src/server/internals/Note.cpp b/src/server/internals/Note.cpp
index 1a21ed37..6eb6ffb2 100644
--- a/src/server/internals/Note.cpp
+++ b/src/server/internals/Note.cpp
@@ -195,8 +195,8 @@ NoteNode::note_on(ProcessContext& context, uint8_t note_num, uint8_t velocity, F
assert(time >= context.start() && time <= context.end());
assert(note_num <= 127);
- Key* key = &_keys[note_num];
- Voice* voice = NULL;
+ Key* key = &_keys[note_num];
+ Voice* voice = NULL;
uint32_t voice_num = 0;
if (key->state != Key::OFF) {