полифония!

на данном этапе:
1. 8 полифонических голосов
2. ADSR огибающая для каждого голоса
3. MIDI Note On/Note Off
4. стереовыход
5. Equal-Power Panning
6. случайное распределение голосов по стереополю
This commit is contained in:
2026-11-14 20:37:48 +06:00
parent b4629fe2d3
commit 2cff003e4b
12 changed files with 127 additions and 75 deletions
+13 -1
View File
@@ -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