Classes to produce a computed sound wave on the analog output.
Dependents: SoundWaveGeneratorTest SoundWaveGeneratorTest
WaveCombo.h
00001 #ifndef WAVE_COMBO_H_ 00002 #define WAVE_COMBO_H_ 00003 00004 #include "snd_wave_generator/Wave.h" 00005 #include <vector> 00006 00007 namespace snd_wave_generator { 00008 00009 /** 00010 * @brief A class that produces a wave that results of the combination of multiple waves. 00011 * The combined wave does not buffer itself (as it does not know the length of the combined cycle. 00012 * During preparation phase, it invokes the prepare() method of its contained waves. 00013 */ 00014 class WaveCombo : public Wave { 00015 public: 00016 WaveCombo(Wave *wave = NULL) : waves(), numWaves(0) 00017 { 00018 add(wave); 00019 } 00020 00021 WaveCombo & add(Wave *wave); 00022 00023 virtual void prepare(std::size_t sampleRate); 00024 virtual float read(std::size_t pos) const; 00025 00026 private: 00027 std::vector<Wave*> waves; 00028 float numWaves; 00029 }; 00030 00031 } // snd_wave_generator 00032 00033 #endif // WAVE_COMBO_H_
Generated on Wed Jul 13 2022 01:41:32 by 1.7.2