#8321 closed patch
getElapsedTime() for sounds
Reported by: | eriktorbjorn | Owned by: | eriktorbjorn |
---|---|---|---|
Priority: | normal | Component: | Audio |
Version: | Keywords: | ||
Cc: | Game: | Broken Sword 1 |
Description
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.
Attachments (1)
Change History (8)
by , 21 years ago
Attachment: | elapsed-time.diff added |
---|
comment:1 by , 21 years ago
Owner: | set to |
---|
comment:2 by , 21 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 , 21 years ago
Owner: | changed from | to
---|
comment:4 by , 21 years ago
Ok, I've applied the patch. I'll be looking at changing the cutscene playback code shortly.
comment:5 by , 21 years ago
Status: | new → closed |
---|
comment:7 by , 6 years ago
Component: | → Audio |
---|---|
Game: | → Broken Sword 1 |
Patch against a January 6 CVS snapshot