use {
crate::ToSignal,
bevy::reflect::{TypePath, TypeUuid},
};
#[derive(TypeUuid, TypePath)]
#[uuid = "14597aba-d411-4bfc-b227-09cf5f88202f"]
pub struct Sine;
pub struct Settings {
pub phase: f32,
pub frequency_hz: f32,
}
impl Settings {
#[must_use]
pub fn new(phase: f32, frequency_hz: f32) -> Self {
Self {
phase,
frequency_hz,
}
}
}
impl ToSignal for Sine {
type Settings = Settings;
type Signal = oddio::Sine;
fn to_signal(&self, settings: Self::Settings) -> Self::Signal {
oddio::Sine::new(settings.phase, settings.frequency_hz)
}
}