Skip to content

Commit

Permalink
implement all defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
lebedec committed Mar 6, 2022
1 parent 473a718 commit dad2086
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "libfmod"
version = "2.2.301"
version = "2.2.302"
edition = "2021"
license-file = "LICENSE"
description = "A library wrapper for integrating FMOD Engine in Rust applications."
Expand Down
53 changes: 39 additions & 14 deletions src/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1482,6 +1482,16 @@ pub struct FMOD_STUDIO_USER_PROPERTY {
pub union: FMOD_STUDIO_USER_PROPERTY_UNION,
}

impl Default for FMOD_STUDIO_USER_PROPERTY {
fn default() -> Self {
Self {
name: null_mut(),
type_: Default::default(),
union: FMOD_STUDIO_USER_PROPERTY_UNION { intvalue: 0 },
}
}
}

#[repr(C)]
#[derive(Copy, Clone)]
pub union FMOD_STUDIO_USER_PROPERTY_UNION {
Expand All @@ -1491,12 +1501,6 @@ pub union FMOD_STUDIO_USER_PROPERTY_UNION {
pub stringvalue: *const c_char,
}

impl Default for FMOD_STUDIO_USER_PROPERTY {
fn default() -> Self {
unimplemented!()
}
}

#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct FMOD_STUDIO_PROGRAMMER_SOUND_PROPERTIES {
Expand Down Expand Up @@ -2459,6 +2463,20 @@ pub struct FMOD_DSP_PARAMETER_DESC {
pub union: FMOD_DSP_PARAMETER_DESC_UNION,
}

impl Default for FMOD_DSP_PARAMETER_DESC {
fn default() -> Self {
Self {
type_: Default::default(),
name: Default::default(),
label: Default::default(),
description: null_mut(),
union: FMOD_DSP_PARAMETER_DESC_UNION {
floatdesc: Default::default(),
},
}
}
}

#[repr(C)]
#[derive(Copy, Clone)]
pub union FMOD_DSP_PARAMETER_DESC_UNION {
Expand All @@ -2468,12 +2486,6 @@ pub union FMOD_DSP_PARAMETER_DESC_UNION {
pub datadesc: FMOD_DSP_PARAMETER_DESC_DATA,
}

impl Default for FMOD_DSP_PARAMETER_DESC {
fn default() -> Self {
unimplemented!()
}
}

#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct FMOD_DSP_PARAMETER_OVERALLGAIN {
Expand Down Expand Up @@ -2566,7 +2578,11 @@ pub struct FMOD_DSP_PARAMETER_FFT {

impl Default for FMOD_DSP_PARAMETER_FFT {
fn default() -> Self {
unimplemented!()
Self {
length: Default::default(),
numchannels: Default::default(),
spectrum: [null_mut(); 32],
}
}
}

Expand Down Expand Up @@ -2773,7 +2789,16 @@ pub struct FMOD_DSP_LOUDNESS_METER_INFO_TYPE {

impl Default for FMOD_DSP_LOUDNESS_METER_INFO_TYPE {
fn default() -> Self {
unimplemented!()
Self {
momentaryloudness: Default::default(),
shorttermloudness: Default::default(),
integratedloudness: Default::default(),
loudness10thpercentile: Default::default(),
loudness95thpercentile: Default::default(),
loudnesshistogram: [0.0; FMOD_DSP_LOUDNESS_METER_HISTOGRAM_SAMPLES as usize],
maxtruepeak: Default::default(),
maxmomentaryloudness: Default::default(),
}
}
}

Expand Down

0 comments on commit dad2086

Please sign in to comment.