Classes to produce a computed sound wave on the analog output.
Dependents: SoundWaveGeneratorTest SoundWaveGeneratorTest
snd_wave_generator/BufferedWave.h@1:6864fd480178, 2011-02-08 (annotated)
- Committer:
- osmeest
- Date:
- Tue Feb 08 21:39:55 2011 +0000
- Revision:
- 1:6864fd480178
- Parent:
- 0:ed89ef772e92
Fix the Sine & Triangle wave computations which were very bad !
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
osmeest | 0:ed89ef772e92 | 1 | #ifndef BUFFERED_WAVE_H_ |
osmeest | 0:ed89ef772e92 | 2 | #define BUFFERED_WAVE_H_ |
osmeest | 0:ed89ef772e92 | 3 | |
osmeest | 0:ed89ef772e92 | 4 | #include "snd_wave_generator/Wave.h" |
osmeest | 0:ed89ef772e92 | 5 | #include "snd_wave_generator/WaveBuffer.h" |
osmeest | 0:ed89ef772e92 | 6 | |
osmeest | 0:ed89ef772e92 | 7 | namespace snd_wave_generator { |
osmeest | 0:ed89ef772e92 | 8 | |
osmeest | 0:ed89ef772e92 | 9 | /** |
osmeest | 0:ed89ef772e92 | 10 | * @brief A base class for Waves which pre-computes their values in a buffer during preparation and play from that buffer. |
osmeest | 0:ed89ef772e92 | 11 | */ |
osmeest | 0:ed89ef772e92 | 12 | class BufferedWave : public Wave { |
osmeest | 0:ed89ef772e92 | 13 | public: |
osmeest | 0:ed89ef772e92 | 14 | BufferedWave() : buffer() { } |
osmeest | 0:ed89ef772e92 | 15 | virtual float read(std::size_t pos) const { return this->buffer.read(pos); } |
osmeest | 0:ed89ef772e92 | 16 | |
osmeest | 0:ed89ef772e92 | 17 | protected: |
osmeest | 0:ed89ef772e92 | 18 | WaveBuffer buffer; |
osmeest | 0:ed89ef772e92 | 19 | }; |
osmeest | 0:ed89ef772e92 | 20 | |
osmeest | 0:ed89ef772e92 | 21 | } // snd_wave_generator |
osmeest | 0:ed89ef772e92 | 22 | |
osmeest | 0:ed89ef772e92 | 23 | #endif // BUFFERED_WAVE_H_ |