To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.

Statistics Download as Zip
| Branch: | Tag: | Revision:

root / CollidoscopeApp / include / RingBufferPack.h @ 3:7fb593d53361

History | View | Annotate | Download (851 Bytes)

1 0:02467299402e f
#pragma once
2
3
#include "cinder/audio/dsp/RingBuffer.h"
4
5
6 3:7fb593d53361 f
/** Packs together a cinder::audio::dsp::RingBuffer and the related array used passed as argument to exchange data (read/write) with the ring buffer  */
7 0:02467299402e f
template <typename T>
8
class RingBufferPack {
9
10
public:
11
12
    RingBufferPack( size_t size ) :
13
        mSize( size ),
14
        mBuffer( size )
15
    {
16
        mArray = new T[size];
17
    }
18
19
    ~RingBufferPack()
20
    {
21
        delete[]  mArray;
22
    }
23
24
    // no copy
25
    RingBufferPack( const RingBufferPack &copy ) = delete;
26
    RingBufferPack & operator=(const RingBufferPack &copy) = delete;
27
28
    ci::audio::dsp::RingBufferT<T> & getBuffer() { return mBuffer; }
29
30
    T* getExchangeArray() { return mArray; }
31
32
    std::size_t getSize() { return mSize;  }
33
34
private:
35
    size_t mSize;
36
37
    ci::audio::dsp::RingBufferT<T> mBuffer;
38
39
    T* mArray;
40
41
42 3:7fb593d53361 f
};