1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
/// Type of the audio sample interpolation algorithm.
#[derive(Clone, PartialEq, Eq, Copy, Debug)]
pub enum Interpolator {
/// Nearest neighbor interpolation
///
/// See more info about this method [here](https://en.wikipedia.org/wiki/Nearest-neighbor_interpolation)
Nearest,
/// Linear interpolation
///
/// See more info about this method [here](https://en.wikipedia.org/wiki/Linear_interpolation)
Linear,
}
/// Options for initializing/loading a new sample soundfont.
#[derive(Debug, Clone, Copy)]
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).
///
/// Default: `None`
pub bank: Option<u8>,
/// The preset number (0-127) to extract and use from the soundfont.
/// `None` means to use all available presets (preset 0 for SFZ).
///
/// Default: `None`
pub preset: Option<u8>,
/// If set to true, the voices generated using this soundfont will
/// release using a linear function instead of convex.
///
/// Default: `false`
pub linear_release: bool,
/// If set to true, the voices generated using this soundfont will
/// be able to use signal processing effects. Currently this option
/// only affects the cutoff filter.
///
/// Default: `true`
pub use_effects: bool,
/// The type of interpolator to use for the new soundfont. See the
/// documentation of the `Interpolator` enum for available options.
///
/// Default: `Nearest`
pub interpolator: Interpolator,
}
impl Default for SoundfontInitOptions {
fn default() -> Self {
Self {
bank: None,
preset: None,
linear_release: false,
use_effects: true,
interpolator: Interpolator::Nearest,
}
}
}