1 unstable release
0.1.0 | Jul 19, 2024 |
---|
#838 in Audio
6KB
82 lines
Convenience abstraction of xmrsplayer
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.
Features
- Powered by
xmrs
andcpal
- Quickly play your favorite
.xm
file
Examples:
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();
Dependencies
~2–33MB
~464K SLoC