Olivier Smeesters
/
DtmfKit
A DTMF sequence editor and player for HAM radio equipment command & control.
Diff: SoundWaveGenerator/WaveBuffer.cpp
- Revision:
- 0:1324e7d9d471
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SoundWaveGenerator/WaveBuffer.cpp Mon Mar 07 22:51:19 2011 +0000 @@ -0,0 +1,21 @@ +#include "snd_wave_generator/WaveBuffer.h" + +namespace snd_wave_generator { + +void WaveBuffer::resize(std::size_t size) +{ + if (this->capacity_ > 0 && size > this->capacity_) { + delete[] this->data_; + this->data_ = NULL; + this->capacity_ = 0; + } + + if (size > this->capacity_) { + this->data_ = new float[size]; + this->capacity_ = size; + } + + this->size_ = size; +} + +} // snd_wave_generator \ No newline at end of file