небольшое обновление
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
#define AUDIO_ENGINE
|
||||
|
||||
#include <stdexcept>
|
||||
#include <iostream>
|
||||
#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);
|
||||
|
||||
+7
-2
@@ -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);
|
||||
while (true){
|
||||
std::cin >> a;
|
||||
if (a == "start"){
|
||||
audio_engine.start();
|
||||
std::cin.get();
|
||||
audio_engine.stop();
|
||||
}
|
||||
else audio_engine.stop();
|
||||
}
|
||||
}
|
||||
catch (const std::exception& error){
|
||||
std::cerr << error.what() << "\n";
|
||||
|
||||
Reference in New Issue
Block a user