Skip to main content

godot_bevy/plugins/audio/
command.rs

1//! Audio command system for deferred execution
2
3use crate::plugins::assets::GodotResource;
4use crate::plugins::audio::{AudioPlayerType, AudioSettings, AudioTween, ChannelId, SoundId};
5use bevy_asset::Handle;
6
7/// Internal command for the audio system (channel-wide operations only)
8#[derive(Debug)]
9pub enum AudioCommand {
10    Play(PlayCommand),
11    Stop(ChannelId, Option<AudioTween>),
12    Pause(ChannelId, Option<AudioTween>),
13    Resume(ChannelId, Option<AudioTween>),
14    SetVolume(ChannelId, f32, Option<AudioTween>),
15    SetPitch(ChannelId, f32, Option<AudioTween>),
16    SetPanning(ChannelId, f32, Option<AudioTween>),
17    StopSound(SoundId, Option<AudioTween>),
18}
19
20/// Command to play audio with specific settings
21#[derive(Debug)]
22pub struct PlayCommand {
23    pub channel_id: ChannelId,
24    pub handle: Handle<GodotResource>,
25    pub player_type: AudioPlayerType,
26    pub settings: AudioSettings,
27    pub sound_id: SoundId,
28}