Classes to produce a computed sound wave on the analog output.

Dependents:   SoundWaveGeneratorTest SoundWaveGeneratorTest

WaveBuffer.cpp

Committer:
osmeest
Date:
2011-02-08
Revision:
1:6864fd480178
Parent:
0:ed89ef772e92

File content as of revision 1:6864fd480178:

#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