leezer3 / OpenBVE

OpenBVE- A free train simulator
http://www.openbve-project.net
281 stars 51 forks source link

[Bug] Run sounds continue playing when train is stationary #1067

Closed SavageKris4851 closed 1 month ago

SavageKris4851 commented 1 month ago

Description

Overtime when operating a train, you will start to notice that the run sounds on a train may continue to play even when the train is stationary or running at lower speeds. This often occurs when the game freezes for a bit due to it loading more objects further into the route. This bug has been going on for a while now and I'm surprised this hasn't been reported yet.

https://github.com/user-attachments/assets/28d3e7de-331f-4aef-af30-e2c9a0afe5f0

Reproduction

  1. Load any train on any route (preferably longer routes)
  2. Operate for a reasonable amount of time.

Route

Any, preferably longer routes.

Train

Any

Logs

No crash, no log.

Related information

leezer3 commented 1 month ago

I can't reproduce this at the minute.

The code looks relatively sensible as well, nothing jumping out at me as being able to cause this.

Please can I have a specific route and train combination that reliably reproduces for you please? Whilst you say all trains / routes. this often turns out not to be the case.

I'd also like to know what you consider to be a 'reasonable' amount of time- 10 minutes? 20 minutes?

SavageKris4851 commented 1 month ago

This relatively happens on all of my routes and trains. Would you like me to send you the specific ones that I used in the clip? Also yes, about 20-30 minutes into the route.

leezer3 commented 1 month ago

Please, if you could link me to the specific ones in the clip that'd be helpful.

(I can see they're NYCTA of some description, but I don't immediately recognise exactly which variant)

SavageKris4851 commented 1 month ago

Here is the content in question: https://drive.google.com/drive/folders/1q_4qQNV6-sFsbAE_Gkx3Zoy1YKjFd8o9

Theoretically, would it have something to do with the bogie command that is used on the train? All of my trains use the bogie command instead of the traditional car command and so maybe that might also be a factor.

leezer3 commented 1 month ago

That's somewhat interesting.

I can reproduce with that, but I don't have any immediate answers.

A TLDR: A relatively recent change was to pause run sounds / flange sounds, as opposed to stopping and restarting them. This is useful for avoiding glitches with longer sounds and fast changes between them. This seems to be having trouble with your train- If we set the run sounds to stop, it works correctly.

Still investigating, but might be later in the week before we have any real answers.

leezer3 commented 1 month ago

OK, please try the build from today: https://vps.bvecornwall.co.uk/OpenBVE/Builds/OpenBVE-2024-10-08.zip

This alters the pause behaviour to only apply to the current run / flange sound. The others are then stopped on fade-out. That keeps most of the intent of the change intact, and I think is the best I can do. This no longer rerproduces on my machine with your combination above.


As far as I can tell, it's OpenAL (or possibly the system audio drivers) broken here- It's reporting that the sounds are paused, but they're still playing.

SavageKris4851 commented 1 month ago

After testing the build, I can confirm that I can no longer reproduce the bug. No other issues on my end and I will definitely update you if this occurs again. Thank you so much for the speedy fix! :)