Files
osc/include/voice.hpp
T
s13bby 2cff003e4b полифония!
на данном этапе:
1. 8 полифонических голосов
2. ADSR огибающая для каждого голоса
3. MIDI Note On/Note Off
4. стереовыход
5. Equal-Power Panning
6. случайное распределение голосов по стереополю
2026-11-14 20:37:48 +06:00

49 lines
776 B
C++

#ifndef VOICE
#define VOICE
#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);
StereoSample generate();
bool is_active() const;
bool is_playing(uint8_t note_) const;
private:
Envelope envelope;
Oscillator oscillator;
uint8_t note;
double envelope_value;
double pan;
bool active;
};
#endif