Skip to content

Commit

Permalink
add waveform multiband
Browse files Browse the repository at this point in the history
  • Loading branch information
aizcutei committed May 27, 2024
1 parent ba84a79 commit a6f9260
Show file tree
Hide file tree
Showing 14 changed files with 8,109 additions and 293 deletions.
114 changes: 114 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ rust-version = "1.78"


[dependencies]
egui = {version = "0.27.2", features = ["rayon"]}
egui = { version = "0.27.2", features = ["rayon"] }
eframe = { version = "0.27.2", default-features = false, features = [
"default_fonts",
"glow",
Expand All @@ -21,7 +21,7 @@ env_logger = { version = "0.11", default-features = false, features = [
"auto-color",
"humantime",
] }
cpal = {version = "0.15.3", exclude = ["js-sys"]}
cpal = { version = "0.15.3", exclude = ["js-sys"] }
anyhow = "1.0"
rustfft = "6.2.0"
realfft = "3.3.0"
Expand All @@ -30,7 +30,8 @@ log = "0.4"
rayon = "1.10"
crossbeam-channel = "0.5.12"
puffin = { version = "0.19", optional = true }
puffin_http = {version = "0.16", optional = true}
puffin_http = { version = "0.16", optional = true }
dasp = { version = "0.11.0", features = ["ring_buffer"] }

[features]
default = ["eframe/wgpu"]
Expand Down
22 changes: 17 additions & 5 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,11 @@ impl Default for NanometersApp {
let audio_source_buffer = Arc::new(Mutex::new(AudioSourceBuffer::new()));
let setting = Setting::default();
let audio_source_setting = Arc::new(Mutex::new(setting.clone()));
let mut system_capture =
SystemCapture::new(get_callback(tx.clone(), audio_source_buffer.clone()));
let mut system_capture = SystemCapture::new(get_callback(
tx.clone(),
audio_source_buffer.clone(),
audio_source_setting.clone(),
));
system_capture.start();
let audio_source = Some(Box::new(system_capture) as Box<dyn AudioSource>);

Expand Down Expand Up @@ -96,24 +99,33 @@ impl NanometersApp {
let mut app: NanometersApp =
eframe::get_value(storage, eframe::APP_KEY).unwrap_or_default();
cc.egui_ctx.set_visuals(set_theme(&mut app));
app.audio_source_setting = Arc::new(Mutex::new(app.setting.clone()));
match app.setting.audio_device.device {
AudioDevice::OutputCapture => {
let tx = app.tx.clone().unwrap();
let callback = get_callback(tx, app.audio_source_buffer.clone());
let callback = get_callback(
tx,
app.audio_source_buffer.clone(),
app.audio_source_setting.clone(),
);
let mut system_capture = SystemCapture::new(callback);
system_capture.start();
app.audio_source = Some(Box::new(system_capture) as Box<dyn AudioSource>);
}
AudioDevice::PluginCapture => {
let tx = app.tx.clone().unwrap();
let callback = get_callback(tx, app.audio_source_buffer.clone());
let callback = get_callback(
tx,
app.audio_source_buffer.clone(),
app.audio_source_setting.clone(),
);
let mut plugin_client = PluginClient::new(callback);
plugin_client.start();
app.audio_source = Some(Box::new(plugin_client) as Box<dyn AudioSource>);
}
_ => {}
}
app.audio_source_setting = Arc::new(Mutex::new(app.setting.clone()));

return app;
}
Default::default()
Expand Down
Loading

0 comments on commit a6f9260

Please sign in to comment.