This commit is contained in:
2026-11-13 18:31:07 +06:00
parent 3a16ac0c0e
commit bb258484df
7 changed files with 153 additions and 9 deletions
+29 -2
View File
@@ -1,24 +1,51 @@
#include <iostream>
#include <stdexcept>
#include <thread>
#include <atomic>
#include "../include/synth.hpp"
#include "../include/audio_engine.hpp"
#include "../include/spsc_queue.hpp"
#include "../include/command.hpp"
void producer(SpscQueue& queue, std::atomic<bool>& producer_done){
/*
* формирует последовательность команд;
записывает их через queue.push();
повторяет попытку, если очередь заполнена;
после успешной отправки последней команды устанавливает producer_done = true.
*/
}
void consumer(SpscQueue& queue, std::atomic<bool>& producer_done){
}
int main(){
std::cout << "110.гц\n";
std::string a = "";
Synth synth;
SpscQueue queue;
std::atomic<bool> producer_done;
// std::thread producer();
// std::thread consumer();
synth.set_frequency(110);
synth.set_amplitude(0.5);
try{
AudioEngine audio_engine(synth);
audio_engine.start();
while (true){
std::cout << std::boolalpha
<< "Lock-free: " << std::atomic<Command>{}.is_lock_free()
<< '\n';
std::cin >> a;
if (a == "start"){
synth.note_on();