f@5: /* f@5: f@5: Copyright (C) 2016 Queen Mary University of London f@5: Author: Fiore Martin f@5: f@5: This file is part of Collidoscope. f@5: f@5: Collidoscope is free software: you can redistribute it and/or modify f@5: it under the terms of the GNU General Public License as published by f@5: the Free Software Foundation, either version 3 of the License, or f@5: (at your option) any later version. f@5: f@5: This program is distributed in the hope that it will be useful, f@5: but WITHOUT ANY WARRANTY; without even the implied warranty of f@5: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the f@5: GNU General Public License for more details. f@5: f@5: You should have received a copy of the GNU General Public License f@5: along with this program. If not, see . f@5: */ f@5: f@0: #pragma once f@0: f@0: #include "cinder/audio/dsp/RingBuffer.h" f@0: f@0: f@3: /** 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: template f@0: class RingBufferPack { f@0: f@0: public: f@0: f@0: RingBufferPack( size_t size ) : f@0: mSize( size ), f@0: mBuffer( size ) f@0: { f@0: mArray = new T[size]; f@0: } f@0: f@0: ~RingBufferPack() f@0: { f@0: delete[] mArray; f@0: } f@0: f@0: // no copy f@0: RingBufferPack( const RingBufferPack © ) = delete; f@0: RingBufferPack & operator=(const RingBufferPack ©) = delete; f@0: f@0: ci::audio::dsp::RingBufferT & getBuffer() { return mBuffer; } f@0: f@0: T* getExchangeArray() { return mArray; } f@0: f@0: std::size_t getSize() { return mSize; } f@0: f@0: private: f@0: size_t mSize; f@0: f@0: ci::audio::dsp::RingBufferT mBuffer; f@0: f@0: T* mArray; f@0: f@0: f@3: };