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

Fix OneShot system. #201

Merged
merged 4 commits into from
Mar 19, 2024
Merged

Fix OneShot system. #201

merged 4 commits into from
Mar 19, 2024

Conversation

CedNaru
Copy link
Member

@CedNaru CedNaru commented Mar 15, 2024

It had previously leftovers from the implementation in Godot 3.x (all events, not only oneshots were managed by the server) so I got rid of them.

A oneshot is actually not something up to the Godot user to decide, it's a property of the Fmod event itself, I removed its setter from the FmodEmitter node.

On top of that, only oneshot events can now be used as such. If not, a warning will be thrown. The reason for this is that one shot events can actually end (unlike the ones designed to loop), otherwise they would continue playing forever without any way to stop them.

The methods to play a one shot won't ask for a Node if not attached.

Because emitters can no longer be set as oneshot, I replaced it with an auto release feature. When the event is done playing, the node will automatically free itself. This way, you can instantiate a scene containing a node with autoplay + autorelease to emulate oneshots.

When it comes to the implementation, I decided to simplify a bit. I removed a bunch of methods called "internal" as they were used only once and remove template parameters that were always the same.

@CedNaru CedNaru force-pushed the rework/one_shot branch 4 times, most recently from 593cb8e to 8bb6e91 Compare March 15, 2024 15:51
src/fmod_server.cpp Outdated Show resolved Hide resolved
src/nodes/fmod_event_emitter.h Show resolved Hide resolved
@CedNaru CedNaru force-pushed the rework/one_shot branch 2 times, most recently from 7195b74 to cc28dca Compare March 17, 2024 17:40
@CedNaru CedNaru marked this pull request as ready for review March 17, 2024 17:50
@CedNaru
Copy link
Member Author

CedNaru commented Mar 17, 2024

Some formatting changes too, it seems some of our files were using tabs instead of space.

@CedNaru CedNaru force-pushed the rework/one_shot branch 2 times, most recently from 8e093fd to fdeb7d0 Compare March 18, 2024 00:21
@CedNaru CedNaru merged commit fb8dc50 into master Mar 19, 2024
15 checks passed
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.

2 participants