30 #include "../../system/simplethreadhandler.h"
54 Envelope(
double attack=0,
double decay=0,
55 double sustain=0,
double release=0,
117 virtual void init (
int sampleRate,
int channels)
override final;
125 const double frequency,
128 const bool waitforcomputation =
false,
129 const bool stereo =
true);
169 #endif // SYNTHESIZER_H
int stage
1=attack 2=decay 3=sustain 4=release.
double sustain
Sustain level.
std::vector< PCMDataType > PacketType
Type definition of a PCM packet (vector of PCM values).
int_fast64_t clock
Running time in sample cycles.
double leftamplitude
Left stereo volume.
std::vector< Tone > mPlayingTones
Chord defined as a collection of tones.
Abstract base class for sound-producing software components which transmit data to the AudioPlayerAda...
bool isPlaying(const int id) const
Check whether a sound with given id is still playing.
int keynumber
Identification tag (negativ=sine)
const Tone * getSoundPointer(const int id) const
Get a pointer to the sound according to the given ID.
Envelope(double attack=0, double decay=0, double sustain=0, double release=0, double hammer=0)
Envelope::Envelope.
double rightamplitude
Right stereo volume.
std::vector< double > mReverbL
int mNumberOfKeys
Number of keys, passed in init()
WaveformGenerator mWaveformGenerator
void playSound(const int id, const double frequency, const double volume, const Envelope &env, const bool waitforcomputation=false, const bool stereo=true)
Function which plays a single note (sound)
FFTRealVector mHammerWaveRight
std::vector< double > mReverbR
Reverb.
Waveform mSineWave
Sine wave vector, computed in init().
static const std::vector< std::vector< int > > mHammerKnockFFT
Hammerknock Fourier data.
double decay
Subsequent decay rate.
Synthesizer()
Constructor, intitializes the member variables.
std::mutex mPlayingMutex
Mutex to protect access to the chord.
virtual void exit() overridefinal
Exit, shut down writer interface.
double phaseshift
Stereo phase shift.
double attack
Initial attack rate.
WaveformGenerator::Waveform Waveform
virtual bool generateAudioSignal(AudioBase::PacketType &outputPacket) overridefinal
Generate waveform.
void releaseSound(const int id)
Terminate a sound.
const int_fast64_t SineLength
sine value buffer length.
void updateIntensity()
Update function to update intensity.
void setNumberOfKeys(int numberOfKeys)
Tell the synthesizer to change the total number of keys.
Envelope envelope
Dynamic properties of the tone.
double frequency
Fundamental frequency.
std::vector< FFTRealType > FFTRealVector
double hammer
Intensity of hammer noise.
void preCalculateWaveform(const int id, const Spectrum &spectrum)
Pre-calculate the PCM waveform of a sound.
void ModifySustainLevel(const int id, const double level)
Change the level (sustain level) of a constantly playing sound.
std::map< double, double > Spectrum
double release
Release rate.
virtual void init(int sampleRate, int channels) overridefinal
Initialize and start the synthesizer.
const double CutoffVolume
Fade-out volume cutoff.
Structure describing the envelope (dynamics) of a sound.
WaveformGenerator::Waveform waveform
Copy of the waveform.
FFTRealVector mHammerWaveLeft
Hammer noise, computed in init().
double amplitude
current envelope amplitude
Structure of a single tone.