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

Conversation

Peepo-Juice
Copy link
Contributor

With the current state of things, this is a simple way to spawn an AudioSource component:

fn startup(mut commands: Commands, studio: Res<FmodStudio>) {
    let event_description = studio.0.get_event("event:/Music/Level 03").unwrap();

    commands
        .spawn(MyMusicPlayer)
        .insert(AudioSource::new(event_description));
}

With my proposed helper method, it would look more like this:

fn startup(mut commands: Commands, studio: Res<FmodStudio>) {
    commands
        .spawn(MyMusicPlayer)
        .insert(studio.build_audio_source_from_path("event:/Music/Level 03"));
}

I have some questions, but I will leave them as inline comments for further discussion (I never tried doing that before so we shall see how it goes).

src/fmod_studio.rs Outdated Show resolved Hide resolved
src/fmod_studio.rs Outdated Show resolved Hide resolved
Copy link
Collaborator

@GitGhillie GitGhillie left a comment

Choose a reason for hiding this comment

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

I'm not a 100% sure if we are going in the right direction with this helper method but I would like to see it merged until we find a better solution.

Please update the examples to use this helper method as well, and if you update the spatial example you will see there is a bit more work to be done :)

.gitignore Outdated
@@ -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.

src/fmod_studio.rs Outdated Show resolved Hide resolved
@Salzian
Copy link
Owner

Salzian commented Nov 23, 2023

Closing for now until we have a better asset management system.

@Salzian Salzian closed this Nov 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants