Crates.io | modplay |
lib.rs | modplay |
version | 0.1.0 |
source | src |
created_at | 2024-07-19 18:08:24.162454 |
updated_at | 2024-07-19 18:08:24.162454 |
description | Convenience abstraction of xmrsplayer |
homepage | |
repository | https://codeberg.org/reproc/modplay |
max_upload_size | |
id | 1308948 |
size | 6,338 |
This library crate is a convenience abstraction of xmrsplayer with only one goal in mind, to easily play XM files in your application without dealing with its internals.
If your use case requires more features or lower level control you may need to consider using xmrs or xmrsplayer directly.
Powered by xmrs
and cpal
Quickly play your favorite .xm
file
You can use modplay
like this:
use modplay::ModPlay;
let data = std::fs::read("filename.xm").unwrap();
ModPlay::new(&data).run();
It is recommended to run from a separate thread:
use modplay::ModPlay;
std::thread::spawn(|| {
if let Ok(data) = std::fs::read("filename.xm") {
ModPlay::new(&data).run();
}
}).join().unwrap()
If you need to set some options you can use something like this:
use modplay::ModPlay;
let data = std::fs::read("filename.xm").unwrap()
ModPlay::new(&data)
.set_amplification(0.5)
.set_loops(2)
.set_sample_rate(44100.0)
.run();