Open Panzer

Open Panzer Help & Info => Open Panzer Help => Topic started by: osika on June 11, 2021, 10:17:45 PM

Title: Squeak settings
Post by: osika on June 11, 2021, 10:17:45 PM
First off I love the function of the 3 slots for random track squeaks and how adjustable it is! Great idea. My only issue is
it seems to work at times but not others? When it does it sounds great but other times, just won't kick in..curious if this is a common issue. Or if any way to get it to be more consistent? Interval setting is set at 1000/2000 2000/5000 3000/8000 mS
Title: Re: Squeak settings
Post by: LukeZ on June 13, 2021, 04:12:30 PM
Hi osika, as you know there is a minimum speed setting in OP Config right beneath the squeak timings, that determines what speed the model must achieve before the squeaks will become enabled. So if you are just moving slowly they may not come on.

Another thing which I don't think was ever documented in the Wiki, is that even when the model exceeds the minimum speed, the TCB waits 3 seconds before starting the squeaks. In my testing it sounded strange to me when the squeaks started right away, which is why I added that. And of course, even after the 3 second delay, there will also be the random delay based on your interval settings before any given squeak begins.

Anyway, if you are driving slow, or if you are doing a lot of stop-and-go driving (where you don't maintain a speed above the minimum for more than 3 seconds), then it could appear they are not working.

Of course it is possible there could be another issue, but that is less likely. You can do a test where you run the model beyond the minimum speed for greater than 3 seconds and the squeaks should always begin.
Title: Re: Squeak settings
Post by: osika on June 13, 2021, 11:09:11 PM
Hi Luke, thanks all makes sense. One thing though, could you reduce the 3 second minimum to 0 - 1 second?
As the setting minimum % speed before squeaking could adjust that better..as in 3 seconds it would be possible
to get a pretty high speed but if left at zero time, this then could allow the squeaks to start at 5 % 10% etc.
But either way..thanks!
Title: Re: Squeak settings
Post by: osika on June 14, 2021, 10:41:16 PM
I'll test again tomorrow but it does seem even when driving steady for more than 3 seconds and min speed set low 3% sometimes the squeaks don't happen? I tried setting the min max to the lowest settings too but that didn't effect it. Usually the TCB works fine and it is something else! But right now it seems the squeaks are not being activated.
Title: Re: Squeak settings
Post by: LukeZ on June 18, 2021, 09:20:01 PM
Hi Osika, my sincere apologies for the very slow reply. I certainly can remove the 3 second delay and I think it makes sense to do so. I will also try to see if I can reproduce the problem that you describe and figure out what is going on there. I know back when I was writing that I finally drove myself crazy with squeak noises and I've had them turned off ever since. Possibly a bug has crept in since.

I might be a bit slow to update the firmware, but rest assured I won't forget.
Title: Re: Squeak settings
Post by: osika on June 19, 2021, 09:22:04 AM
Thanks Luke! That would be awesome. When they activate it is a great effect. Tricky to get the right sounds but that is part of the fun
and can be experimented with. Activating a repeat sound layered over the engine is good too but the loop needs to be longer to sound right so the problem is when the tank stops, those sounds keep going on. So the random squeaks are great idea :)
Title: Re: Squeak settings
Post by: LukeZ on June 27, 2021, 06:39:25 PM
Hi Osika. I've posted a new version of TCB firmware that removes the 3 second delay before the squeaks can begin. Now they will simply begin whenever your vehicle speed exceeds the level that you specify.

The new firmware is 0.93.74 and you can download it in OP Config. You don't need to download a new version of OP Config.

I tried to reproduce your problem where sometimes the squeaks would not start at all, even after the delay. In my testing this never happened, they always came on eventually. Looking at the code I couldn't see anything that would prevent it from working correctly either. It is certainly possible that other sounds can interrupt or prevent a squeak from playing, if that other sound has a higher priority (for example, if you are firing the machine gun this may temporarily block the squeaks). But even so, those cases should be temporary and if you are still moving forward they should resume when the other sound is done.

Anyway you can give this new firmware a try, but please let me know if you still have the same problem.
Title: Re: Squeak settings
Post by: osika on June 28, 2021, 03:34:20 PM
Hey Luke,

Thanks for the firmware update! It seems sporadic in terms of squeaks going off?
Lowered engine parameter volume so I can make sure..and sometimes it triggers
but not others. Tried shutting engine on and off..turning everything on then off
and again sometimes it works and other times no squeaks:) ?

Tried both TCB boards and doing it on both so it is interesting.

I attached the settings to see if anything stands out to you.

Title: Re: Squeak settings
Post by: LukeZ on June 28, 2021, 07:50:23 PM
I am not really sure what could be causing this. I have made a change which may or may not help. Please give the attached Hex below a try.

You can load this hex using OP Config on the Firmware tab by clicking the "Use your own Hex" button instead of the get latest release button.
Title: Re: Squeak settings
Post by: osika on June 29, 2021, 08:38:20 AM
How cool Luke you fixed it! What ever you did..it worked..now squeaks activate perfectly :)
Title: Re: Squeak settings
Post by: LukeZ on June 29, 2021, 09:56:18 PM
Great! If you wouldn't mind, could you try one more test (attached below)? Whether it works or not will help me to understand what might have been the cause.
Title: Re: Squeak settings
Post by: osika on June 29, 2021, 10:15:25 PM
Sure will try tomorrow!
Title: Re: Squeak settings
Post by: osika on June 29, 2021, 10:41:39 PM
Do you want me to test on the board that is now working or test on the other board that I did not load the new hex onto yet?
Title: Re: Squeak settings
Post by: LukeZ on June 29, 2021, 10:52:13 PM
Good question. I would test on the board that is now working. If it still works, that will tell me something, or if it goes back to being broken, that will tell me something too. Either way it will be good information.

No hurry, and thanks for your help!

Title: Re: Squeak settings
Post by: osika on June 30, 2021, 09:09:16 AM
Works with both! Great fix what ever it was :)  Now working on getting the right sounds which is tricky but fun.
Title: Re: Squeak settings
Post by: LukeZ on July 01, 2021, 10:49:58 PM
Thank you very much for taking the time to do the test! I appreciate your help.

I have a few more updates that I am working on, completely unrelated to the sounds, and when I am done with those I will post a new official firmware version that includes this squeak fix. But until then you can use this testing firmware, it will be essentially the same thing as what I post later.

Good luck with finding the right sounds!
Title: Re: Squeak settings
Post by: osika on July 01, 2021, 11:35:13 PM
No problem and thanks for the solution!  Curious was it hard to figure out and execute? Seems like it would be.
Title: Re: Squeak settings
Post by: LukeZ on July 04, 2021, 09:28:02 PM
Curious was it hard to figure out and execute? Seems like it would be.
It took a little effort but by process of elimination I finally discovered the issue. As you noticed, the problem was that in some cases the squeaks were not turning on when the vehicle reached the minimum speed.

The simple way of turning on the squeaks would be something like this:
IF vehicle speed > minimum speed THEN turn on squeaks

This would work but is not what I had done, because it would turn on the squeaks every single time through the main loop as long as the speed exceeded the minimum. That doesn't hurt anything but it's unnecessary work since once the squeaks are on we don't need to turn them on again, unless we later drop below the minimum speed. I try to avoid this kind of activity because even though in this single case it doesn't really take much time, if I have hundreds of things that run like that it all ads up and we take time away from other tasks.

Instead what I had originally was something like this:
IF squeaks = off AND IF vehicle speed > minimum speed AND IF prior speed < minimum speed THEN turn on squeaks

This is a better approach because we only turn on the squeaks once when we need to, the rest of the time we skip this step. (There was a similar command in reverse for turning off the squeaks.)

The problem was that sometimes the prior speed was not getting updated correctly, or anyway, unusual states could be created when changing between forward and reverse quickly, for complicated reasons. The prior speed is only used in a few situations and back when I included it I didn't think through every situation since it was only important at certain times, and I made sure it worked at those times. Later I added the squeaks and just assumed I could always count on them to behave as I wanted for this purpose too. Most of the time that assumption was correct, which is why I never noticed a problem, but you found the case where it wasn't.

This is a very typical example of the kinds of issues that arise over time when new features are added. With 30,000 lines of code I can't remember everything so I often make assumptions about what ancient Luke did in the past. However that assumes ancient Luke was as smart as present Luke, or that ancient Luke thought ahead to what present Luke might wish he had done in the past, and that usually ends badly.  :D