chore(main): add flag that enables audio
This commit is contained in:
parent
4658a0d106
commit
b10bc7b4fd
|
@ -12,6 +12,7 @@ use winit::window::{Window, WindowBuilder};
|
||||||
use winit_input_helper::WinitInputHelper;
|
use winit_input_helper::WinitInputHelper;
|
||||||
|
|
||||||
const WINDOW_SCALE: f64 = 2.0;
|
const WINDOW_SCALE: f64 = 2.0;
|
||||||
|
const AUDIO_ENABLED: bool = true;
|
||||||
|
|
||||||
fn main() -> Result<()> {
|
fn main() -> Result<()> {
|
||||||
let app = App::new(crate_name!())
|
let app = App::new(crate_name!())
|
||||||
|
@ -63,6 +64,7 @@ fn main() -> Result<()> {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Initialize Audio
|
// Initialize Audio
|
||||||
|
if AUDIO_ENABLED {
|
||||||
let spsc: AudioSPSC<f32> = Default::default();
|
let spsc: AudioSPSC<f32> = Default::default();
|
||||||
let (prod, cons) = spsc.init();
|
let (prod, cons) = spsc.init();
|
||||||
let (_stream, stream_handle) = OutputStream::try_default().expect("Initialized Audio");
|
let (_stream, stream_handle) = OutputStream::try_default().expect("Initialized Audio");
|
||||||
|
@ -73,6 +75,7 @@ fn main() -> Result<()> {
|
||||||
std::thread::spawn(move || {
|
std::thread::spawn(move || {
|
||||||
sink.sleep_until_end();
|
sink.sleep_until_end();
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
let mut start = Instant::now();
|
let mut start = Instant::now();
|
||||||
let frame_time = Duration::from_secs_f64(1.0 / 59.73); // 59.73 Hz on Host
|
let frame_time = Duration::from_secs_f64(1.0 / 59.73); // 59.73 Hz on Host
|
||||||
|
|
Loading…
Reference in New Issue