populate examples; update rodio version
This commit is contained in:
BIN
examples/drozerix_-_chica-pop!.xm
Normal file
BIN
examples/drozerix_-_chica-pop!.xm
Normal file
Binary file not shown.
17
examples/from_bytes.rs
Normal file
17
examples/from_bytes.rs
Normal file
@@ -0,0 +1,17 @@
|
||||
use rodio::{OutputStream, Sink};
|
||||
use rodio_xm::XMSource;
|
||||
|
||||
fn main() {
|
||||
let source = XMSource::from_bytes(
|
||||
include_bytes!("drozerix_-_chica-pop!.xm"),
|
||||
44100
|
||||
);
|
||||
|
||||
let (_stream, stream_handle) = OutputStream::try_default().unwrap();
|
||||
let sink = Sink::try_new(&stream_handle).unwrap();
|
||||
|
||||
sink.append(source);
|
||||
sink.play();
|
||||
|
||||
loop {}
|
||||
}
|
||||
19
examples/from_file.rs
Normal file
19
examples/from_file.rs
Normal file
@@ -0,0 +1,19 @@
|
||||
use std::path::PathBuf;
|
||||
|
||||
use rodio::{OutputStream, Sink};
|
||||
use rodio_xm::XMSource;
|
||||
|
||||
fn main() {
|
||||
let source = XMSource::from_file(
|
||||
PathBuf::from("examples/drozerix_-_chica-pop!.xm"),
|
||||
44100
|
||||
);
|
||||
|
||||
let (_stream, stream_handle) = OutputStream::try_default().unwrap();
|
||||
let sink = Sink::try_new(&stream_handle).unwrap();
|
||||
|
||||
sink.append(source);
|
||||
sink.play();
|
||||
|
||||
loop {}
|
||||
}
|
||||
22
examples/from_xm_context.rs
Normal file
22
examples/from_xm_context.rs
Normal file
@@ -0,0 +1,22 @@
|
||||
use libxm::XMContext;
|
||||
use rodio::{OutputStream, Sink};
|
||||
use rodio_xm::XMSource;
|
||||
|
||||
const SAMPLE_RATE: u32 = 44100;
|
||||
|
||||
fn main() {
|
||||
let xm_context = XMContext::new(
|
||||
include_bytes!("drozerix_-_chica-pop!.xm"),
|
||||
SAMPLE_RATE
|
||||
).expect("Couldn't build XM context");
|
||||
|
||||
let source = XMSource::new(xm_context, SAMPLE_RATE);
|
||||
|
||||
let (_stream, stream_handle) = OutputStream::try_default().unwrap();
|
||||
let sink = Sink::try_new(&stream_handle).unwrap();
|
||||
|
||||
sink.append(source);
|
||||
sink.play();
|
||||
|
||||
loop {}
|
||||
}
|
||||
Reference in New Issue
Block a user