#![allow(dead_code)]
#![allow(non_camel_case_types)]
mod envelopes;
pub(crate) use envelopes::*;
mod simd;
pub(crate) use simd::*;
mod simdvoice;
pub(crate) use simdvoice::*;
mod base;
pub(crate) use base::*;
mod squarewave;
#[allow(unused_imports)]
pub(crate) use squarewave::*;
mod channels;
#[allow(unused_imports)]
pub(crate) use channels::*;
mod constant;
pub(crate) use constant::*;
mod sampler;
pub(crate) use sampler::*;
mod control;
pub(crate) use control::*;
mod cutoff;
pub(crate) use cutoff::*;
#[derive(Copy, Clone)]
pub struct EnvelopeControlData {
pub attack: Option<u8>,
pub release: Option<u8>,
}
#[derive(Copy, Clone, PartialEq)]
pub enum ReleaseType {
Standard,
Kill,
}
#[derive(Copy, Clone)]
pub struct VoiceControlData {
pub voice_pitch_multiplier: f32,
pub envelope: EnvelopeControlData,
}
impl VoiceControlData {
pub fn new_defaults() -> Self {
VoiceControlData {
voice_pitch_multiplier: 1.0,
envelope: EnvelopeControlData {
attack: None,
release: None,
},
}
}
}
pub trait VoiceGeneratorBase: Sync + Send {
fn ended(&self) -> bool;
fn signal_release(&mut self, rel_type: ReleaseType);
fn process_controls(&mut self, control: &VoiceControlData);
}
pub trait VoiceSampleGenerator: VoiceGeneratorBase {
fn render_to(&mut self, buffer: &mut [f32]);
}
pub trait Voice: VoiceSampleGenerator + Send + Sync {
fn is_releasing(&self) -> bool;
fn is_killed(&self) -> bool;
fn velocity(&self) -> u8;
fn exclusive_class(&self) -> Option<u8>;
}