annotate CollidoscopeApp/include/RingBufferPack.h @ 18:f1ff1a81be20 tip

Changed licenses names. Fixed one comment and usage text in CollidoscopeApp.cpp.
author Fiore Martin <f.martin@qmul.ac.uk>
date Thu, 25 Aug 2016 12:07:50 +0200
parents 75b744078d66
children
rev   line source
f@5 1 /*
f@5 2
f@5 3 Copyright (C) 2016 Queen Mary University of London
f@5 4 Author: Fiore Martin
f@5 5
f@5 6 This file is part of Collidoscope.
f@5 7
f@5 8 Collidoscope is free software: you can redistribute it and/or modify
f@5 9 it under the terms of the GNU General Public License as published by
f@5 10 the Free Software Foundation, either version 3 of the License, or
f@5 11 (at your option) any later version.
f@5 12
f@5 13 This program is distributed in the hope that it will be useful,
f@5 14 but WITHOUT ANY WARRANTY; without even the implied warranty of
f@5 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
f@5 16 GNU General Public License for more details.
f@5 17
f@5 18 You should have received a copy of the GNU General Public License
f@5 19 along with this program. If not, see <http://www.gnu.org/licenses/>.
f@5 20 */
f@5 21
f@0 22 #pragma once
f@0 23
f@0 24 #include "cinder/audio/dsp/RingBuffer.h"
f@0 25
f@0 26
f@3 27 /** Packs together a cinder::audio::dsp::RingBuffer and the related array used passed as argument to exchange data (read/write) with the ring buffer */
f@0 28 template <typename T>
f@0 29 class RingBufferPack {
f@0 30
f@0 31 public:
f@0 32
f@0 33 RingBufferPack( size_t size ) :
f@0 34 mSize( size ),
f@0 35 mBuffer( size )
f@0 36 {
f@0 37 mArray = new T[size];
f@0 38 }
f@0 39
f@0 40 ~RingBufferPack()
f@0 41 {
f@0 42 delete[] mArray;
f@0 43 }
f@0 44
f@0 45 // no copy
f@0 46 RingBufferPack( const RingBufferPack &copy ) = delete;
f@0 47 RingBufferPack & operator=(const RingBufferPack &copy) = delete;
f@0 48
f@0 49 ci::audio::dsp::RingBufferT<T> & getBuffer() { return mBuffer; }
f@0 50
f@0 51 T* getExchangeArray() { return mArray; }
f@0 52
f@0 53 std::size_t getSize() { return mSize; }
f@0 54
f@0 55 private:
f@0 56 size_t mSize;
f@0 57
f@0 58 ci::audio::dsp::RingBufferT<T> mBuffer;
f@0 59
f@0 60 T* mArray;
f@0 61
f@0 62
f@3 63 };