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

Fix serde feature errors #101

Merged
merged 2 commits into from
Aug 25, 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
1 change: 1 addition & 0 deletions core/src/channel/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ pub enum KeyNoteEvent {
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
pub enum ChannelConfigEvent {
/// Sets the soundfonts for the channel
#[cfg_attr(feature = "serde", serde(skip))]
SetSoundfonts(Vec<Arc<dyn SoundfontBase>>),

/// Sets the layer count for the soundfont
Expand Down
6 changes: 5 additions & 1 deletion core/src/channel/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,11 @@ impl ControlEventData {

/// Options for initializing a new VoiceChannel.
#[derive(Clone, Copy, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
#[cfg_attr(
feature = "serde",
derive(serde::Deserialize, serde::Serialize),
serde(default)
)]
pub struct ChannelInitOptions {
/// If set to true, the voices killed due to the voice limit will fade out.
/// If set to false, they will be killed immediately, usually causing clicking
Expand Down
6 changes: 5 additions & 1 deletion core/src/channel_group/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,11 @@ pub enum ThreadCount {
/// render very small sample counts each time (e.g. sub 1 millisecond), not using per-key
/// multithreading becomes more efficient.
#[derive(Clone, Copy, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
#[cfg_attr(
feature = "serde",
derive(serde::Deserialize, serde::Serialize),
serde(default)
)]
pub struct ParallelismOptions {
/// Render the MIDI channels parallel in a threadpool with the specified
/// thread count.
Expand Down
12 changes: 10 additions & 2 deletions core/src/soundfont/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ pub enum EnvelopeCurveType {

/// Options for the curves of a specific envelope.
#[derive(Clone, Copy, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
#[cfg_attr(
feature = "serde",
derive(serde::Deserialize, serde::Serialize),
serde(default)
)]
pub struct EnvelopeOptions {
/// Controls the type of curve of the attack envelope stage. See the
/// documentation of the `EnvelopeCurveType` enum for available options.
Expand Down Expand Up @@ -62,7 +66,11 @@ impl Default for EnvelopeOptions {

/// Options for initializing/loading a new sample soundfont.
#[derive(Clone, Copy, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
#[cfg_attr(
feature = "serde",
derive(serde::Deserialize, serde::Serialize),
serde(default)
)]
pub struct SoundfontInitOptions {
/// The bank number (0-128) to extract and use from the soundfont.
/// `None` means to use all available banks (bank 0 for SFZ).
Expand Down
6 changes: 5 additions & 1 deletion realtime/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ pub use xsynth_core::{

/// Options for initializing a new RealtimeSynth.
#[derive(Clone, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
#[cfg_attr(
feature = "serde",
derive(serde::Deserialize, serde::Serialize),
serde(default)
)]
pub struct XSynthRealtimeConfig {
/// Channel initialization options (same for all channels).
/// See the `ChannelInitOptions` documentation for more information.
Expand Down
Loading