From c7a3be8e4ad6473ac30a43ecbcc03720961eacc9 Mon Sep 17 00:00:00 2001 From: s13bby Date: Thu, 12 Nov 2026 20:58:48 +0600 Subject: [PATCH] =?UTF-8?q?=D0=BD=D0=B5=D0=B1=D0=BE=D0=BB=D1=8C=D1=88?= =?UTF-8?q?=D0=BE=D0=B5=20=D0=BE=D0=B1=D0=BD=D0=BE=D0=B2=D0=BB=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/audio_engine.hpp | 2 +- src/main.cpp | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/include/audio_engine.hpp b/include/audio_engine.hpp index 03c197b..4e83c3e 100644 --- a/include/audio_engine.hpp +++ b/include/audio_engine.hpp @@ -2,6 +2,7 @@ #define AUDIO_ENGINE #include +#include #include "../external/miniaudio.h" #include "../include/synth.hpp" @@ -22,7 +23,6 @@ class AudioEngine{ else{ throw std::runtime_error("ошибка: не удалось проинициализировать девайс"); } - } ~AudioEngine(){ if (device_is_init) ma_device_uninit(&device); diff --git a/src/main.cpp b/src/main.cpp index aaf32ca..12045b0 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -7,6 +7,7 @@ int main(){ std::cout << "110.гц\n"; + std::string a = ""; Synth synth; synth.set_frequency(110); synth.set_amplitude(0.5); @@ -15,9 +16,13 @@ int main(){ try{ AudioEngine audio_engine(synth); - audio_engine.start(); - std::cin.get(); - audio_engine.stop(); + while (true){ + std::cin >> a; + if (a == "start"){ + audio_engine.start(); + } + else audio_engine.stop(); + } } catch (const std::exception& error){ std::cerr << error.what() << "\n";