Classes to produce a computed sound wave on the analog output.

Dependents:   SoundWaveGeneratorTest SoundWaveGeneratorTest

snd_wave_generator/Wave.h

Committer:
osmeest
Date:
2011-02-08
Revision:
1:6864fd480178
Parent:
0:ed89ef772e92

File content as of revision 1:6864fd480178:

#ifndef WAVE_H_
#define WAVE_H_

#include <cstddef>

namespace snd_wave_generator {

/**
 * @brief Interface of a playable sound wave.
 * Waves are processed in two phases.
 * Before sending out signal, the wave is "prepared" for the generator sample rate.
 * Once the preparation is done, the generator will repeatedly "read" the wave samples.
 * The sample position is measured in samples.
 */
class Wave {
public:
    virtual void prepare(std::size_t sampleRate) = 0;
    virtual float read(std::size_t pos) const = 0;
};

} // snd_wave_generator

#endif // WAVE_H_