audio encoder for wav/ogg
pub suberror AudioError {
InvalidFormat(String)
DecodeFailed(String)
}impl Show for AudioErrorpub(all) struct AssetCache {
entries : Map[String, CacheEntry]
total_bytes : Int
max_bytes : Int
max_entries : Int
access_counter : Int
} derive(Show)pub(all) struct AudioBackendHooks {
initialize : (Int, Int) -> Unit
write : (FixedArray[Float], Int) -> Unit
suspend : () -> Unit
resume_playback : () -> Unit
close : () -> Unit
report_consumed : () -> Int
}pub(all) struct AudioRuntime {
mixer : Mixer
output_buffer : FixedArray[Float]
frames_per_tick : Int
tick_count : Int
initialized : Bool
command_queue : CommandQueue
latency_monitor : LatencyMonitor
}pub(all) struct BiquadState {
b0 : Float
b1 : Float
b2 : Float
a1 : Float
a2 : Float
z1 : Float
z2 : Float
} derive(Show)pub(all) struct CacheEntry {
buffer : AudioBuffer
policy : CachePolicy
byte_size : Int
last_access : Int
} derive(Show)pub(all) struct DelayState {
buffer : FixedArray[Float]
write_pos : Int
delay_samples : Int
feedback : Float
mix : Float
} derive(Show)pub(all) enum EffectNode {
Lowpass(BiquadState)
Highpass(BiquadState)
Delay(DelayState)
} derive(Show)pub(all) struct Envelope {
config : EnvelopeConfig
sample_rate : Int
phase : EnvelopePhase
level : Float
phase_position : Int
release_start_level : Float
} derive(Show)pub(all) struct LatencyMonitor {
frames_written : Int
ticks_elapsed : Int
drift_frames_val : Int
underrun_count : Int
max_drift : Int
}pub(all) struct Mixer {
voices : Array[Voice]
master_gain : Float
channels : Int
sample_rate : Int
resample_quality : ResampleQuality
next_voice_id : Int
}pub(all) struct PullCallback((FixedArray[Float], Int) -> Int)impl Show for PullCallbackpub(all) struct RingBuffer {
data : FixedArray[Float]
capacity : Int
channels : Int
write_pos : Int
read_pos : Int
frames_available : Int
} derive(Show)pub(all) struct StreamingSource {
ring : RingBuffer
pull : PullCallback
channels : Int
sample_rate : Int
ended : Bool
total_pulled : Int
}impl Show for StreamingSourcepub(all) struct Voice {
id : VoiceId
source : AudioSource
position : Float
gain : Float
pan : Float
state : VoiceState
looping : Bool
sample_rate : Int
loop_start : Int
loop_end : Int
envelope : Envelope?
effects : Array[EffectNode]
} derive(Show)fn new_streaming_source(pull : PullCallback, channels : Int, sample_rate : Int, buffer_frames? : Int) -> StreamingSourcefn new_voice(mixer : Mixer, source : AudioSource, gain? : Float, pan? : Float, looping? : Bool, envelope? : Envelope?) -> Voicefn new_voice_from_buffer(mixer : Mixer, buffer : AudioBuffer, gain? : Float, pan? : Float, looping? : Bool, envelope? : Envelope?) -> Voicefn new_voice_with_loop(mixer : Mixer, source : AudioSource, loop_start : Int, loop_end : Int, gain? : Float, pan? : Float, looping? : Bool) -> Voicefn pan_gains(pan : Float) -> (Float, Float)fn play_sound(rt : AudioRuntime, buffer : AudioBuffer, gain? : Float, pan? : Float, looping? : Bool) -> VoiceIdfn reset_audio_backend_hooks() -> Unitaudio encoder for wav/ogg