summaryrefslogtreecommitdiffstats
path: root/src/server/BufferFactory.hpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2016-12-13 20:53:58 -0500
committerDavid Robillard <d@drobilla.net>2016-12-14 14:47:13 -0500
commite7b2f7ee286350bc3bb56b44ed98e4d8bf49af82 (patch)
tree8e5a4e42b36bb5c321f24cdd492cd3dc0a941222 /src/server/BufferFactory.hpp
parent05c55a5be68318d2b7ca861a3012bf4893bcb82d (diff)
downloadingen-e7b2f7ee286350bc3bb56b44ed98e4d8bf49af82.tar.gz
ingen-e7b2f7ee286350bc3bb56b44ed98e4d8bf49af82.tar.bz2
ingen-e7b2f7ee286350bc3bb56b44ed98e4d8bf49af82.zip
Fix real-time issues with buffer allocation
Diffstat (limited to 'src/server/BufferFactory.hpp')
-rw-r--r--src/server/BufferFactory.hpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/server/BufferFactory.hpp b/src/server/BufferFactory.hpp
index ccb01899..09722b4e 100644
--- a/src/server/BufferFactory.hpp
+++ b/src/server/BufferFactory.hpp
@@ -50,12 +50,22 @@ public:
uint32_t audio_buffer_size() const;
uint32_t default_size(LV2_URID type) const;
+ /** Dynamically allocate a new Buffer. */
+ BufferRef create(LV2_URID type,
+ LV2_URID value_type,
+ uint32_t capacity = 0);
+
+ /** Get a new buffer, reusing if possible, allocating if otherwise. */
BufferRef get_buffer(LV2_URID type,
LV2_URID value_type,
- uint32_t capacity,
- bool real_time,
- bool force_create = false);
+ uint32_t capacity);
+
+ /** Claim an existing buffer, never allocates, real-time safe. */
+ BufferRef claim_buffer(LV2_URID type,
+ LV2_URID value_type,
+ uint32_t capacity);
+ /** Return a reference to a shared silent buffer. */
BufferRef silent_buffer();
void set_block_length(SampleCount block_length);
@@ -69,7 +79,7 @@ private:
friend class Buffer;
void recycle(Buffer* buf);
- BufferRef create(LV2_URID type, LV2_URID value_type, uint32_t capacity=0);
+ Buffer* try_get_buffer(LV2_URID type);
inline std::atomic<Buffer*>& free_list(LV2_URID type) {
if (type == _uris.atom_Float) {