diff options
| author | Freya Murphy <freya@freyacat.org> | 2025-11-24 14:30:30 -0500 |
|---|---|---|
| committer | Freya Murphy <freya@freyacat.org> | 2025-11-24 14:30:30 -0500 |
| commit | 4601aa8a74f3f99e8cbac0ccade955bb242db910 (patch) | |
| tree | 10cb11ceeb4467133bed03d157b2074d744d5486 /audio/src/lib.rs | |
| parent | audio: disable music debug (diff) | |
| download | DungeonCrawl-4601aa8a74f3f99e8cbac0ccade955bb242db910.tar.gz DungeonCrawl-4601aa8a74f3f99e8cbac0ccade955bb242db910.tar.bz2 DungeonCrawl-4601aa8a74f3f99e8cbac0ccade955bb242db910.zip | |
audio: move data out of crate
Diffstat (limited to 'audio/src/lib.rs')
| -rw-r--r-- | audio/src/lib.rs | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/audio/src/lib.rs b/audio/src/lib.rs index 814bcd0..8158c35 100644 --- a/audio/src/lib.rs +++ b/audio/src/lib.rs @@ -3,12 +3,12 @@ use raylib::audio::RaylibAudio; use std::{ collections::BinaryHeap, + rc::Rc, sync::atomic::Ordering, time::{Duration, Instant}, }; use channel::Device; -use data::Data; use crate::{ channel::Channels, @@ -16,9 +16,8 @@ use crate::{ }; mod channel; -mod data; mod parse; -mod program; +pub mod program; /// The `Error` type used within this crate pub type Error = Box<dyn std::error::Error>; @@ -36,7 +35,6 @@ pub struct Audio { device: Device<'static>, last: Instant, queue: BinaryHeap<Program>, - pub data: Data, } impl Audio { pub fn load() -> crate::Result<Self> { @@ -53,17 +51,15 @@ impl Audio { let device = Device::load(handle)?; let last = Instant::now(); let queue = BinaryHeap::new(); - let data = Data::load()?; Ok(Self { device, last, queue, - data, }) } - pub fn schedule(&mut self, track: Track, priority: u32, looping: bool) { + pub fn schedule(&mut self, track: Rc<Track>, priority: u32, looping: bool) { let program = Program::new(track, priority, looping); self.queue.push(program); } @@ -86,7 +82,7 @@ impl Audio { res } // make the output quiet! - None => Channels::new(), + None => Channels::default(), }; self.device.channels.store(channels, Ordering::Relaxed); self.last = Instant::now(); |