devela::_dep::kira

Module command

Available on crate feature dep_kira only.
Expand description

Helpers for sending commands from the gameplay thread to the audio thread. You’ll only need to use this if you’re making your own implementation of Sound, Effect, or Modulator.

This module provides a CommandWriter and CommandReader that can transfer data from one thread to another without blocking or waiting on either thread. CommandReader::read will return the latest data that was written to the corresponding CommandWriter or return None if no new data was written since the last read.

Keep in mind that if multiple values are written to a CommandWriter, any newer values will overwrite older values that haven’t been read yet. Therefore, this is only suitable when the reader only cares about the most recent value that has been written; i.e. new values supercede all older values. If you need a realtime-safe FIFO queue of multiple values, consider using a ring buffer, such as RingBuffer from the rtrb crate, which Kira uses internally.

Structs§

Functions§