Opened 19 years ago
Closed 19 years ago
Last modified 4 years ago
#8321 closed patch
getElapsedTime() for sounds
|Reported by:||eriktorbjorn||Owned by:||eriktorbjorn|
|Cc:||Game:||Broken Sword 1|
This patch adds the getElapsedTime() function that we discussed recently.
I had originally envisioned it as being part of the AudioStream class, but that turned out to be impractical for several reasons. Most importantly, the mixer may call readBuffer() several times in rapid succession in order to buffer up sound, which made it hard to get a reliable value for the number of samples that had actually been consumed. Instead, it is now part of the Channel class, and accessed through a method in the SoundMixer class.
Converting the Broken Sword cutscene animation to use this function instead of the current method should be trivial. (I did it for half of the BS2 code for a test case, but that isn't included in the patch.)
If this patch is accepted, we can probably get rid of getSamplesPlayed(). I think it's only used by the Broken Sword games, and it's not working very well.
There are a few things in the code that could probably be cleaned up a bit. For instance, getElapsedTime() needs to access the get_msecs() function, and currently does so through g_system.
Also, there is nothing to handle the case where sound is paused.
Ticket imported from: #892455. Ticket imported from: patches/426.
Change History (8)
by , 19 years ago
comment:1 by , 19 years ago
comment:2 by , 19 years ago
Since Fingolfin still hasn't commented, the verdict is that somebody should commit this (and appropriate patches against the BS1 and BS2 playback code).
comment:3 by , 19 years ago
comment:4 by , 19 years ago
Ok, I've applied the patch. I'll be looking at changing the cutscene playback code shortly.
comment:5 by , 19 years ago
|Status:||new → closed|
comment:6 by , 19 years ago
D'oh! Forgot to close it. :-)
comment:7 by , 4 years ago
|Game:||→ Broken Sword 1|
Patch against a January 6 CVS snapshot