#soundboard #modified #github #internal #fork #samples #libxm

libxm-soundboard

An modified fork of libxm-rs https://github.com/nukep/libxm-rs for internal usage with the project soundboard

2 releases

0.0.3 Aug 4, 2020
0.0.1 Jun 30, 2020

#24 in #modified


Used in soundboard

Unlicense

125KB
3K SLoC

C 2.5K SLoC // 0.1% comments Rust 230 SLoC // 0.0% comments

libxm-soundboard

An modified fork of libxm-rs https://github.com/nukep/libxm-rs for internal usage with the project soundboard


lib.rs:

libxm-rs

A binding of libxm for Rust.

A small XM (FastTracker II Extended Module) player library. Designed for easy integration in demos and such, and provides timing functions for easy sync against specific instruments, samples or channels.

Example

use libxm::XMContext;
use std::fs::File;
use std::io::Read;

// Read the contents of the module into `data`
let mut data = Vec::new();
File::open("song.xm").unwrap().read_to_end(&mut data).unwrap();

let mut xm = XMContext::new(&data, 48000).unwrap();
xm.set_max_loop_count(1);

let mut buffer = [0.0; 4096];
while xm.loop_count() == 0 {
    xm.generate_samples(&mut buffer);
    // The buffer is filled with stereo PCM data. Use it for whatever you need...
}
// The song has looped once.

Example

use libxm::XMContext;

fn audio_callback(xm: &mut XMContext, buffer: &mut [f32]) {
    xm.generate_samples(buffer);
}

Dependencies

~0.4–325KB