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 TriangleWave.h Source File

TriangleWave.h

00001 #ifndef TRIANGLE_WAVE_H_
00002 #define TRIANGLE_WAVE_H_
00003 
00004 #include "snd_wave_generator/BufferedWave.h"
00005 
00006 namespace snd_wave_generator {
00007 
00008 /**
00009  * @brief A class producing a triangle wave of a given frequency.
00010  */
00011 class TriangleWave : public BufferedWave {
00012 public:
00013     TriangleWave(unsigned freq) : BufferedWave(), frequency(freq) { }
00014 
00015     virtual void prepare(std::size_t sampleRate);
00016     
00017 private:
00018     unsigned frequency;
00019 };
00020 
00021 } // snd_wave_generator
00022 
00023 #endif // TRIANGLE_WAVE_H_