Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Helper method to allow easier creation of AudioSources #62

Closed
wants to merge 10 commits into from
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ assets/
*.so.*
demo_project/
Cargo.lock
.vscode/
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally I agree with this, but iirc @Salzian had some reservations about this

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add both like in the Bevy repo:

/.idea
/.vscode

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see a problem with it, but id love to see the conversation with @Salzian if its public.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.vscode and .idea sometimes serve valuable metadata about the repository between developers. They usually have their own nested .gitignore to only share the important bits. So feel free to check in the .vscode folder.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm gonna undo the changes, feels out of scope for the PR.

9 changes: 9 additions & 0 deletions src/fmod_studio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use std::env::var;
use std::fs::canonicalize;
use std::path::{Path, PathBuf};

use crate::components::audio_source::AudioSource as BevyFmodAudioSource;
Peepo-Juice marked this conversation as resolved.
Show resolved Hide resolved
use bevy::prelude::{debug, trace, Resource};
#[cfg(feature = "live-update")]
use libfmod::ffi::FMOD_STUDIO_INIT_LIVEUPDATE;
Expand Down Expand Up @@ -66,4 +67,12 @@ impl FmodStudio {

studio
}

pub fn build_audio_source_from_path(&self, path: &str) -> BevyFmodAudioSource {
Peepo-Juice marked this conversation as resolved.
Show resolved Hide resolved
let event_description = self
.0
.get_event(path)
.expect("The event is expected to exist in the FMOD project.");
Peepo-Juice marked this conversation as resolved.
Show resolved Hide resolved
BevyFmodAudioSource::new(event_description)
}
}