CorsixTH icon indicating copy to clipboard operation
CorsixTH copied to clipboard

[Bug] Sounds missing from Research Window

Open lewri opened this issue 2 years ago • 1 comments

Describe the issue

In Theme Hospital, the game would play the noise of the rat going round in its wheel. In CorsixTH this is missing.

Steps to Reproduce

  1. Load a game with a research dept

  2. Open research window.

Save Game

Expected Behavior

The sounds should be playing

System Information

CorsixTH Version: 0.65.1

Operating System: Windows 10 Theme Hospital Version: GOG

Gamelog.txt

Paste gamelog.txt output here

Additional Info

Paste any screen shots or other additional information that might help illustrate the problem.

I did some tinkering first to try getting this working, but it isn't elegant enough because the sound will play its full duration even if the window is closed (e.g. the loop just starts again, you close the window, the sound now has to finish even though the window is gone) In UIResearch:UIResearch(ui)

self.ui = ui
self.playing = false -- for background sound

New function

function UIResearch:playBgSound()
  self.ui:playSound("Research.wav", function() self.playing = false end)
  self.playing = true
end

Added to UIResearch:onTick()

if not self.playing then self:playBgSound() end

Potentially, to make this work better, we're missing the ability to stop sounds on the fly (like we can with music).

lewri avatar Mar 07 '22 22:03 lewri

Do we have any way to destroy a sound once a window is closed? I imagine this is the only thing missing to make this one work.

lewri avatar May 16 '23 21:05 lewri