diff options
author | David Robillard <d@drobilla.net> | 2012-07-31 15:12:38 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2012-07-31 15:12:38 +0000 |
commit | 8d559e4991a491b612e63d5a4deff0ab48a3d3dd (patch) | |
tree | 06da8b1d71f8068f12bc3f476b90734b67d9120c /src/server/BufferFactory.cpp | |
parent | a41af6e41d60f8724809486b94ce1e6281c3bc31 (diff) | |
download | ingen-8d559e4991a491b612e63d5a4deff0ab48a3d3dd.tar.gz ingen-8d559e4991a491b612e63d5a4deff0ab48a3d3dd.tar.bz2 ingen-8d559e4991a491b612e63d5a4deff0ab48a3d3dd.zip |
Merge AudioBuffer into Buffer and avoid all the casting.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4584 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/server/BufferFactory.cpp')
-rw-r--r-- | src/server/BufferFactory.cpp | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/src/server/BufferFactory.cpp b/src/server/BufferFactory.cpp index 59da152f..720a4639 100644 --- a/src/server/BufferFactory.cpp +++ b/src/server/BufferFactory.cpp @@ -17,7 +17,6 @@ #include "ingen/URIs.hpp" #include "raul/log.hpp" -#include "AudioBuffer.hpp" #include "BufferFactory.hpp" #include "Driver.hpp" #include "Engine.hpp" @@ -126,26 +125,16 @@ BufferFactory::silent_buffer() BufferRef BufferFactory::create(LV2_URID type, uint32_t capacity) { - Buffer* buffer = NULL; - if (capacity == 0) { capacity = default_size(type); } - if (type == _uris.atom_Float) { - assert(capacity >= sizeof(LV2_Atom_Float)); - buffer = new AudioBuffer(*this, type, capacity); - } else if (type == _uris.atom_Sound) { - assert(capacity >= default_size(_uris.atom_Sound)); - buffer = new AudioBuffer(*this, type, capacity); - } else { - buffer = new Buffer(*this, type, capacity); - } - - buffer->atom()->type = type; + assert(type != _uris.atom_Float || + capacity >= sizeof(LV2_Atom_Float)); + assert(type != _uris.atom_Sound || + capacity >= default_size(_uris.atom_Sound)); - assert(buffer); - return BufferRef(buffer); + return BufferRef(new Buffer(*this, type, capacity)); } void |