From b59584b387c4b77d09ba4c791eb711597f67c8c8 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 8 Apr 2007 08:11:59 +0000 Subject: MIDI patching fixes (clean disconnecting). git-svn-id: http://svn.drobilla.net/lad/ingen@416 a436a847-0d15-0410-975c-d299462d15a1 --- src/libs/engine/MidiBuffer.h | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'src/libs/engine/MidiBuffer.h') diff --git a/src/libs/engine/MidiBuffer.h b/src/libs/engine/MidiBuffer.h index 459c1209..5a810bc3 100644 --- a/src/libs/engine/MidiBuffer.h +++ b/src/libs/engine/MidiBuffer.h @@ -31,20 +31,19 @@ public: MidiBuffer(size_t capacity) : Buffer(DataType(DataType::MIDI), capacity) , _state(&_local_state) - , _buf(lv2midi_new((uint32_t)capacity)) - , _local_buf(NULL) + , _local_buf(lv2midi_new((uint32_t)capacity)) + , _buf(_local_buf) , _joined_buf(NULL) { clear(); - reset_state(0); } ~MidiBuffer() { lv2midi_free(_buf); } - void prepare(SampleCount nframes); + void prepare_read(SampleCount nframes); + void prepare_write(SampleCount nframes); bool is_joined_to(Buffer* buf) const; - bool is_joined() const { return (_joined_buf == NULL); } bool join(Buffer* buf); void unjoin(); @@ -57,9 +56,9 @@ public: { return ((_joined_buf != NULL) ? _joined_buf->state() : _state); } inline void clear() - { lv2midi_reset_buffer(_buf); } + { lv2midi_reset_buffer(_buf); _state->position = 0; } - inline void reset_state(uint32_t nframes) + inline void reset(SampleCount nframes) { lv2midi_reset_state(_state, _buf, nframes); _this_nframes = nframes; } inline double increment() @@ -72,10 +71,10 @@ public: { return lv2midi_put_event(_state, timestamp, size, data); } private: - LV2_MIDIState* _state; LV2_MIDIState _local_state; - LV2_MIDI* _buf; + LV2_MIDIState* _state; LV2_MIDI* _local_buf; + LV2_MIDI* _buf; MidiBuffer* _joined_buf; ///< Buffer to mirror, if joined -- cgit v1.2.1