modplay 0.1.0

Convenience abstraction of xmrsplayer
Documentation
  • Coverage
  • 57.14%
    4 out of 7 items documented0 out of 6 items with examples
  • Size
  • Source code size: 32.2 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.53 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 50s Average build duration of successful builds.
  • all releases: 50s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Repository
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • re-proc

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();