Expand description
Decoded sound: Pcm holds samples, a Source yields them in bounded
chunks, optional adapters make a source of a file’s bytes, and mix::Mixer
adds up what is playing. It knows nothing else of the engine, reads no file and
opens no device.
pcm: holdsPcm, itsPcmFormat, theLimitson what a decoder may produce, and sample width conversions.source: has theSourcetrait,PcmSource,SharedSourceandread_all.mix: the integerMixer, itsqueuefrom another thread, and thestreamfeed from a worker.error: what can go wrong,Error.wav(featurewav):WavSource, over thehoundcrate.vorbis(featurevorbis):VorbisSource, over thelewtoncrate, with a file’s comments and page positions.
Without features the crate is no_std with alloc. Samples are whole
numbers from end to end, the mix’s too; the one float is a float WAV’s own
sample on its way in.
A malformed file gives an Error, never a panic. The decoding libraries
are behind a guard that turns their panics into errors where the target can
unwind, which wasm32-unknown-unknown can’t.
Re-exports§
pub use error::Error;pub use pcm::Channels;pub use pcm::Limits;pub use pcm::Pcm;pub use pcm::PcmFormat;pub use source::PcmSource;pub use source::Source;pub use source::read_all;
Modules§
- error
- What can go wrong with decoded sound.
- mix
- The mixer: everything playing, added up into one block of samples, in whole numbers, so the same script gives the same samples on every target.
- pcm
- Decoded samples: 16 bits, interleaved, one or two channels.
- source
- A source of samples in bounded chunks.
- vorbis
- Ogg Vorbis files, over the
lewtoncrate. Besides the samples it keeps what a loop importer needs: the file’s comments, and where in the sound it is. - wav
- WAV files, over the
houndcrate: integer samples of 8, 16, 24 or 32 bits and float samples of 32. Playdate’s IMA ADPCM WAV isn’t one of them.