Skip to main content

Crate shuyi_sound

Crate shuyi_sound 

Source
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.

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::SharedSource;
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 lewton crate. 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 hound crate: integer samples of 8, 16, 24 or 32 bits and float samples of 32. Playdate’s IMA ADPCM WAV isn’t one of them.