Opened 16 years ago

Closed 16 years ago

Last modified 8 months ago

#928 closed defect (fixed)

ZAK256: Audio CD not handled properly

Reported by: SF/hibernatus Owned by: fingolfin
Priority: normal Component: Engine: SCUMM
Keywords: Cc:
Game: Zak McKracken

Description

Here is the format of an audio track sound:
First of all, the byte at 0xD tells you it's an audio track
(2). Nicer than testing the size.

The specific data starts at 0x16:
byte: track number
byte: number of times you play the track.
byte[3]: start (to cut the beginning of a song)
byte[3]: end

Here is how to read the start/end time:
value = (time[0] * 60 + time[1]) * 75 + time[2];
value is in 75ths of seconds (which means time[0] is in
minutes and time[1] is in seconds).

About the number of times to play:
0xFF means infinite
0 means "play once"
1 means "play twice", etc.

But i think it was a bug because there are only 2 sounds
which aren't looped infinitely (intro tune, and boom box
tune by Razor and the Scummettes), and both of them
are played twice while we'd logically expect them to be
played once.
I think the author thought 1 meant "play once".

Ticket imported from: #762593. Ticket imported from: bugs/928.

Change History (8)

comment:1 Changed 16 years ago by fingolfin

I implemented the changes you suggest here in CVS. Please
confirm if it helps once anon CVS has the changes (which might
take up to 3 days :-/)

comment:2 Changed 16 years ago by SF/hibernatus

It works but there's a bug.
To test it:
In 49.LFL at 0xA6FE, enter: 01 00 00 01 0A 00 for example
(which means play from 1m00s to 1m10s).
Now launch the game and listen to the intro music.
First, the beginning will be cut but not the end, and then
you'll hear a strange loop (wait a little, because there is an
8sec silence at the end of the track).
I tried with mp3 only, not CD.

About the "play once" thing: i was wrong, i've just checked
and zak.exp does play once when it reads 1. I just got fooled
by a script "bug" which plays the intro music twice (and of
course you never heard the 2nd time unless the music is
shortened).

comment:3 Changed 16 years ago by fingolfin

Actually after looking at the data Zak256 gives us, the second
value is *not* the endframe, rather it's the *length* of the data to
play! So you'r example tesll it to play from 1m00s till 2m10s.

comment:4 Changed 16 years ago by SF/hibernatus

I'm sorry (because you seemed happy in the cvs comment :),
but it's the end, not the length. At least in Zak.
I've just tried with Unz from 01 00 00 to 01 01 00 and it lasts
1 second. My example was good too.

comment:5 Changed 16 years ago by fingolfin

Sorry I was confused, and looking at LoomCD, somehow assuming
that's the same but it's not, and I just fixed a long standing
"problem": we called the two params for our CD playback
methods "startFrame" and "endFrame", but they really are
"startFrame" and "duration" - and that's the values we pass for all
games. Except for Zak256, where we pass the endFrame. So I just
made that "endFrame - startFrame". I hope that'll fix this bug.

comment:6 Changed 16 years ago by SF/hibernatus

Ah i see, somebody named the variable badly. I suggest some
hard punishment for that one :) And yes, now the bug is
gone, thanks a lot. I think you can close this bug report.

comment:7 Changed 16 years ago by fingolfin

Owner: set to fingolfin
Resolution: fixed
Status: newclosed

comment:8 Changed 8 months ago by digitall

Component: Engine: SCUMM
Game: Zak McKracken
Note: See TracTickets for help on using tickets.