This commit is contained in:
2026-11-13 23:59:25 +06:00
parent 7d60addcd9
commit 5731475015
6 changed files with 126 additions and 97 deletions
+9 -1
View File
@@ -1,10 +1,18 @@
#ifndef COMMAND
#define COMMAND
enum class Command{
#include <cstdint>
enum class CommandType{
None,
NoteOn,
NoteOff
};
struct Command{
CommandType type;
uint8_t note;
uint8_t velocity;
};
#endif
+3 -3
View File
@@ -13,11 +13,11 @@ class SpscQueue{
SpscQueue(){
head.store(0, std::memory_order_relaxed);
tail.store(0, std::memory_order_relaxed);
buffer.fill(Command::None);
buffer.fill({CommandType::None, 0, 0});
}
bool push(Command command);
bool pop(Command& command);
bool push(const Command&);
bool pop(Command&);
private:
+4 -3
View File
@@ -13,7 +13,7 @@
class Synth {
public:
Synth(){
frequency = 440;
frequency = 440.0;
amplitude = 0.5;
sample_rate = 48000;
phase = 0.0;
@@ -24,9 +24,10 @@ class Synth {
void generate_buffer(double* array, int size);
void set_frequency(double value);
void set_amplitude(double value);
void set_midi_note(uint8_t note);
bool note_on();
bool note_off();
bool note_on(uint8_t note, uint8_t velocity);
bool note_off(uint8_t note);
private:
/* 1. частота звука в Герцах