Skip to content

Commit

Permalink
Fix serde feature errors (#101)
Browse files Browse the repository at this point in the history
  • Loading branch information
MyBlackMIDIScore authored Aug 25, 2024
1 parent 03bd55f commit f43a7c0
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 5 deletions.
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

0 comments on commit f43a7c0

Please sign in to comment.