disallow copying for AudioRingBuffer objects

This commit is contained in:
Stephen Birarda 2013-05-17 12:27:05 -07:00
parent 3e65d5a548
commit fcfe5c9e25
2 changed files with 4 additions and 20 deletions

View file

@ -24,28 +24,10 @@ AudioRingBuffer::AudioRingBuffer(int ringSamples, int bufferSamples) :
_nextOutput = _buffer;
};
AudioRingBuffer::AudioRingBuffer(const AudioRingBuffer &otherRingBuffer) {
_ringBufferLengthSamples = otherRingBuffer._ringBufferLengthSamples;
_bufferLengthSamples = otherRingBuffer._bufferLengthSamples;
_started = otherRingBuffer._started;
_shouldBeAddedToMix = otherRingBuffer._shouldBeAddedToMix;
_shouldLoopbackForAgent = otherRingBuffer._shouldLoopbackForAgent;
_buffer = new int16_t[_ringBufferLengthSamples];
memcpy(_buffer, otherRingBuffer._buffer, sizeof(int16_t) * _ringBufferLengthSamples);
_nextOutput = _buffer + (otherRingBuffer._nextOutput - otherRingBuffer._buffer);
_endOfLastWrite = _buffer + (otherRingBuffer._endOfLastWrite - otherRingBuffer._buffer);
}
AudioRingBuffer::~AudioRingBuffer() {
delete[] _buffer;
};
AudioRingBuffer* AudioRingBuffer::clone() const {
return new AudioRingBuffer(*this);
}
const int AGENT_LOOPBACK_MODIFIER = 307;
int AudioRingBuffer::parseData(unsigned char* sourceBuffer, int numBytes) {

View file

@ -22,10 +22,8 @@ class AudioRingBuffer : public AgentData {
public:
AudioRingBuffer(int ringSamples, int bufferSamples);
~AudioRingBuffer();
AudioRingBuffer(const AudioRingBuffer &otherRingBuffer);
int parseData(unsigned char* sourceBuffer, int numBytes);
AudioRingBuffer* clone() const;
int16_t* getNextOutput() const { return _nextOutput; }
void setNextOutput(int16_t* nextOutput) { _nextOutput = nextOutput; }
@ -48,6 +46,10 @@ public:
short diffLastWriteNextOutput();
private:
// disallow copying of AudioRingBuffer objects
AudioRingBuffer(const AudioRingBuffer&);
AudioRingBuffer& operator= (const AudioRingBuffer&);
int _ringBufferLengthSamples;
int _bufferLengthSamples;
Position _position;