Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump xsynth to 0.3.1, Remove deprecated options #69

Merged
merged 3 commits into from
Sep 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions Cargo.lock

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

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
18 changes: 11 additions & 7 deletions src/audio_playback/xsynth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down Expand Up @@ -88,7 +89,9 @@ impl XSynthPlayer {

pub fn set_layer_count(&mut self, layers: Option<usize>) {
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) {
Expand All @@ -97,15 +100,17 @@ impl XSynthPlayer {
if let Ok(sf) = samplesf {
let soundfont: Arc<dyn SoundfontBase> = Arc::new(sf);
self.sender
.send_config(ChannelConfigEvent::SetSoundfonts(vec![soundfont]));
.send_event(SynthEvent::AllChannels(ChannelEvent::Config(
ChannelConfigEvent::SetSoundfonts(vec![soundfont]),
)));
}
}
}
}

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()
}
Expand All @@ -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()
}
}
4 changes: 0 additions & 4 deletions src/gui/window/xsynth_settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 0 additions & 2 deletions src/settings/migrations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down
15 changes: 0 additions & 15 deletions src/settings/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,6 @@ pub struct SynthSettings {
#[serde(with = "range_serde")]
pub vel_ignore: RangeInclusive<u8>,
pub fade_out_kill: bool,
pub linear_envelope: bool,
pub use_effects: bool,
}

Expand All @@ -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,
}
}
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -617,7 +603,6 @@ impl WasabiSettings {
set!(synth.layer_count, "layer-count");
set_owned!(synth.vel_ignore, "vel-ignore", RangeInclusive<u8>);
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
Expand Down
Loading