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

Suggestion: Add a "Fade" param to PlaySound() / StopSound() #55

Open
LazyEti opened this issue Jan 16, 2025 · 2 comments
Open

Suggestion: Add a "Fade" param to PlaySound() / StopSound() #55

LazyEti opened this issue Jan 16, 2025 · 2 comments
Labels
bug Something isn't working enhancement New feature or request

Comments

@LazyEti
Copy link

LazyEti commented Jan 16, 2025

Hi, I think it would be very useful if it was possible to fade in / out when calling PlaySound() or StopSound().

My suggestion would be to add a float input to each function so they could be called like so:
AudioManager.PlaySound (AudioLibrarySounds.player_slide, fade: .5f);

Also, I'm not sure if this is a bug or user error but I tried using SoundChannelHelper.BeginFadeOut() but it's not doing anything
Ex:

SoundChannelHelper soundRef = null;
   void Update()
   {
       if (Input.GetKeyDown (KeyCode.Alpha6)) 
              soundRef = AudioManager.PlaySound (AudioLibrarySounds.player_slide,transform);

       if (Input.GetKeyDown (KeyCode.Alpha7)) 
              if (soundRef != null)  soundRef.BeginFadeOut (.1f);       
   } 

Unity Version:
6000.0.26f1

@LazyEti LazyEti changed the title Suggestion: Add a "Fade" parameter to PlaySound() and StopSound() Suggestion: Add a "Fade" param to PlaySound() / StopSound() Jan 16, 2025
@jackyyang09
Copy link
Owner

Hi LazyEti,

Thanks for the report, this is indeed a bug with BeginFadeOut.

A fix has been pushed to the development branch. If you aren't already, I'd recommend using the version of JSAM available there.
Alternatively, you can download the individual fixed script to your project here.

I've noted your suggestion down, making Fade functionality more visible would indeed be useful👍. I'll have it out in the next version update.

In the meantime, your implementation above is correct. Let me know if you have any other issues!

@jackyyang09 jackyyang09 added bug Something isn't working enhancement New feature or request labels Jan 16, 2025
@LazyEti
Copy link
Author

LazyEti commented Jan 18, 2025

Gotcha, switching to the dev branch fixed the issue Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants