Jump to content

Stop ITickableSound sounds


Recommended Posts

Posted (edited)

Is it possible to mute external ITickableSounds? I'm using the PlaySoundEvent and neither setting the resultSound to null nor setting it to a new custom sound with volume 0 stops the current sounds.

 

My primary problem comes from Minecarts, I can mute them but I have to break them an place them again in order to work, (or set the master volume to 0 and back).

 

I've also tried SoundEngine#stopAllSounds(), SoundEngine#stop(sound), SoundHandler#stop(), etc..

Edited by LeoBeliik
Posted

The minecart tickable sound should be able to be set to null within PlaySoundEvent with no issues at least from my testing. How are you checking what sounds are being played and which ones to mute, and is this after they begin playing the sound or before the sound is initially loaded? Where are you calling the SoundEngine and SoundHandler methods as well?

Posted (edited)

This is after the sound starts playing, I'm using the PlaySoundEvent to determine witch sounds are playing and either setting the result null or using a custom class that extends ITickableSound and setting the volume to 0.

and I tried using the event.getManager().stop() for SoundEngine and event.getManager().sndHandler for SoundHandler, this inside the PlaySoundEvent class.

Edited by LeoBeliik
Posted (edited)

Oops double post, sorry

Edited by LeoBeliik
Posted
1 hour ago, LeoBeliik said:

This is after the sound starts playing, I'm using the PlaySoundEvent to determine witch sounds are playing and either setting the result null or using a custom class that extends ITickableSound and setting the volume to 0.

and I tried using the event.getManager().stop() for SoundEngine and event.getManager().sndHandler for SoundHandler, this inside the PlaySoundEvent class.

Using SoundEngine or SoundHandler inside the event will not do anything as the sound hasn't started playing yet. Can you debug with a breakpoint to check whether the result is actually being set to null or not?

Posted

Ok, that was a good idea, so the sound is properly mutted, the problem seems to be that minecarts wont trigger the PlaySoundEvent once they're placed, until they're broken or out of render.. So is any other even I could use for this?

Posted

Ok Ok, so I managed to stop the sound, what I've done is stop it using the SoundEngine.stop() when I'm adding the sound to the muted sounds. My problem now is I can't make it play again when I unmute the sound.. but that's for another topic that I'll open if I can't figure out.

 

Thanks for your help 👍

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.