небольшое обновление

This commit is contained in:
2026-11-12 20:58:48 +06:00
parent 87e59c84e5
commit c7a3be8e4a
2 changed files with 9 additions and 4 deletions
+1 -1
View File
@@ -2,6 +2,7 @@
#define AUDIO_ENGINE #define AUDIO_ENGINE
#include <stdexcept> #include <stdexcept>
#include <iostream>
#include "../external/miniaudio.h" #include "../external/miniaudio.h"
#include "../include/synth.hpp" #include "../include/synth.hpp"
@@ -22,7 +23,6 @@ class AudioEngine{
else{ else{
throw std::runtime_error("ошибка: не удалось проинициализировать девайс"); throw std::runtime_error("ошибка: не удалось проинициализировать девайс");
} }
} }
~AudioEngine(){ ~AudioEngine(){
if (device_is_init) ma_device_uninit(&device); if (device_is_init) ma_device_uninit(&device);
+7 -2
View File
@@ -7,6 +7,7 @@
int main(){ int main(){
std::cout << "110.гц\n"; std::cout << "110.гц\n";
std::string a = "";
Synth synth; Synth synth;
synth.set_frequency(110); synth.set_frequency(110);
synth.set_amplitude(0.5); synth.set_amplitude(0.5);
@@ -15,9 +16,13 @@ int main(){
try{ try{
AudioEngine audio_engine(synth); AudioEngine audio_engine(synth);
while (true){
std::cin >> a;
if (a == "start"){
audio_engine.start(); audio_engine.start();
std::cin.get(); }
audio_engine.stop(); else audio_engine.stop();
}
} }
catch (const std::exception& error){ catch (const std::exception& error){
std::cerr << error.what() << "\n"; std::cerr << error.what() << "\n";