summaryrefslogtreecommitdiffstats
path: root/src/engine/StringBuffer.hpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2009-11-12 06:56:26 +0000
committerDavid Robillard <d@drobilla.net>2009-11-12 06:56:26 +0000
commit64bd557e75113743f179086b365ea7d97b72ee3e (patch)
tree6a6f5b72a8ce97616cd5ccff188f2e44e92d1ba8 /src/engine/StringBuffer.hpp
parent023dcf4cb297928879eb0e53cf0216edb562f6fa (diff)
downloadingen-64bd557e75113743f179086b365ea7d97b72ee3e.tar.gz
ingen-64bd557e75113743f179086b365ea7d97b72ee3e.tar.bz2
ingen-64bd557e75113743f179086b365ea7d97b72ee3e.zip
String port support.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2255 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/engine/StringBuffer.hpp')
-rw-r--r--src/engine/StringBuffer.hpp59
1 files changed, 59 insertions, 0 deletions
diff --git a/src/engine/StringBuffer.hpp b/src/engine/StringBuffer.hpp
new file mode 100644
index 00000000..79d83f7a
--- /dev/null
+++ b/src/engine/StringBuffer.hpp
@@ -0,0 +1,59 @@
+/* This file is part of Ingen.
+ * Copyright (C) 2009 Dave Robillard <http://drobilla.net>
+ *
+ * Ingen is free software; you can redistribute it and/or modify it under the
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation; either version 2 of the License, or (at your option) any later
+ * version.
+ *
+ * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef STRINGBUFFER_H
+#define STRINGBUFFER_H
+
+#include "string-port.lv2/string-port.h"
+#include "interface/DataType.hpp"
+#include "Buffer.hpp"
+
+namespace Ingen {
+
+
+class StringBuffer : public Buffer {
+public:
+ StringBuffer(size_t capacity);
+
+ void clear();
+
+ void* raw_data() { return (void*)&_buf; }
+ const void* raw_data() const { return (void*)&_buf; }
+
+ char* data() { return _buf->data; }
+ const char* data() const { return _buf->data; }
+
+ void prepare_read(FrameTime start, SampleCount nframes);
+ void prepare_write(FrameTime start, SampleCount nframes);
+
+ bool join(Buffer* buf);
+ void unjoin();
+
+ void copy(const Buffer* src, size_t start_sample, size_t end_sample);
+
+ void resize(size_t size);
+
+private:
+ LV2_String_Data* _buf; ///< Contents (_local_buf or belongs to _joined_buf)
+ LV2_String_Data _local_buf; ///< Local contents
+ uint32_t _this_nframes; ///< Current cycle nframes
+};
+
+
+} // namespace Ingen
+
+#endif // STRINGBUFFER_H