Olivier Smeesters
/
DtmfKit
A DTMF sequence editor and player for HAM radio equipment command & control.
SoundWaveGenerator/WaveBuffer.cpp@0:1324e7d9d471, 2011-03-07 (annotated)
- Committer:
- osmeest
- Date:
- Mon Mar 07 22:51:19 2011 +0000
- Revision:
- 0:1324e7d9d471
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
osmeest | 0:1324e7d9d471 | 1 | #include "snd_wave_generator/WaveBuffer.h" |
osmeest | 0:1324e7d9d471 | 2 | |
osmeest | 0:1324e7d9d471 | 3 | namespace snd_wave_generator { |
osmeest | 0:1324e7d9d471 | 4 | |
osmeest | 0:1324e7d9d471 | 5 | void WaveBuffer::resize(std::size_t size) |
osmeest | 0:1324e7d9d471 | 6 | { |
osmeest | 0:1324e7d9d471 | 7 | if (this->capacity_ > 0 && size > this->capacity_) { |
osmeest | 0:1324e7d9d471 | 8 | delete[] this->data_; |
osmeest | 0:1324e7d9d471 | 9 | this->data_ = NULL; |
osmeest | 0:1324e7d9d471 | 10 | this->capacity_ = 0; |
osmeest | 0:1324e7d9d471 | 11 | } |
osmeest | 0:1324e7d9d471 | 12 | |
osmeest | 0:1324e7d9d471 | 13 | if (size > this->capacity_) { |
osmeest | 0:1324e7d9d471 | 14 | this->data_ = new float[size]; |
osmeest | 0:1324e7d9d471 | 15 | this->capacity_ = size; |
osmeest | 0:1324e7d9d471 | 16 | } |
osmeest | 0:1324e7d9d471 | 17 | |
osmeest | 0:1324e7d9d471 | 18 | this->size_ = size; |
osmeest | 0:1324e7d9d471 | 19 | } |
osmeest | 0:1324e7d9d471 | 20 | |
osmeest | 0:1324e7d9d471 | 21 | } // snd_wave_generator |