modplay

Crates.iomodplay
lib.rsmodplay
version0.1.0
sourcesrc
created_at2024-07-19 18:08:24.162454
updated_at2024-07-19 18:08:24.162454
descriptionConvenience abstraction of xmrsplayer
homepage
repositoryhttps://codeberg.org/reproc/modplay
max_upload_size
id1308948
size6,338
reproc (re-proc)

documentation

README

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 and cpal

  • 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();
Commit count: 0

cargo fmt