From 9a2e02e1eeab5ad46f8758102250b6026fa153bc Mon Sep 17 00:00:00 2001 From: pjht Date: Wed, 31 Jan 2024 10:45:30 -0600 Subject: [PATCH] Initialize audio thread in UI init function --- src/main.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main.rs b/src/main.rs index 6276ab5..4637a66 100644 --- a/src/main.rs +++ b/src/main.rs @@ -7,9 +7,9 @@ mod window; mod state; mod option_window; -use std::{collections::HashMap, sync::mpsc::Sender}; +use std::collections::HashMap; -use audio::{AudioMessage, AudioThread}; +use audio::AudioThread; use eframe::{ egui::{self, menu, Button, Ui}, NativeOptions, @@ -25,11 +25,10 @@ use crate::frontpanel::Frontpanel; fn main() -> Result<(), eframe::Error> { env_logger::init(); - let audio_tx = AudioThread::init(); eframe::run_native( "Altair 8800 Emulator", NativeOptions::default(), - Box::new(|cc| Box::new(AltairEmulator::new(cc, audio_tx))), + Box::new(|cc| Box::new(AltairEmulator::new(cc))), ) } @@ -59,7 +58,8 @@ struct AltairEmulator { impl AltairEmulator { - fn new(cc: &eframe::CreationContext<'_>, audio_tx: Sender) -> Self { + fn new(cc: &eframe::CreationContext<'_>) -> Self { + let audio_tx = AudioThread::init(); let options = if cc.storage.unwrap().get_string("options").is_none() { Options::default() } else {