From c5d954c56c86a6cb31387a7fb0b7d1f86104c0a8 Mon Sep 17 00:00:00 2001 From: Max Bradbury Date: Sat, 27 Nov 2021 11:49:47 +0000 Subject: [PATCH] updated readme --- README.md | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 86bd5da..ca3667a 100644 --- a/README.md +++ b/README.md @@ -1,21 +1,28 @@ # rodio-xm -provides a source for playback of fasttracker 2 extended modules in rodio +provides a Source for playback of FastTracker 2 extended modules in rodio ## examples ```rust +use std::path::PathBuf; + +use rodio::{OutputStream, Sink}; use rodio_xm::XMSource; fn main() { - const SAMPLE_RATE: u32 = 44100; - let mut source = XMSource::from_bytes(include_bytes!("path/to/xm"), SAMPLE_RATE); + let source = XMSource::from_file( + PathBuf::from("path/to/file.xm"), + 44100 + ); - let (_stream, stream_handle) = rodio::OutputStream::try_default().unwrap(); - let sink = rodio::Sink::try_new(&stream_handle).unwrap(); + let (_stream, stream_handle) = OutputStream::try_default().unwrap(); + let sink = Sink::try_new(&stream_handle).unwrap(); sink.append(source); - sink.sleep_until_end(); + sink.play(); + + loop {} } ``` @@ -23,4 +30,7 @@ see more in the *examples* directory. ## license -example track "chica-pop!" is in the public domain: https://modarchive.org/index.php?request=view_by_moduleid&query=189433 +released under the MIT license. + +example track ["Chica-pop!"](https://modarchive.org/index.php?request=view_by_moduleid&query=189433) +is in the public domain.