UI controls in emulator
This commit is contained in:
@@ -17,6 +17,12 @@
|
||||
*/
|
||||
class SynthEngine {
|
||||
public:
|
||||
enum Waveform {
|
||||
SAWTOOTH,
|
||||
SQUARE,
|
||||
SINE
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Constructs the synthesizer engine.
|
||||
* @param sampleRate The audio sample rate in Hz (e.g., 44100).
|
||||
@@ -36,10 +42,24 @@ public:
|
||||
*/
|
||||
void setFrequency(float freq);
|
||||
|
||||
/**
|
||||
* @brief Sets the output volume.
|
||||
* @param vol Volume from 0.0 (silent) to 1.0 (full).
|
||||
*/
|
||||
void setVolume(float vol);
|
||||
|
||||
/**
|
||||
* @brief Sets the oscillator's waveform.
|
||||
* @param form The waveform to use.
|
||||
*/
|
||||
void setWaveform(Waveform form);
|
||||
|
||||
private:
|
||||
uint32_t _sampleRate;
|
||||
uint32_t _phase; // Phase accumulator for the oscillator.
|
||||
uint32_t _increment; // Phase increment per sample, determines frequency.
|
||||
float _volume;
|
||||
Waveform _waveform;
|
||||
};
|
||||
|
||||
#endif // SYNTH_ENGINE_H
|
||||
Reference in New Issue
Block a user