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

Wave.h

00001 #ifndef WAVE_H_
00002 #define WAVE_H_
00003 
00004 #include <cstddef>
00005 
00006 namespace snd_wave_generator {
00007 
00008 /**
00009  * @brief Interface of a playable sound wave.
00010  * Waves are processed in two phases.
00011  * Before sending out signal, the wave is "prepared" for the generator sample rate.
00012  * Once the preparation is done, the generator will repeatedly "read" the wave samples.
00013  * The sample position is measured in samples.
00014  */
00015 class Wave {
00016 public:
00017     virtual void prepare(std::size_t sampleRate) = 0;
00018     virtual float read(std::size_t pos) const = 0;
00019 };
00020 
00021 } // snd_wave_generator
00022 
00023 #endif // WAVE_H_