Dear forum users! In compliance with the new European GDPR regulations, we'd just like to inform you that if you have an account, your email address is stored in our database. We do not share your information with third parties, and your email address and password are encrypted for security reasons.

New to the forum? Say hello in this topic! Also make sure to read the rules.

Providing an interface for better handling of sound instances

Give us your input on how we may improve the ScriptAPI in the game in future versions.
Forum rules
By using the forum you agree to the following rules.
Post Reply
User avatar
JakSparro98
Superfighter
Superfighter
Posts: 530
Joined: Fri Jul 15, 2016 7:56 pm
Started SFD: PreAlpha 1.0.5
Location: Rome, Italy
Gender:
Age: 25

Providing an interface for better handling of sound instances

Post by JakSparro98 » Sat Jan 26, 2019 10:59 pm

When we use PlaySound() we cannot get the sound instance reference we just created by invoking the function, this makes us unable to perform the stop of a particular sound if needed, what I was thinking was a refactoring of the code in order to return a sound interface object (something like ISound) to handle sound instances for further uses or at least for stopping them, usually sounds are very small in terms of duration, but there are some of them with moderate length, and they are persistent even when you close the editor (this is not a complain post about hearing sounds even after closing the editor, but, I mean, it should not happen).

Imagine a map when you constantly die and respawn and you're continuously hearing the death sound, with a sound interface you could:
  • Get the currently playing sound instances in the game world;
  • Terminate one sound instance;
  • Get the name of the playing sound effect in one particular instance.
0 x

User avatar
Gurt
Lead Programmer
Lead Programmer
Posts: 1884
Joined: Sun Feb 28, 2016 3:22 pm
Title: Lead programmer
Started SFD: Made it!
Location: Sweden
Gender:
Age: 34

Post by Gurt » Wed Feb 06, 2019 8:18 pm

Sounds are built on the principle of fire-and-forget, deep in the engine. The server hasn't any knowledge of running sound-instances either so this won't happen.
If this is only a problem related to constantly hearing the death sound (after respawning) a better appoach would be to cancel the death sound if you start controlling a player again as we could do this as a quality-of-life thing.
0 x
Gurt

Post Reply