summaryrefslogtreecommitdiffstats
path: root/src/engine/StringBuffer.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2009-11-14 20:44:40 +0000
committerDavid Robillard <d@drobilla.net>2009-11-14 20:44:40 +0000
commit6ae2018e81e7e81e4906e62dc6224ad34298d9c2 (patch)
tree11286438977c4f975b5148dc93b5f4dfafabdbdc /src/engine/StringBuffer.cpp
parentcfec427867f42d7aa7bea6dfbb0736b5ce99e9e2 (diff)
downloadingen-6ae2018e81e7e81e4906e62dc6224ad34298d9c2.tar.gz
ingen-6ae2018e81e7e81e4906e62dc6224ad34298d9c2.tar.bz2
ingen-6ae2018e81e7e81e4906e62dc6224ad34298d9c2.zip
Object extension.
Port resize extension. Sensible extension(s) implementation design for Ingen. Replace string port extension support in Ingen with Object port extension. Implement port resize extension in Ingen. Some test plugins for this stuff. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2260 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/engine/StringBuffer.cpp')
-rw-r--r--src/engine/StringBuffer.cpp121
1 files changed, 0 insertions, 121 deletions
diff --git a/src/engine/StringBuffer.cpp b/src/engine/StringBuffer.cpp
deleted file mode 100644
index a6cec9f1..00000000
--- a/src/engine/StringBuffer.cpp
+++ /dev/null
@@ -1,121 +0,0 @@
-/* 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
- */
-
-#define __STDC_LIMIT_MACROS 1
-#include <string.h>
-#include <stdint.h>
-#include <iostream>
-#include "ingen-config.h"
-#include "StringBuffer.hpp"
-
-using namespace std;
-
-namespace Ingen {
-
-using namespace Shared;
-
-/** Allocate a new string buffer.
- * \a capacity is in bytes.
- */
-StringBuffer::StringBuffer(size_t capacity)
- : Buffer(DataType(DataType::EVENT), capacity)
-{
- memset(&_local_buf, '\0', sizeof(LV2_String_Data));
- _local_buf.data = (char*)malloc(capacity);
- _local_buf.storage = capacity;
-
- _buf = &_local_buf;
- clear();
-
- cerr << "Creating String Buffer " << _buf << ", capacity = " << capacity << endl;
-}
-
-
-void
-StringBuffer::clear()
-{
- static const string default_val("2\n0 1\n1 1\n");
- if (_buf && _buf->data && _buf->storage > default_val.length())
- strncpy(_buf->data, default_val.c_str(), default_val.length());
-}
-
-
-/** Use another buffer's data instead of the local one.
- *
- * This buffer will essentially be identical to @a buf after this call.
- */
-bool
-StringBuffer::join(Buffer* buf)
-{
- assert(buf != this);
- StringBuffer* sbuf = dynamic_cast<StringBuffer*>(buf);
- if (!sbuf)
- return false;
-
- _buf = &sbuf->_local_buf;
- _joined_buf = sbuf;
-
- return true;
-}
-
-
-void
-StringBuffer::unjoin()
-{
- _joined_buf = NULL;
- _buf = &_local_buf;
-}
-
-
-void
-StringBuffer::prepare_read(FrameTime start, SampleCount nframes)
-{
- _this_nframes = nframes;
-}
-
-
-void
-StringBuffer::prepare_write(FrameTime start, SampleCount nframes)
-{
-}
-
-
-void
-StringBuffer::copy(const Buffer* src_buf, size_t start_sample, size_t end_sample)
-{
- const StringBuffer* src = dynamic_cast<const StringBuffer*>(src_buf);
- assert(src);
- assert(src != this);
- assert(src->_buf != _buf);
- assert(src->_buf->data != _buf->data);
-
- strncpy(_buf->data, src->_buf->data, std::min(_buf->len, src->_buf->len));
- _this_nframes = end_sample - start_sample;
-}
-
-
-void
-StringBuffer::resize(size_t size)
-{
- _buf->data = (char*)realloc(_buf->data, size);
- _buf->storage = size;
- _size = size;
-}
-
-
-} // namespace Ingen
-