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
}impl Show for AssetCachepub(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 AudioBuffer {
channels : Int
sample_rate : Int
data : FixedArray[Float]
}impl Eq for AudioBufferimpl Show for AudioBufferimpl Show for AudioCommandpub(all) struct AudioRuntime {
mixer : Mixer
output_buffer : FixedArray[Float]
frames_per_tick : Int
tick_count : Int
initialized : Bool
command_queue : CommandQueue
latency_monitor : LatencyMonitor
}impl Show for AudioSourcepub(all) struct BiquadState {
b0 : Float
b1 : Float
b2 : Float
a1 : Float
a2 : Float
z1 : Float
z2 : Float
}impl Show for BiquadStatetype BitReaderpub(all) struct CacheEntry {
buffer : AudioBuffer
policy : CachePolicy
byte_size : Int
last_access : Int
}impl Show for CacheEntrypub(all) enum CachePolicy {
AlwaysCache
Normal
StreamPrefer
}impl Eq for CachePolicyimpl Show for CachePolicypub(all) struct DelayState {
buffer : FixedArray[Float]
write_pos : Int
delay_samples : Int
feedback : Float
mix : Float
}impl Show for DelayStatepub(all) struct Envelope {
config : EnvelopeConfig
sample_rate : Int
phase : EnvelopePhase
level : Float
phase_position : Int
release_start_level : Float
}pub(all) struct EnvelopeConfig {
attack : Float
decay : Float
sustain : Float
release_time : Float
}impl Eq for EnvelopeConfigimpl Show for EnvelopeConfigpub(all) enum EnvelopePhase {
Attack
Decay
Sustain
Release
Done
}impl Eq for EnvelopePhaseimpl Show for EnvelopePhasepub(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
}type OggPagepub(all) type PullCallback (FixedArray[Float], Int) -> Intimpl Show for PullCallback#deprecated("Use `struct T(A)` to declare a newtype and use `.0` access the underlying type instead.")
fn PullCallback::inner(self : PullCallback) -> ((FixedArray[Float], Int) -> Int)pub(all) enum ResampleQuality {
Nearest
Linear
Cubic
}impl Eq for ResampleQualityimpl Show for ResampleQualitypub(all) struct RingBuffer {
data : FixedArray[Float]
capacity : Int
channels : Int
write_pos : Int
read_pos : Int
frames_available : Int
}impl Show for RingBufferpub(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]
}pub(all) type VoiceId Intpub(all) enum VoiceState {
Playing
Paused
Stopped
}impl Eq for VoiceStateimpl Show for VoiceStatetype VorbisCodebookimpl Show for VorbisCodebooktype VorbisFloorConfigimpl Show for VorbisFloorConfigtype VorbisInfoimpl Show for VorbisInfotype VorbisMappingimpl Show for VorbisMappingtype VorbisResidueConfigimpl Show for VorbisResidueConfigfn 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