pub mod audio_center;
pub mod audio_manager;
use crate::prelude::*;
pub use audio_center::*;
pub use audio_manager::*;
pub use kira;
pub use kira::sound::static_sound::StaticSoundData;
use kira::sound::static_sound::StaticSoundHandle;
pub const DEFAULT_BONES_AUDIO_SESSION: &str = "BONES_AUDIO";
pub fn game_plugin(game: &mut Game) {
AudioSource::register_schema();
game.init_shared_resource::<AudioCenter>();
game.insert_shared_resource(AudioManager::default());
game.init_shared_resource::<AssetServer>();
let session = game.sessions.create(DEFAULT_BONES_AUDIO_SESSION);
session.visible = false;
session
.stages
.add_system_to_stage(First, _process_audio_events)
.add_system_to_stage(Last, _kill_finished_audios);
}
#[derive(HasSchema)]
#[schema(no_clone, no_default, opaque)]
#[repr(C)]
pub struct Audio {
handle: StaticSoundHandle,
volume: f64,
bones_handle: Handle<AudioSource>,
}