полифония!
на данном этапе: 1. 8 полифонических голосов 2. ADSR огибающая для каждого голоса 3. MIDI Note On/Note Off 4. стереовыход 5. Equal-Power Panning 6. случайное распределение голосов по стереополю
This commit is contained in:
+13
-1
@@ -4,24 +4,31 @@
|
||||
#include <cstdint>
|
||||
#include <numbers>
|
||||
#include <cmath>
|
||||
#include <algorithm>
|
||||
#include <random>
|
||||
|
||||
#include "../include/envelope.hpp"
|
||||
#include "../include/oscillator.hpp"
|
||||
#include "../include/stereo_sample.hpp"
|
||||
|
||||
|
||||
class Voice{
|
||||
public:
|
||||
Voice(){
|
||||
note = 0;
|
||||
pan = 0.0;
|
||||
|
||||
active = false;
|
||||
}
|
||||
|
||||
void note_on(uint8_t note, uint8_t velocity);
|
||||
void note_off();
|
||||
void set_pan(double value);
|
||||
|
||||
double generate();
|
||||
StereoSample generate();
|
||||
|
||||
bool is_active() const;
|
||||
bool is_playing(uint8_t note_) const;
|
||||
|
||||
private:
|
||||
Envelope envelope;
|
||||
@@ -29,8 +36,13 @@ class Voice{
|
||||
|
||||
uint8_t note;
|
||||
|
||||
double envelope_value;
|
||||
double pan;
|
||||
|
||||
bool active;
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user