summaryrefslogtreecommitdiffstats
path: root/src/libs/engine/MidiBuffer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/libs/engine/MidiBuffer.cpp')
-rw-r--r--src/libs/engine/MidiBuffer.cpp26
1 files changed, 20 insertions, 6 deletions
diff --git a/src/libs/engine/MidiBuffer.cpp b/src/libs/engine/MidiBuffer.cpp
index 7dfe72e6..35bda0a0 100644
--- a/src/libs/engine/MidiBuffer.cpp
+++ b/src/libs/engine/MidiBuffer.cpp
@@ -15,8 +15,11 @@
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+//#include <iostream>
#include "MidiBuffer.h"
+using namespace std;
+
namespace Ingen {
@@ -48,6 +51,8 @@ MidiBuffer::unjoin()
_joined_buf = NULL;
_buf = _local_buf;
_state = &_local_state;
+ clear();
+ reset(_this_nframes);
}
@@ -63,14 +68,23 @@ MidiBuffer::is_joined_to(Buffer* buf) const
void
-MidiBuffer::prepare(SampleCount nframes)
+MidiBuffer::prepare_read(SampleCount nframes)
+{
+ assert(!_joined_buf || data() == _joined_buf->data());
+ assert(!_joined_buf || state() == _joined_buf->state());
+
+ reset(nframes);
+}
+
+
+void
+MidiBuffer::prepare_write(SampleCount nframes)
{
- if (_joined_buf)
- _local_state = *_joined_buf->state();
- else
- reset_state(nframes);
+ clear();
+ reset(nframes);
- _this_nframes = nframes;
+ assert(!_joined_buf || data() == _joined_buf->data());
+ assert(!_joined_buf || state() == _joined_buf->state());
}