fix some problems

This commit is contained in:
Max Bradbury 2021-04-30 18:23:53 +01:00
parent 129486f2b0
commit 7e7bd4e7d5
2 changed files with 8 additions and 5 deletions

View File

@ -2,6 +2,8 @@
name = "rodio-xm"
version = "0.1.0"
edition = "2018"
repository = "https://tinybird.dev/max/rodio-xm"
authors = ["Max Bradbury<max@tinybird.info>"]
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

View File

@ -1,13 +1,14 @@
use std::fs;
use std::path::PathBuf;
use std::time::Duration;
use libxm::*;
use rodio::{OutputStream, Source, Sink};
use std::fs;
use rodio::Source;
pub const BUFFER_SIZE: usize = 2048;
/// Example usage
///
/// ```rust
/// fn main() {
/// let mut xm = libxm::XMContext::new(
@ -46,15 +47,15 @@ impl XMSource {
let xm = libxm::XMContext::new(bytes, 48000)
.expect("failed to parse xm");
self::new(xm)
XMSource::new(xm)
}
pub fn from_file(path: PathBuf) -> Self {
let file = fs::read(path).expect("couldn't read file");
let xm = libxm::XMContext::new(file.as_bytes(), 48000)
let xm = libxm::XMContext::new(&file, 48000)
.expect("failed to parse xm");
self::new(xm)
XMSource::new(xm)
}
}