From 4d33c895130847f98b4b042f5da146fe1cbe3d60 Mon Sep 17 00:00:00 2001 From: Kaydax Date: Sun, 15 Sep 2024 00:40:47 -0400 Subject: [PATCH] Bump xsynth to 0.3.1, Remove deprecated options (#69) --- Cargo.lock | 14 +++++++------- Cargo.toml | 6 +++--- src/audio_playback/xsynth.rs | 18 +++++++++++------- src/gui/window/xsynth_settings.rs | 4 ---- src/settings/migrations.rs | 2 -- src/settings/mod.rs | 15 --------------- 6 files changed, 21 insertions(+), 38 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8fb7117..b1021f7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1774,7 +1774,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c2a198fb6b0eada2a8df47933734e6d35d350665a33a3593d7164fa52c75c19" dependencies = [ "cfg-if", - "windows-targets 0.48.5", + "windows-targets 0.52.6", ] [[package]] @@ -4381,9 +4381,9 @@ checksum = "ec7a2a501ed189703dba8b08142f057e887dfc4b2cc4db2d343ac6376ba3e0b9" [[package]] name = "xsynth-core" -version = "0.2.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fa2617eb4a2625d57d1671be6c5c32cb80ced9ca4cd8350e36199a3fccd8590" +checksum = "dae271d1273f7b89fa64dea59aa1ac2118ff10e45bc68534ec90af1ebf2b922a" dependencies = [ "atomic_refcell", "biquad", @@ -4402,9 +4402,9 @@ dependencies = [ [[package]] name = "xsynth-realtime" -version = "0.2.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "351bbb233badd6e09d91d83c0c3e38f1dc6f3cf74adc4228645a5adea0ddc788" +checksum = "f9aff201315141cc7b717110be1423dc1c39903159ebfbfda1b9170d4a83b337" dependencies = [ "atomic_refcell", "bytemuck", @@ -4421,9 +4421,9 @@ dependencies = [ [[package]] name = "xsynth-soundfonts" -version = "0.2.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ad43da58a8c4d3f3d971c3bb60d2fbf24f27aa86e4839d4dca2d8bd95175660" +checksum = "ec960ddf8437cf3711aee93e6b5e29c8c52dda57521ee5bfa3b13da4ca4a35bf" dependencies = [ "encoding_rs", "encoding_rs_io", diff --git a/Cargo.toml b/Cargo.toml index 46a2210..1b5af1e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,9 +15,9 @@ kdmapi = { git = "https://github.com/arduano/kdmapi.git", rev = "4116b00" } egui = "0.21.0" winit = "0.28.3" rayon = "1.7.0" -midi-toolkit-rs ="0.1.0" -xsynth-core = "0.2.0" -xsynth-realtime = "0.2.0" +midi-toolkit-rs = "0.1.0" +xsynth-core = "0.3.1" +xsynth-realtime = "0.3.1" gen-iter = { git = "https://github.com/arduano/gen-iter.git", rev = "64e28bc" } enum_dispatch = "0.3.11" palette = "0.7.1" diff --git a/src/audio_playback/xsynth.rs b/src/audio_playback/xsynth.rs index e374176..fda330d 100644 --- a/src/audio_playback/xsynth.rs +++ b/src/audio_playback/xsynth.rs @@ -7,12 +7,13 @@ use std::{ use crate::WasabiSettings; use xsynth_core::{ - channel::{ChannelConfigEvent, ChannelInitOptions}, - soundfont::{SampleSoundfont, SoundfontBase, SoundfontInitOptions}, + channel::{ChannelConfigEvent, ChannelEvent, ChannelInitOptions}, + soundfont::{EnvelopeOptions, SampleSoundfont, SoundfontBase, SoundfontInitOptions}, AudioStreamParams, }; use xsynth_realtime::{ - RealtimeEventSender, RealtimeSynth, RealtimeSynthStatsReader, ThreadCount, XSynthRealtimeConfig, + RealtimeEventSender, RealtimeSynth, RealtimeSynthStatsReader, SynthEvent, ThreadCount, + XSynthRealtimeConfig, }; #[repr(transparent)] @@ -88,7 +89,9 @@ impl XSynthPlayer { pub fn set_layer_count(&mut self, layers: Option) { self.sender - .send_config(ChannelConfigEvent::SetLayerCount(layers)); + .send_event(SynthEvent::AllChannels(ChannelEvent::Config( + ChannelConfigEvent::SetLayerCount(layers), + ))); } pub fn set_soundfont(&mut self, path: &str, options: SoundfontInitOptions) { @@ -97,7 +100,9 @@ impl XSynthPlayer { if let Ok(sf) = samplesf { let soundfont: Arc = Arc::new(sf); self.sender - .send_config(ChannelConfigEvent::SetSoundfonts(vec![soundfont])); + .send_event(SynthEvent::AllChannels(ChannelEvent::Config( + ChannelConfigEvent::SetSoundfonts(vec![soundfont]), + ))); } } } @@ -105,7 +110,7 @@ impl XSynthPlayer { pub fn convert_to_sf_init(settings: &WasabiSettings) -> SoundfontInitOptions { SoundfontInitOptions { - linear_release: settings.synth.linear_envelope, + vol_envelope_options: EnvelopeOptions::default(), use_effects: settings.synth.use_effects, ..Default::default() } @@ -114,6 +119,5 @@ pub fn convert_to_sf_init(settings: &WasabiSettings) -> SoundfontInitOptions { pub fn convert_to_channel_init(settings: &WasabiSettings) -> ChannelInitOptions { ChannelInitOptions { fade_out_killing: settings.synth.fade_out_kill, - ..Default::default() } } diff --git a/src/gui/window/xsynth_settings.rs b/src/gui/window/xsynth_settings.rs index 8c40033..7a12399 100644 --- a/src/gui/window/xsynth_settings.rs +++ b/src/gui/window/xsynth_settings.rs @@ -134,10 +134,6 @@ pub fn draw_xsynth_settings( ui.checkbox(&mut settings.synth.fade_out_kill, ""); ui.end_row(); - ui.label("Linear release envelope*: "); - ui.checkbox(&mut settings.synth.linear_envelope, ""); - ui.end_row(); - ui.label("Use Effects*: "); ui.checkbox(&mut settings.synth.use_effects, ""); ui.end_row(); diff --git a/src/settings/migrations.rs b/src/settings/migrations.rs index 249f596..ea63efb 100644 --- a/src/settings/migrations.rs +++ b/src/settings/migrations.rs @@ -20,7 +20,6 @@ pub struct WasabiConfigFileV0 { limit_layers: bool, layer_count: usize, fade_out_kill: bool, - linear_envelope: bool, use_effects: bool, vel_ignore_lo: u8, vel_ignore_hi: u8, @@ -44,7 +43,6 @@ impl WasabiConfigFileV0 { limit_layers: cfg.limit_layers, layer_count: cfg.layer_count, fade_out_kill: cfg.fade_out_kill, - linear_envelope: cfg.linear_envelope, use_effects: cfg.use_effects, sfz_path: cfg.sfz_path, vel_ignore: cfg.vel_ignore_lo..=cfg.vel_ignore_hi, diff --git a/src/settings/mod.rs b/src/settings/mod.rs index d1dd951..58f8923 100644 --- a/src/settings/mod.rs +++ b/src/settings/mod.rs @@ -297,7 +297,6 @@ pub struct SynthSettings { #[serde(with = "range_serde")] pub vel_ignore: RangeInclusive, pub fade_out_kill: bool, - pub linear_envelope: bool, pub use_effects: bool, } @@ -312,7 +311,6 @@ impl Default for SynthSettings { layer_count: 4, vel_ignore: 0..=0, fade_out_kill: ChannelInitOptions::default().fade_out_killing, - linear_envelope: SoundfontInitOptions::default().linear_release, use_effects: SoundfontInitOptions::default().use_effects, } } @@ -453,18 +451,6 @@ impl WasabiSettings { .long("fade-out-kill") .action(ArgAction::SetTrue), ) - .arg( - Arg::new("linear-envelope") - .help("Adjust the rate of decay on the synth's voices") - .long_help( - "Switch the synth's voice's rate of decay from \ - exponential to linear. This may be bring a performance \ - improvement on some systems.", - ) - .short('L') - .long("linear-envelope") - .action(ArgAction::SetTrue), - ) .arg( Arg::new("no-effects") .help("Disables the soundfont's effects") @@ -617,7 +603,6 @@ impl WasabiSettings { set!(synth.layer_count, "layer-count"); set_owned!(synth.vel_ignore, "vel-ignore", RangeInclusive); set_flag!(synth.fade_out_kill, "fade-out-kill"); - set_flag!(synth.linear_envelope, "linear-envelope"); set_flag!(synth.use_effects, "no-effects"); // MIDI settings