Opened 16 years ago

Closed 16 years ago

Last modified 12 months ago

#8321 closed patch

getElapsedTime() for sounds

Reported by: eriktorbjorn Owned by: eriktorbjorn
Priority: normal Component: Audio
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)

elapsed-time.diff (4.0 KB ) - added by eriktorbjorn 16 years ago.
Patch against a January 6 CVS snapshot

Download all attachments as: .zip

Change History (8)

by eriktorbjorn, 16 years ago

Attachment: elapsed-time.diff added

Patch against a January 6 CVS snapshot

comment:1 by eriktorbjorn, 16 years ago

Owner: set to fingolfin

comment:2 by SF/ender, 16 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 SF/ender, 16 years ago

Owner: changed from fingolfin to eriktorbjorn

comment:4 by eriktorbjorn, 16 years ago

Ok, I've applied the patch. I'll be looking at changing the
cutscene playback code shortly.

comment:5 by eriktorbjorn, 16 years ago

Status: newclosed

comment:6 by eriktorbjorn, 16 years ago

D'oh! Forgot to close it. :-)

comment:7 by digitall, 12 months ago

Component: Audio
Game: Broken Sword 1
Note: See TracTickets for help on using tickets.