Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow Callback 33 (sound effect) to trigger continuous (looping) sound effects #5473

Closed
DorpsGek opened this issue Feb 16, 2013 · 5 comments
Closed
Labels
component: NewGRF This issue is related to NewGRFs flyspray This issue is imported from FlySpray (https://bugs.openttd.org/)

Comments

@DorpsGek
Copy link
Member

Pikka opened the ticket and wrote:

Callback 33 states that event 7 and 8 are "called every 16 engine ticks", which if I'm right is every 432ms.

However, playing a sound using those events causes the sound to be played - at least on my machine - at intervals of 372ms (short) or 560ms (long), in the pattern

lllsllsllsllslls

Can this be fixed? Better yet, can we get an event that will play a sound /every/ engine tick, and grf authors may use the animation counter to choose their own interval?

Test GRF attached.

Attachments

Reported version: trunk
Operating system: All


This issue was imported from FlySpray: https://bugs.openttd.org/task/5473
@DorpsGek
Copy link
Member Author

frosch wrote:

I have the impression that you are trying to play a sound continuously by starting it over and over and giving it the duration until it is started next.

I don't think that is the right solution to the problem. Instead there should be a way to enable looped playback, which makes a sound play repeatedly until the GRF says something else. The "something else" part could also only take affect when the sound finished the next time, so it is not interrupted and the next sound effect is appended smoothly.

Making the GRF try to figure out when a sound might be finished to start a new one will easily break if something in OTTD is delayed.


This comment was imported from FlySpray: https://bugs.openttd.org/task/5473#comment12015

@DorpsGek
Copy link
Member Author

Pikka wrote:

I have no problem with delays, I'm not trying to get perfect looping. But the pattern in the irregularity is striking; it makes me think there's a counter that's not quite working properly.


This comment was imported from FlySpray: https://bugs.openttd.org/task/5473#comment12016

@DorpsGek
Copy link
Member Author

Pikka wrote:

lllsllsllsllslls is 16 "events" long, so it seems the pattern repeats every 256 ticks. So what's creating this pattern? Something in the sound playback thread? And is it the same pattern for everyone, on every computer?


This comment was imported from FlySpray: https://bugs.openttd.org/task/5473#comment12027

@DorpsGek
Copy link
Member Author

frosch wrote:

This is for sure platform specific. Assuming you are using windows, the interval between ticks is controlled by GetTickCount().

The msdn documentation at
http://msdn.microsoft.com/en-us/library/windows/desktop/ms724408%28v=vs.85%29.aspx
says: "The resolution of the GetTickCount function is limited to the resolution of the system timer, which is typically in the range of 10 milliseconds to 16 milliseconds."


This comment was imported from FlySpray: https://bugs.openttd.org/task/5473#comment12028

@DorpsGek
Copy link
Member Author

andythenorth closed the ticket.

Reason for closing: Won't implement

Flyspray clean up: more than 5 years old, and not obvious what should be done with this next, so closing. If this offends, discuss with andythenorth in irc. Thanks. Also hi Pikka.


This comment was imported from FlySpray: https://bugs.openttd.org/task/5473

@DorpsGek DorpsGek added flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) component: NewGRF This issue is related to NewGRFs enhancement labels Apr 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: NewGRF This issue is related to NewGRFs flyspray This issue is imported from FlySpray (https://bugs.openttd.org/)
Projects
None yet
Development

No branches or pull requests

1 participant