mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 09:08:47 +02:00
disallow copying for AudioRingBuffer objects
This commit is contained in:
parent
3e65d5a548
commit
fcfe5c9e25
2 changed files with 4 additions and 20 deletions
|
@ -24,28 +24,10 @@ AudioRingBuffer::AudioRingBuffer(int ringSamples, int bufferSamples) :
|
||||||
_nextOutput = _buffer;
|
_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() {
|
AudioRingBuffer::~AudioRingBuffer() {
|
||||||
delete[] _buffer;
|
delete[] _buffer;
|
||||||
};
|
};
|
||||||
|
|
||||||
AudioRingBuffer* AudioRingBuffer::clone() const {
|
|
||||||
return new AudioRingBuffer(*this);
|
|
||||||
}
|
|
||||||
|
|
||||||
const int AGENT_LOOPBACK_MODIFIER = 307;
|
const int AGENT_LOOPBACK_MODIFIER = 307;
|
||||||
|
|
||||||
int AudioRingBuffer::parseData(unsigned char* sourceBuffer, int numBytes) {
|
int AudioRingBuffer::parseData(unsigned char* sourceBuffer, int numBytes) {
|
||||||
|
|
|
@ -22,10 +22,8 @@ class AudioRingBuffer : public AgentData {
|
||||||
public:
|
public:
|
||||||
AudioRingBuffer(int ringSamples, int bufferSamples);
|
AudioRingBuffer(int ringSamples, int bufferSamples);
|
||||||
~AudioRingBuffer();
|
~AudioRingBuffer();
|
||||||
AudioRingBuffer(const AudioRingBuffer &otherRingBuffer);
|
|
||||||
|
|
||||||
int parseData(unsigned char* sourceBuffer, int numBytes);
|
int parseData(unsigned char* sourceBuffer, int numBytes);
|
||||||
AudioRingBuffer* clone() const;
|
|
||||||
|
|
||||||
int16_t* getNextOutput() const { return _nextOutput; }
|
int16_t* getNextOutput() const { return _nextOutput; }
|
||||||
void setNextOutput(int16_t* nextOutput) { _nextOutput = nextOutput; }
|
void setNextOutput(int16_t* nextOutput) { _nextOutput = nextOutput; }
|
||||||
|
@ -48,6 +46,10 @@ public:
|
||||||
|
|
||||||
short diffLastWriteNextOutput();
|
short diffLastWriteNextOutput();
|
||||||
private:
|
private:
|
||||||
|
// disallow copying of AudioRingBuffer objects
|
||||||
|
AudioRingBuffer(const AudioRingBuffer&);
|
||||||
|
AudioRingBuffer& operator= (const AudioRingBuffer&);
|
||||||
|
|
||||||
int _ringBufferLengthSamples;
|
int _ringBufferLengthSamples;
|
||||||
int _bufferLengthSamples;
|
int _bufferLengthSamples;
|
||||||
Position _position;
|
Position _position;
|
||||||
|
|
Loading…
Reference in a new issue