небольшое обновление
This commit is contained in:
@@ -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
@@ -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";
|
||||||
|
|||||||
Reference in New Issue
Block a user