fix some problems
This commit is contained in:
parent
129486f2b0
commit
7e7bd4e7d5
|
@ -2,6 +2,8 @@
|
||||||
name = "rodio-xm"
|
name = "rodio-xm"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2018"
|
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
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
|
11
src/lib.rs
11
src/lib.rs
|
@ -1,13 +1,14 @@
|
||||||
|
use std::fs;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
use libxm::*;
|
use libxm::*;
|
||||||
use rodio::{OutputStream, Source, Sink};
|
use rodio::Source;
|
||||||
use std::fs;
|
|
||||||
|
|
||||||
pub const BUFFER_SIZE: usize = 2048;
|
pub const BUFFER_SIZE: usize = 2048;
|
||||||
|
|
||||||
/// Example usage
|
/// Example usage
|
||||||
|
///
|
||||||
/// ```rust
|
/// ```rust
|
||||||
/// fn main() {
|
/// fn main() {
|
||||||
/// let mut xm = libxm::XMContext::new(
|
/// let mut xm = libxm::XMContext::new(
|
||||||
|
@ -46,15 +47,15 @@ impl XMSource {
|
||||||
let xm = libxm::XMContext::new(bytes, 48000)
|
let xm = libxm::XMContext::new(bytes, 48000)
|
||||||
.expect("failed to parse xm");
|
.expect("failed to parse xm");
|
||||||
|
|
||||||
self::new(xm)
|
XMSource::new(xm)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn from_file(path: PathBuf) -> Self {
|
pub fn from_file(path: PathBuf) -> Self {
|
||||||
let file = fs::read(path).expect("couldn't read file");
|
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");
|
.expect("failed to parse xm");
|
||||||
|
|
||||||
self::new(xm)
|
XMSource::new(xm)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue