From 082f526e2523538fe19cd9597b25317af9d0a195 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 28 Feb 2010 18:35:58 +0000 Subject: Use appropriate allocation for RingBuffer and SRSWQueue (was backwards). git-svn-id: http://svn.drobilla.net/lad/trunk/raul@2508 a436a847-0d15-0410-975c-d299462d15a1 --- raul/RingBuffer.hpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'raul/RingBuffer.hpp') diff --git a/raul/RingBuffer.hpp b/raul/RingBuffer.hpp index 23d4d90..77d4256 100644 --- a/raul/RingBuffer.hpp +++ b/raul/RingBuffer.hpp @@ -20,6 +20,7 @@ #include #include +#include #include #include #include "raul/log.hpp" @@ -34,12 +35,11 @@ namespace Raul { template class RingBuffer { public: - /** @param size Size in bytes. */ RingBuffer(size_t size) : _size(size) - , _buf(new T[size]) + , _buf(static_cast(malloc(size))) { reset(); assert(read_space() == 0); @@ -47,7 +47,7 @@ public: } virtual ~RingBuffer() { - delete[] _buf; + free(_buf); } /** Reset(empty) the ringbuffer. @@ -99,7 +99,7 @@ protected: mutable int _read_ptr; size_t _size; ///< Size (capacity) in bytes - T* _buf; ///< size, event, size, event... + char* _buf; ///< Contents }; @@ -190,7 +190,7 @@ bool RingBuffer::skip(size_t size) { if (read_space() < size) { - warn << "Attempt to skip past end of MIDI ring buffer" << std::endl; + warn << "Attempt to skip past end of RingBuffer" << std::endl; return false; } -- cgit v1.2.1