Skip to content

Indicate steps in registering a new bevy::audio::Decodable type #6362

@harudagondi

Description

@harudagondi

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-AudioSounds playback and modificationC-DocsAn addition or correction to our documentation

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions