BluSunrize / ImmersiveEngineering

Wires, transformers, high voltage! Bzzzzt!
Other
790 stars 394 forks source link

(v0.3.1) [Bug] Crusher sound occasionally gets looped and stuck #119

Closed jawsawn closed 9 years ago

jawsawn commented 9 years ago

Sometimes it gets stuck. Breaking the multiblock and remaking it is the only solution

jawsawn commented 9 years ago

Actually found a way to reproduce: 1-Give Crusher multiple items just so make it work longer 2-Press Esc and stop the game 3-Looped Crusher sound

EDIT: Not always does this but sometimes

cobra commented 9 years ago

This also happened to me with a diesel generator. There was still a stuttering sound effect after switching it off. Additionally, it sounded like there where several generator sounds running at once - this single generator was very loud, much louder than a different one far away. Breaking a single block fixed this - until forming the multiblock again. The very instant it formed, the stuttering sound was there again. Even removing every block and restarting minecraft didn't help. Occured in 0.2.4 and 0.3.1.

BluSunrize commented 9 years ago

Will look into it.

BluSunrize commented 9 years ago

Can't really reproduce...

cobra commented 9 years ago

I just updated to 0.3.2, rebuilt the generator, formed it and all I got was this lousy stuttering sound (without any biodiesel added). Some seconds (still without biodiesel) a normal running sound was added, forcing me to turn down block volume. When I tried breaking the radiator with the diesel drill (3x3x1 steel head), this crash happend; maybe this will give you a hint. Maybe it's just another bug.

Log (slightly shortened): http://pastebin.com/xc5HAFJV

I'll try to minimize my setup and reproduce it.

cobra commented 9 years ago

I managed to reproduce this behaviour in two new worlds (with multiMC as launcher)

Modlist (MC 1.7.10)

How to reproduce:

  1. create new world
  2. give yourself all the needed blocks and items
  3. place down furnace, heater, add (HV) connector, lever, activate lever
  4. place generator blocks, form multiblock
  5. add (HV) connector to generator, connect both connectors
  6. add fluiducts, creative tank, fill with biodiesel, set to output
  7. wait until the heater energy buffer is full, generator starts stuttering
  8. wait a little bit, then pause MC.
  9. wait a little bit, return, goto 8.
  10. become deaf / flee from angry neighbours / mute speakers

setup: http://i.imgur.com/grAVlXI.png (the second lever at the generator seems to be irrelevant, I couldn't reproduce this bug with the lever. Only the rapid stuttering when using not enough power broke the sound for me) My (completely unqualified) guess: the generator is toggling its running state too fast for the sound engine to catch up, "leaking" sound sources when interrupted at the wrong moment.

FYI: In my first test world with this exact setup I managed to crash with the same error as linked above directly after hitting the generator block with the hammer. This didn't yet happen again.

Terpo commented 9 years ago

A found a quite easy way to get a sound loop for the crusher. Build one crusher, give it power and some items. Then build another one next to it. (got one space between). Tested with the newest git version.

cobra commented 9 years ago

I built 2a5b2a1 and tried again in a completely new world, but this problem isn't yet solved. Same behaviour as above, pausing minecraft causes duplicate sounds. Sometimes a single sound source is active even in the "game menu" screen (this isn't new and is a rather rare event).

cobra commented 9 years ago

I've looked at these sound issues again. I couldn't reproduce the crusher issue @Terpo described more than once, but could find the cause for the generator sound glitches. These happened even when opening and closing the chat; every time you close the chat line, the generator gets a bit louder and there's one ore more sounds which won't ever disappear until relogging (mostly tested in singleplayer, both on linux and windows, but it also happens in multiplayer).

The sound handling code in Immersive Engineering appears to be working as intended, but minecraft itself seems to glitch when stopping a sound very fast after calling playSound. It looks like Mekanism experienced some sound issues as well, see this comment mentioning problems with the sound thread.

The easiest solution for this is avoiding stuttering sounds, either by adding an energy buffer and running the generator only when there's enough free capacity to run it longer than just one or few more ticks or playing the sound effect a little longer than the generator is running when it's been on only for a very short period of time. I added such a minimum delay between starting and stopping a sound. This solved this problem for me - 20 ticks seems to be just enough to prevent it most of the time, 30 is definitely enough even when hammering ESC or very rapidly toggling chat.

What are your thoughts on this, @BluSunrize? I could send you a pull request if you're fine with adding the minimal-sound-duration workaround or just a diff in case you want to play around with this for yourself without adding it to the repo.