PC-Logix / OpenFM

Streaming radio mod for Minecraft, with OpenComputers control support
MIT License
25 stars 17 forks source link

Sound duplicate if a player dies and respawn near a active radio block #80

Open vico93 opened 4 years ago

vico93 commented 4 years ago

Minecraft 1.12.2 Forge 14.23.5.2854 OpenFM-1.12.2-0.1.0.19

If a player dies near a playing radio block and respawn near (if the radio is next to the bed for example), OR dies, respawn in world spawn and gets teleported to near the radio, the audio gets duplicated. One audio can be controlled stopping the radio block, but the other not and keeps playing regardless of the radio block playing or not. To mitigate it any player who dies near a playing radio block need to exit the server and rejoin so only the active audio stay.

TheAirBlow commented 2 years ago

Mod starts playback when the RadioTileEntity.startStream() is called, and it is called when: 1) The RadioTileEntity is instantiated 2) When the client receives a Sync/Play/StreamURL packets

The first one is probably the issue. We have to stop all music threads when we respawn, and it would probably fix it. Basically, the RadioTileEntity gets reloaded when we respawn (I think), and the old AudioPlayer never gets unloaded, so we get duplicated AudioPlayer

vico93 commented 2 years ago

So happy to see this mod still getting attention. Honestly i even forgot that i created this issue 2 years ago xD.

I hope someday i could see this mod ported to Fabric (and for modern versions of Minecraft)...

TheAirBlow commented 2 years ago

So happy to see this mod still getting attention. Honestly i even forgot that i created this issue 2 years ago xD.

I hope someday i could see this mod ported to Fabric (and for modern versions of Minecraft)...

I am currently rewriting this mod completely. Would be still 1.12.2 forge, but after that I would probably port it to 1.14 and higher.

The Radio Tuner is fully implemented with a lot of new features: 1) Select multiple speakers at the same time 2) Speaker can only be connected to one radio 3) Selected speakers are highlighed with a nice animation 4) Allow for removing speakers instead of adding 5) Allow for getting information about how many speakers are connected

Sadly I am currently stuck at NBT syncronisation, but it would probably be done soon. I found a nice library that converts any audio format to Opus (it can be played very easily), which would make this mod support a lot more more formats. It's called LavaPlayer.

vico93 commented 2 years ago

So happy to see this mod still getting attention. Honestly i even forgot that i created this issue 2 years ago xD. I hope someday i could see this mod ported to Fabric (and for modern versions of Minecraft)...

I am currently rewriting this mod completely. Would be still 1.12.2 forge, but after that I would probably port it to 1.14 and higher.

The Radio Tuner is fully implemented with a lot of new features:

  1. Select multiple speakers at the same time
  2. Speaker can only be connected to one radio
  3. Selected speakers are highlighed with a nice animation
  4. Allow for removing speakers instead of adding
  5. Allow for getting information about how many speakers are connected

Sadly I am currently stuck at NBT syncronisation, but it would probably be done soon. I found a nice library that converts any audio format to Opus (it can be played very easily), which would make this mod support a lot more more formats. It's called LavaPlayer.

Oh looking so much forward for this!