#![forbid(unsafe_code)]
#![allow(dead_code)]
#![cfg_attr(not(feature = "std"), no_std)]
extern crate alloc;
#[cfg(not(any(feature = "std", feature = "libm", feature = "micromath")))]
::core::compile_error!(
"xmrs: with `std` disabled, enable exactly one float math backend: \
feature `libm` or feature `micromath`."
);
pub mod effect;
pub mod envelope;
pub mod instr_default;
pub mod instr_ekn;
pub mod instr_midi;
pub mod instr_opl;
pub mod instr_robsid;
pub mod instr_sid;
pub mod instrument;
pub mod module;
pub mod period_helper;
pub mod pitch;
pub mod sample;
pub mod track_unit;
pub mod vibrato;
pub mod waveform;
pub mod xorshift;
pub mod prelude;
#[cfg(any(
feature = "import_mod",
feature = "import_xm",
feature = "import_s3m",
feature = "import_it",
feature = "import_sid",
))]
pub mod import;
#[cfg(test)]
mod tests {
#[test]
fn it_works() {
assert_eq!(42, 42);
}
#[cfg(feature = "import_xm")]
#[test]
fn load_empty_xm() {
let data = include_bytes!("../examples/empty.xm");
let module = crate::module::Module::load_xm(data);
assert!(
module.is_ok(),
"Failed to load empty.xm: {:?}",
module.err()
);
}
#[cfg(feature = "import_xm")]
#[test]
fn load_note_xm() {
let data = include_bytes!("../examples/note.xm");
let module = crate::module::Module::load_xm(data).expect("Failed to load note.xm");
assert!(!module.pattern.is_empty(), "Module should have patterns");
assert!(
!module.instrument.is_empty(),
"Module should have instruments"
);
}
#[cfg(feature = "import_xm")]
#[test]
fn load_xi_instrument() {
let data = include_bytes!("../examples/instr.xi");
let xmi = crate::import::xm::xi_instrument::XiInstrument::load(data);
assert!(xmi.is_ok(), "Failed to load instr.xi: {:?}", xmi.err());
}
#[cfg(feature = "import_xm")]
#[test]
fn autodetect_xm() {
let data = include_bytes!("../examples/note.xm");
let module = crate::module::Module::load(data);
assert!(module.is_ok(), "Autodetect should find XM format");
}
}