Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: SoundWaveGeneratorTest SoundWaveGeneratorTest
Diff: snd_wave_generator/WaveCombo.h
- Revision:
- 0:ed89ef772e92
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/snd_wave_generator/WaveCombo.h Mon Jan 24 22:44:39 2011 +0000
@@ -0,0 +1,33 @@
+#ifndef WAVE_COMBO_H_
+#define WAVE_COMBO_H_
+
+#include "snd_wave_generator/Wave.h"
+#include <vector>
+
+namespace snd_wave_generator {
+
+/**
+ * @brief A class that produces a wave that results of the combination of multiple waves.
+ * The combined wave does not buffer itself (as it does not know the length of the combined cycle.
+ * During preparation phase, it invokes the prepare() method of its contained waves.
+ */
+class WaveCombo : public Wave {
+public:
+ WaveCombo(Wave *wave = NULL) : waves(), numWaves(0)
+ {
+ add(wave);
+ }
+
+ WaveCombo & add(Wave *wave);
+
+ virtual void prepare(std::size_t sampleRate);
+ virtual float read(std::size_t pos) const;
+
+private:
+ std::vector<Wave*> waves;
+ float numWaves;
+};
+
+} // snd_wave_generator
+
+#endif // WAVE_COMBO_H_
\ No newline at end of file