# Convenience abstraction of xmrsplayer
This library crate is a convenience abstraction of [xmrsplayer](https://crates.io/crates/xmrsplayer) with only one goal in mind, to easily play [XM](https://en.wikipedia.org/wiki/XM_(file_format)) 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](https://crates.io/crates/xmrs) or [xmrsplayer](https://crates.io/crates/xmrsplayer) directly.
## Features
- Powered by `xmrs` and `cpal`
- Quickly play your favorite `.xm` file
## Examples:
You can use `modplay` like this:
```rust
use modplay::ModPlay;
let data = std::fs::read("filename.xm").unwrap();
ModPlay::new(&data).run();
```
It is recommended to run from a separate thread:
```rust
use modplay::ModPlay;
ModPlay::new(&data).run();
}
}).join().unwrap()
```
If you need to set some options you can use something like this:
```rust
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();
```