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

Dependents:   SoundWaveGeneratorTest SoundWaveGeneratorTest

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers WaveBuffer.cpp Source File

WaveBuffer.cpp

00001 #include "snd_wave_generator/WaveBuffer.h"
00002 
00003 namespace snd_wave_generator {
00004 
00005 void WaveBuffer::resize(std::size_t size)
00006 {
00007     if (this->capacity_ > 0 && size > this->capacity_) {
00008         delete[] this->data_;
00009         this->data_ = NULL;
00010         this->capacity_ = 0;
00011     }
00012     
00013     if (size > this->capacity_) {
00014         this->data_ = new float[size];
00015         this->capacity_ = size;
00016     }
00017     
00018     this->size_ = size;
00019 }
00020 
00021 } // snd_wave_generator