2026-11-12 16:34:18 +06:00
|
|
|
#include <iostream>
|
2026-11-12 20:19:00 +06:00
|
|
|
#include <stdexcept>
|
2026-11-12 16:34:18 +06:00
|
|
|
|
|
|
|
|
#include "../include/synth.hpp"
|
2026-11-12 20:19:00 +06:00
|
|
|
#include "../include/audio_engine.hpp"
|
2026-11-12 16:34:18 +06:00
|
|
|
|
|
|
|
|
int main(){
|
|
|
|
|
|
2026-11-12 20:19:00 +06:00
|
|
|
std::cout << "110.гц\n";
|
2026-11-12 20:58:48 +06:00
|
|
|
std::string a = "";
|
2026-11-12 16:34:18 +06:00
|
|
|
Synth synth;
|
2026-11-12 20:19:00 +06:00
|
|
|
synth.set_frequency(110);
|
2026-11-12 16:34:18 +06:00
|
|
|
synth.set_amplitude(0.5);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-11-12 20:19:00 +06:00
|
|
|
try{
|
|
|
|
|
AudioEngine audio_engine(synth);
|
2026-11-12 20:58:48 +06:00
|
|
|
while (true){
|
|
|
|
|
std::cin >> a;
|
|
|
|
|
if (a == "start"){
|
|
|
|
|
audio_engine.start();
|
|
|
|
|
}
|
|
|
|
|
else audio_engine.stop();
|
|
|
|
|
}
|
2026-11-12 20:19:00 +06:00
|
|
|
}
|
|
|
|
|
catch (const std::exception& error){
|
|
|
|
|
std::cerr << error.what() << "\n";
|
|
|
|
|
return 1;
|
2026-11-12 16:34:18 +06:00
|
|
|
}
|
|
|
|
|
|
2026-11-12 20:19:00 +06:00
|
|
|
|
2026-11-12 16:34:18 +06:00
|
|
|
return 0;
|
|
|
|
|
}
|