load an actual denoising model

This commit is contained in:
2025-10-27 22:53:42 -06:00
parent ebcf5ce4ce
commit 1ff302816e
8 changed files with 192 additions and 28 deletions
+17 -7
View File
@@ -1,16 +1,15 @@
use crate::app::Command;
use crate::effects::{AudioProcessor, AudioProcessorSender};
use color_eyre::eyre::{eyre, Error};
use color_eyre::eyre::{eyre, Context, Error};
use cpal::traits::{DeviceTrait, HostTrait};
use dioxus::hooks::{UnboundedReceiver, UnboundedSender};
use dioxus::hooks::UnboundedReceiver;
use futures::io::{AsyncRead, AsyncWrite};
use mumble_protocol::control::{ClientControlCodec, ControlPacket};
use mumble_protocol::Serverbound;
use mumble_protocol::control::ClientControlCodec;
use mumble_web2_common::ClientConfig;
use std::mem::replace;
use std::net::ToSocketAddrs;
use std::sync::Arc;
use std::sync::Mutex;
use std::{fmt, io, sync::Arc};
use tokio::net::TcpStream;
use tokio_rustls::rustls;
use tokio_rustls::rustls::client::danger::{HandshakeSignatureValid, ServerCertVerifier};
@@ -19,8 +18,9 @@ use tokio_rustls::rustls::ClientConfig as RlsClientConfig;
use tokio_rustls::rustls::DigitallySignedStruct;
use tokio_rustls::TlsConnector;
use tokio_util::compat::{TokioAsyncReadCompatExt as _, TokioAsyncWriteCompatExt as _};
use tracing::{debug, error, info, instrument, warn};
use tracing::{error, info, instrument, warn};
pub use tokio::runtime::Handle as SpawnHandle;
pub use tokio::task::spawn;
pub use tokio::time::sleep;
@@ -70,7 +70,7 @@ impl AudioSystem {
) -> Result<(), Error> {
let mut encoder =
opus::Encoder::new(SAMPLE_RATE, opus::Channels::Mono, opus::Application::Voip)?;
let mut current_processor = AudioProcessor::default();
let mut current_processor = AudioProcessor::new_plain();
let mut output_buffer = Vec::new();
let processors = self.processors.clone();
let error_callback = move |e: cpal::StreamError| error!("error recording: {e:?}");
@@ -311,3 +311,13 @@ pub fn init_logging() {
.with_env_filter(env_filter)
.init();
}
// TODO: once we update to dioxus 0.7, swap this out with the dioxus-asset-resolver crate
pub async fn read_asset_bytes(asset: &dioxus::prelude::Asset) -> color_eyre::Result<Vec<u8>> {
let cur_exe = std::env::current_exe().unwrap();
let path = cur_exe
.parent()
.unwrap()
.join(asset.to_string().trim_matches('/'));
Ok(std::fs::read(&path).with_context(|| format!("native path \"{}\"", path.display()))?)
}