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

Dependents:   SoundWaveGeneratorTest SoundWaveGeneratorTest

WaveBuffer.cpp

Committer:
osmeest
Date:
2011-01-24
Revision:
0:ed89ef772e92

File content as of revision 0:ed89ef772e92:

#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