summaryrefslogtreecommitdiffstats
path: root/raul/StampedChunkRingBuffer.hpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2008-02-09 18:23:57 +0000
committerDavid Robillard <d@drobilla.net>2008-02-09 18:23:57 +0000
commit81f335330c209359ef1d2b3bdedc5c19790d2eba (patch)
tree2262742e60b1360ecd66bf1f5be57e4df2b53de3 /raul/StampedChunkRingBuffer.hpp
parent43dd122ffcdb6a0b40a56777245a870e411d439c (diff)
downloadraul-81f335330c209359ef1d2b3bdedc5c19790d2eba.tar.gz
raul-81f335330c209359ef1d2b3bdedc5c19790d2eba.tar.bz2
raul-81f335330c209359ef1d2b3bdedc5c19790d2eba.zip
Use Raul::TimeStamp (LV2 compatible typed 32:32 fixed timestamp) everywhere.
Fix initial size of Patchage messages window. Machina disabled for now (transitioning to generic timestamps). git-svn-id: http://svn.drobilla.net/lad/raul@1133 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'raul/StampedChunkRingBuffer.hpp')
-rw-r--r--raul/StampedChunkRingBuffer.hpp83
1 files changed, 0 insertions, 83 deletions
diff --git a/raul/StampedChunkRingBuffer.hpp b/raul/StampedChunkRingBuffer.hpp
deleted file mode 100644
index b4f9371..0000000
--- a/raul/StampedChunkRingBuffer.hpp
+++ /dev/null
@@ -1,83 +0,0 @@
-/* This file is part of Raul.
- * Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
- * Raul 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.
- *
- * Raul 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 RAUL_STAMPED_CHUNK_RING_BUFFER_HPP
-#define RAUL_STAMPED_CHUNK_RING_BUFFER_HPP
-
-#include <cassert>
-#include <algorithm>
-#include <glib.h>
-#include <raul/types.hpp>
-#include <raul/RingBuffer.hpp>
-
-namespace Raul {
-
-
-/** A RingBuffer of timestamped binary "chunks".
- *
- * This packs a timestamp, size, and size bytes of data flat into the buffer.
- * Useful for MIDI events, OSC messages, etc.
- */
-class StampedChunkRingBuffer : private Raul::RingBuffer<Byte> {
-public:
-
- /** @param size Size in bytes.
- */
- StampedChunkRingBuffer(size_t size)
- : RingBuffer<Byte>(size)
- {}
-
- size_t capacity() const { return _size; }
-
- size_t write(TickTime time, size_t size, const Byte* buf);
- bool read(TickTime* time, size_t* size, Byte* buf);
-};
-
-
-inline bool
-StampedChunkRingBuffer::read(TickTime* time, size_t* size, Byte* buf)
-{
- bool success = RingBuffer<Byte>::full_read(sizeof(TickTime), (Byte*)time);
- if (success)
- success = RingBuffer<Byte>::full_read(sizeof(size_t), (Byte*)size);
- if (success)
- success = RingBuffer<Byte>::full_read(*size, buf);
-
- return success;
-}
-
-
-inline size_t
-StampedChunkRingBuffer::write(TickTime time, size_t size, const Byte* buf)
-{
- assert(size > 0);
-
- if (write_space() < (sizeof(TickTime) + sizeof(size_t) + size)) {
- return 0;
- } else {
- RingBuffer<Byte>::write(sizeof(TickTime), (Byte*)&time);
- RingBuffer<Byte>::write(sizeof(size_t), (Byte*)&size);
- RingBuffer<Byte>::write(size, buf);
- return size;
- }
-}
-
-
-} // namespace Raul
-
-#endif // RAUL_STAMPED_CHUNK_RING_BUFFER_HPP
-