mirror of
https://github.com/italicsjenga/agb.git
synced 2025-01-11 09:31:34 +11:00
29 lines
957 B
Rust
29 lines
957 B
Rust
#![allow(missing_docs)]
|
|
|
|
use agb_fixnum::Num;
|
|
use alloc::borrow::Cow;
|
|
|
|
pub trait SoundChannel {
|
|
// I need a reference to a cow here to support the static data correctly
|
|
#[allow(clippy::ptr_arg)]
|
|
fn new(data: &Cow<'static, [u8]>) -> Self;
|
|
|
|
fn stop(&mut self);
|
|
fn pause(&mut self) -> &mut Self;
|
|
fn resume(&mut self) -> &mut Self;
|
|
|
|
fn should_loop(&mut self) -> &mut Self;
|
|
fn volume(&mut self, value: impl Into<Num<i16, 8>>) -> &mut Self;
|
|
fn restart_point(&mut self, value: impl Into<Num<u32, 8>>) -> &mut Self;
|
|
fn playback(&mut self, playback_speed: impl Into<Num<u32, 8>>) -> &mut Self;
|
|
fn panning(&mut self, panning: impl Into<Num<i16, 8>>) -> &mut Self;
|
|
}
|
|
|
|
pub trait Mixer {
|
|
type ChannelId;
|
|
type SoundChannel: SoundChannel;
|
|
|
|
fn channel(&mut self, channel_id: &Self::ChannelId) -> Option<&mut Self::SoundChannel>;
|
|
fn play_sound(&mut self, channel: Self::SoundChannel) -> Option<Self::ChannelId>;
|
|
}
|