Opened 16 years ago

Closed 16 years ago

Last modified 6 years ago

#8870 closed patch

AudioStream play length querying

Reported by: lordhoto Owned by: fingolfin
Priority: normal Component: Audio
Version: Keywords:
Cc: Game: Kyrandia 3



here's a fixed length audio stream class implementation I made. It's being used in a patch for bug #1497437, for audio/video sync like the original does there (see attached patch there). Since I'm not sure if this is the way we want to go with it I posted this on the patch tracker.

Currently missing: - Derive MP3, OGG/Vorbis and FLAC streams from FixedLengthStream, I'm not sure on how to achieve it since I'm totally unfamiliar with that code and the respective APIs

Ticket imported from: #1970427. Ticket imported from: patches/975.

Attachments (2)

audiostream.patch (5.0 KB ) - added by lordhoto 16 years ago.
patch against current svn
audiostream_v2.patch (2.2 KB ) - added by lordhoto 16 years ago.
patch against current svn (Fingolfin's suggestion)

Download all attachments as: .zip

Change History (10)

by lordhoto, 16 years ago

Attachment: audiostream.patch added

patch against current svn

comment:1 by fingolfin, 16 years ago

Hi, could you explain what the purpose of this is? I.e. from the description of this tracker item, it is totally unclear to me what a "Fixed size" stream does what another stream doesn't ... ?

comment:2 by lordhoto, 16 years ago

The purpose is, that the new added class 'FixedLengthAudioStream' is able to query its playtime. (Which isn't possible currently without it, or I missed some things :-). Without it, it isn't possible to get the playtime of for example VOC files (well it is, if you use the plain VOC extract, which doesn't create an AudioStream on it's own), with this patch it is also possible to derive classes like the mp3, ogg/vorbis and flac player from it, so the engines creating stream objects are able to query the playtime of those. Kyra uses it for example to determine how long certain animations have to be played.

comment:3 by fingolfin, 16 years ago

As stated on IRC, I agree that we absolutely need some way to query a stream for its total playing time, in order to make kyra work right. So that's agreed.

As to the way: My personal "taste" prefers adding an "int32 getTotalPlayingTime()" method to AudioStream itself, with a default implementation which returns UNKNOWN_TOTAL_PLAYING_TIME = -1 or something like that.

Also, I wonder why your getPlayTime() method takes a "rate param" ? Your patch doesn't seem to use it... And streams are always played with their built-rate anyway, I think... ?

by lordhoto, 16 years ago

Attachment: audiostream_v2.patch added

patch against current svn (Fingolfin's suggestion)

comment:4 by lordhoto, 16 years ago

Just made a patch for your suggestion and attached it.

No there's no real reason, at first I thought maybe Kyra3 did something for its "Helium" mode support internally too, but I couldn't find anything. (In Kyra3 the audio files are played at a different sample rate for that effect).

File Added: audiostream_v2.patch

comment:5 by lordhoto, 16 years ago

Summary: Fixed Length Audio Stream classAudioStream play length querying

comment:6 by fingolfin, 16 years ago

Status: newclosed

comment:7 by fingolfin, 16 years ago


comment:8 by digitall, 6 years ago

Component: Audio
Game: Kyrandia 3
Note: See TracTickets for help on using tickets.