#![no_std]
#![forbid(unsafe_code)]
pub mod beat;
pub mod ease;
pub mod fixed_point;
pub mod intmap;
pub mod lerp;
pub mod math8;
pub mod random;
pub mod scale8;
pub mod trig8;
pub use beat::*;
pub use ease::*;
pub use fixed_point::{Q44, Q62, Q88, Q124, Qfx};
pub use intmap::{IntScale, int_scale};
pub use lerp::*;
pub use math8::*;
pub use random::{RangeSample, Rng16};
pub use scale8::*;
pub use trig8::*;
macro_rules! fixed_point_numerator {
($(#[$meta:meta])* $name:ident($repr:ty)) => {
$(#[$meta])*
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[repr(transparent)]
pub struct $name(pub $repr);
impl $name {
#[doc = concat!("Wraps `numerator` as a [`", stringify!($name), "`].")]
#[inline]
pub const fn new(numerator: $repr) -> Self {
Self(numerator)
}
#[inline]
pub const fn value(self) -> $repr {
self.0
}
}
impl From<$repr> for $name {
#[inline]
fn from(numerator: $repr) -> Self {
Self(numerator)
}
}
impl From<$name> for $repr {
#[inline]
fn from(wrapped: $name) -> Self {
wrapped.0
}
}
};
}
fixed_point_numerator! {
Fract8(u8)
}
fixed_point_numerator! {
Fract16(u16)
}
fixed_point_numerator! {
SFract8(i8)
}
fixed_point_numerator! {
Accum88(u16)
}