pikopiko-runtime 0.1.0

no_std, heap-free runtime for pikopiko: synth trait, event-binary sequencer, effects and built-in synths (AY-3-8912, buzzer, sfx).
Documentation
//! 効果音音源 `sfx`(レトロ系)の合成エンジン。
//!
//! sfxr / bfxr の系統の効果音(コイン、レーザー、爆発、パワーアップ、ダメージ、ジャンプ、
//! 選択音)を、パラメータ 1 組から作る。MML を知らない。整数だけで計算し、ヒープを使わないので
//! `no_std` のマイコンでも動く。同じパラメータ・サンプルレートなら、どの機種でも同じ音になる。
//! MML の音源 `#synth sfx` は PC 側の `pikopiko`(`sfx` 機能)にある。
//!
//! ```
//! use pikopiko_runtime::synth::sfx::{generate, render_mono, Category};
//! let p = generate(Category::Laser, 42);
//! let mut buf = [0i16; 44_100];
//! let n = render_mono(&p, 44_100, &mut buf);
//! assert!(n > 0);
//! ```
//!
//! パラメータはテキスト(`@n %名前=値 …`)と相互に変換でき([`SfxParams::write_text`]、
//! [`SfxParams::parse`])、MML・エディタ・AI の間でそのまま受け渡せる。

mod fixed;
mod gen;
mod params;
mod tables;
mod voice;

pub use fixed::Rng;
pub use gen::{generate, mutate};
pub use params::{
    id, param_index, wave, Category, ParamDef, ParseError, SfxParams, CENTER, PARAMS,
};
#[cfg(feature = "alloc")]
pub use voice::render_vec;
pub use voice::{render_mono, Voice};