Olivier Smeesters
/
DtmfKit
A DTMF sequence editor and player for HAM radio equipment command & control.
SoundWaveGenerator/snd_wave_generator/WaveCombo.h@0:1324e7d9d471, 2011-03-07 (annotated)
- Committer:
- osmeest
- Date:
- Mon Mar 07 22:51:19 2011 +0000
- Revision:
- 0:1324e7d9d471
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
osmeest | 0:1324e7d9d471 | 1 | #ifndef WAVE_COMBO_H_ |
osmeest | 0:1324e7d9d471 | 2 | #define WAVE_COMBO_H_ |
osmeest | 0:1324e7d9d471 | 3 | |
osmeest | 0:1324e7d9d471 | 4 | #include "snd_wave_generator/Wave.h" |
osmeest | 0:1324e7d9d471 | 5 | #include <vector> |
osmeest | 0:1324e7d9d471 | 6 | |
osmeest | 0:1324e7d9d471 | 7 | namespace snd_wave_generator { |
osmeest | 0:1324e7d9d471 | 8 | |
osmeest | 0:1324e7d9d471 | 9 | /** |
osmeest | 0:1324e7d9d471 | 10 | * @brief A class that produces a wave that results of the combination of multiple waves. |
osmeest | 0:1324e7d9d471 | 11 | * The combined wave does not buffer itself (as it does not know the length of the combined cycle. |
osmeest | 0:1324e7d9d471 | 12 | * During preparation phase, it invokes the prepare() method of its contained waves. |
osmeest | 0:1324e7d9d471 | 13 | */ |
osmeest | 0:1324e7d9d471 | 14 | class WaveCombo : public Wave { |
osmeest | 0:1324e7d9d471 | 15 | public: |
osmeest | 0:1324e7d9d471 | 16 | WaveCombo(Wave *wave = NULL) : waves(), numWaves(0) |
osmeest | 0:1324e7d9d471 | 17 | { |
osmeest | 0:1324e7d9d471 | 18 | add(wave); |
osmeest | 0:1324e7d9d471 | 19 | } |
osmeest | 0:1324e7d9d471 | 20 | |
osmeest | 0:1324e7d9d471 | 21 | WaveCombo & add(Wave *wave); |
osmeest | 0:1324e7d9d471 | 22 | |
osmeest | 0:1324e7d9d471 | 23 | virtual void prepare(std::size_t sampleRate); |
osmeest | 0:1324e7d9d471 | 24 | virtual float read(std::size_t pos) const; |
osmeest | 0:1324e7d9d471 | 25 | |
osmeest | 0:1324e7d9d471 | 26 | private: |
osmeest | 0:1324e7d9d471 | 27 | std::vector<Wave*> waves; |
osmeest | 0:1324e7d9d471 | 28 | float numWaves; |
osmeest | 0:1324e7d9d471 | 29 | }; |
osmeest | 0:1324e7d9d471 | 30 | |
osmeest | 0:1324e7d9d471 | 31 | } // snd_wave_generator |
osmeest | 0:1324e7d9d471 | 32 | |
osmeest | 0:1324e7d9d471 | 33 | #endif // WAVE_COMBO_H_ |