Trait culsynth::DspFormatBase
source · pub trait DspFormatBase: Sized + Copy + Default + Send {
type Sample: DspType<Self>;
type Note: DspType<Self>;
type NoteOffset: DspType<Self>;
type Frequency: DspType<Self>;
type Scalar: DspType<Self>;
type IScalar: DspType<Self>;
type EnvParam: DspType<Self>;
type EnvSignal: EnvType<Self> + Send;
type Phase: DspType<Self>;
type LfoFreq: DspType<Self>;
type WideSample: Copy + Default + Add<Self::WideSample, Output = Self::WideSample>;
type Context: Send + GetContext;
// Required methods
fn default_note() -> Self::Note;
fn note_to_freq(note: Self::Note) -> Self::Frequency;
fn sample_from_fixed(value: IScalarFxP) -> Self::Sample;
fn sample_to_float(value: Self::Sample) -> f32;
fn widen_sample(smp: Self::Sample) -> Self::WideSample;
fn narrow_sample(wide_smp: Self::WideSample) -> Self::Sample;
fn note_from_scalar(scalar: Self::Scalar) -> Self::Note;
fn apply_note_offset(
note: Self::Note,
offset: Self::NoteOffset
) -> Self::Note;
}
Expand description
Type aliases defining the data types of various internal signals within the synthesizer. This is primariliy to be generic over fixed/floating point
Required Associated Types§
sourcetype NoteOffset: DspType<Self>
type NoteOffset: DspType<Self>
A type representing an offset to a MIDI note number
sourcetype WideSample: Copy + Default + Add<Self::WideSample, Output = Self::WideSample>
type WideSample: Copy + Default + Add<Self::WideSample, Output = Self::WideSample>
A type representing a sample that may have higher precision/range
sourcetype Context: Send + GetContext
type Context: Send + GetContext
Type-specific context information
Required Methods§
sourcefn default_note() -> Self::Note
fn default_note() -> Self::Note
Provide a value of the default note, definied as A440 (MIDI NN #69)
sourcefn note_to_freq(note: Self::Note) -> Self::Frequency
fn note_to_freq(note: Self::Note) -> Self::Frequency
Convert a midi Note into a Frequency
sourcefn sample_from_fixed(value: IScalarFxP) -> Self::Sample
fn sample_from_fixed(value: IScalarFxP) -> Self::Sample
Convert a signed scalar to a Sample
sourcefn sample_to_float(value: Self::Sample) -> f32
fn sample_to_float(value: Self::Sample) -> f32
Convert a sample to a 32 bit float
sourcefn widen_sample(smp: Self::Sample) -> Self::WideSample
fn widen_sample(smp: Self::Sample) -> Self::WideSample
Widen a sample to a WideSample
sourcefn narrow_sample(wide_smp: Self::WideSample) -> Self::Sample
fn narrow_sample(wide_smp: Self::WideSample) -> Self::Sample
Narrow a WideSample to a Sample
sourcefn note_from_scalar(scalar: Self::Scalar) -> Self::Note
fn note_from_scalar(scalar: Self::Scalar) -> Self::Note
Convert a Scalar to a Note (where 0 maps to the lowest representable note, and 1 maps to the highest)
sourcefn apply_note_offset(note: Self::Note, offset: Self::NoteOffset) -> Self::Note
fn apply_note_offset(note: Self::Note, offset: Self::NoteOffset) -> Self::Note
Apply a note offset
Object Safety§
This trait is not object safe.