Module sound

Available on crate feature dep_kira only.
Expand description

Sources of audio.

Any type that implements SoundData can be played using AudioManager::play. Kira comes with two SoundData implementations:

  • StaticSoundData, which loads an entire chunk of audio into memory. This is more appropriate for short sounds, sounds you want to play multiple times, or sounds where consistent start times are important.
  • StreamingSoundData, which streams audio from a file or cursor (only available on desktop platforms). This is more appropriate for long sounds that you only play once at a time, like background music. Streaming sounds use less memory than static sounds.

These two sound types should cover most use cases, but if you need something else, you can create your own types that implement the SoundData and Sound traits.

Modules§

static_sound
Playable chunks of audio that are loaded into memory all at once.
streaming
Decodes data gradually from an audio file.

Structs§

Region
A portion of audio.

Enums§

EndPosition
The ending time of a region of audio.
FromFileError
Errors that can occur when loading or streaming an audio file.
PlaybackPosition
A point in time in a piece of audio.
PlaybackState
The playback state of a sound.

Traits§

IntoOptionalRegion
A trait for types that can be converted into an Option<Region>.
Sound
An actively playing sound.
SoundData
A source of audio that is loaded, but not yet playing.