теперь работает MIDI Pitch Bend с диапазоном +- 2 полутона

This commit is contained in:
2026-11-15 00:47:07 +06:00
parent 2cff003e4b
commit 6773949803
9 changed files with 139 additions and 39 deletions
+20
View File
@@ -3,6 +3,7 @@
#include <cstdint>
#include <array>
#include <cmath>
#include "../include/spsc_queue.hpp"
#include "../include/command.hpp"
@@ -11,21 +12,40 @@
class Synth {
public:
Synth(){
pitch_bend_range = 2.0;
pitch_semitones = 0.0;
pitch_multiplier = 1.0;
stolen_voices = 0;
}
StereoSample generate();
void generate_buffer(double* array, int size);
void set_frequency(double value);
void set_amplitude(double value);
void set_midi_note(uint8_t note);
void pitch_bend(uint16_t value);
double pitch_to_semitones(uint16_t value);
double semitones_to_multiplier(double semitones);
bool note_on(uint8_t note, uint8_t velocity);
bool note_off(uint8_t note);
private:
Voice* find_free_voice();
Voice* find_quietest_voice();
SpscQueue queue;
double pitch_bend_range;
double pitch_semitones;
double pitch_multiplier;
uint64_t stolen_voices;
std::array<Voice, 8> voices;
};