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 @ 2:dd889fff8423

History | View | Annotate | Download (810 Bytes)

1
#pragma once
2

    
3
#include "cinder/audio/dsp/RingBuffer.h"
4

    
5

    
6
/* Packs together a RingBuffer and the erlated array used to exchange data (read/write) with the ring buffer 
7
*/
8
template <typename T>
9
class RingBufferPack {
10

    
11
public:
12

    
13
    RingBufferPack( size_t size ) :
14
        mSize( size ),
15
        mBuffer( size )
16
    {
17
        mArray = new T[size];
18
    }
19

    
20
    ~RingBufferPack()
21
    {
22
        delete[]  mArray;
23
    }
24

    
25
    // no copy
26
    RingBufferPack( const RingBufferPack &copy ) = delete;
27
    RingBufferPack & operator=(const RingBufferPack &copy) = delete;
28

    
29
    ci::audio::dsp::RingBufferT<T> & getBuffer() { return mBuffer; }
30

    
31
    T* getExchangeArray() { return mArray; }
32

    
33
    std::size_t getSize() { return mSize;  }
34

    
35
private:
36
    size_t mSize;
37

    
38
    ci::audio::dsp::RingBufferT<T> mBuffer;
39

    
40
    T* mArray;
41

    
42

    
43
};