bevy icon indicating copy to clipboard operation
bevy copied to clipboard

Indicate steps in registering a new `bevy::audio::Decodable` type

Open harudagondi opened this issue 3 years ago • 1 comments

How can Bevy's documentation be improved?

Documentation for creating a new Decodable type is non-existent.

Here are the steps in creating a new Decodable type:

  1. Create a type (we'll call it CustomAudio) that can be registered as an Asset and as Decodable.
  2. Create a Decodable::Decoder iterator type that generate samples. This must be Send, as this type will be sent to the audio thread. This also must implement rodio::Source.
  3. Register the Decodable type (CustomAudio) as an asset in the app.
  4. Initialize the Audio<CustomAudio> resource in App.
  5. Initialize the AudioOutput<CustomAudio> non-send resource.
  6. Add the play_queued_audio_system::<CustomAudio> function to the PostUpdate stage.

Congratulations, you now have a working audio type that can be played by bevy!

harudagondi avatar Oct 25 '22 02:10 harudagondi

working on this.

dis-da-mor avatar Nov 16 '22 13:11 dis-da-mor