Skip to content

Commit a9301ec

Browse files
Fix serde feature errors (#101)
1 parent ea6e494 commit a9301ec

File tree

5 files changed

+26
-5
lines changed

5 files changed

+26
-5
lines changed

core/src/channel/event.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ pub enum KeyNoteEvent {
2424
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
2525
pub enum ChannelConfigEvent {
2626
/// Sets the soundfonts for the channel
27+
#[cfg_attr(feature = "serde", serde(skip))]
2728
SetSoundfonts(Vec<Arc<dyn SoundfontBase>>),
2829

2930
/// Sets the layer count for the soundfont

core/src/channel/mod.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,11 @@ impl ControlEventData {
118118

119119
/// Options for initializing a new VoiceChannel.
120120
#[derive(Clone, Copy, Debug, PartialEq)]
121-
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
121+
#[cfg_attr(
122+
feature = "serde",
123+
derive(serde::Deserialize, serde::Serialize),
124+
serde(default)
125+
)]
122126
pub struct ChannelInitOptions {
123127
/// If set to true, the voices killed due to the voice limit will fade out.
124128
/// If set to false, they will be killed immediately, usually causing clicking

core/src/channel_group/config.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,11 @@ pub enum ThreadCount {
4444
/// render very small sample counts each time (e.g. sub 1 millisecond), not using per-key
4545
/// multithreading becomes more efficient.
4646
#[derive(Clone, Copy, Debug, PartialEq)]
47-
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
47+
#[cfg_attr(
48+
feature = "serde",
49+
derive(serde::Deserialize, serde::Serialize),
50+
serde(default)
51+
)]
4852
pub struct ParallelismOptions {
4953
/// Render the MIDI channels parallel in a threadpool with the specified
5054
/// thread count.

core/src/soundfont/config.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,11 @@ pub enum EnvelopeCurveType {
2929

3030
/// Options for the curves of a specific envelope.
3131
#[derive(Clone, Copy, Debug, PartialEq)]
32-
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
32+
#[cfg_attr(
33+
feature = "serde",
34+
derive(serde::Deserialize, serde::Serialize),
35+
serde(default)
36+
)]
3337
pub struct EnvelopeOptions {
3438
/// Controls the type of curve of the attack envelope stage. See the
3539
/// documentation of the `EnvelopeCurveType` enum for available options.
@@ -62,7 +66,11 @@ impl Default for EnvelopeOptions {
6266

6367
/// Options for initializing/loading a new sample soundfont.
6468
#[derive(Clone, Copy, Debug, PartialEq)]
65-
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
69+
#[cfg_attr(
70+
feature = "serde",
71+
derive(serde::Deserialize, serde::Serialize),
72+
serde(default)
73+
)]
6674
pub struct SoundfontInitOptions {
6775
/// The bank number (0-128) to extract and use from the soundfont.
6876
/// `None` means to use all available banks (bank 0 for SFZ).

realtime/src/config.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ pub use xsynth_core::{
66

77
/// Options for initializing a new RealtimeSynth.
88
#[derive(Clone, Debug, PartialEq)]
9-
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
9+
#[cfg_attr(
10+
feature = "serde",
11+
derive(serde::Deserialize, serde::Serialize),
12+
serde(default)
13+
)]
1014
pub struct XSynthRealtimeConfig {
1115
/// Channel initialization options (same for all channels).
1216
/// See the `ChannelInitOptions` documentation for more information.

0 commit comments

Comments
 (0)