Opened 16 years ago

Closed 9 years ago

Last modified 12 months ago

#7315 closed enhancement

FMTOWNS: Missing opcodes

Reported by: SF/hibernatus Owned by: athrxx
Priority: normal Component: Engine: SCUMM
Keywords: Cc:


Hi, here are what the missing FM Towns opcodes are
supposed to do:

in resourceRoutines:
- case 0x20: Does nothing. Never used.

- case 0x21: Does nothing. Never used.

- case 0x23: Sets the CD loudness (just a guess, not
confirmed by UNZ).
Used in Loom (CD loudness divided by 2 while a pattern
is played).
Not implemented in Indy3 (it reads getVarOrDirectByte
(0x20) and breaks).
Takes 2 bytes (resid and foo in the current code). Must
be for stereo, but then left == right everywhere.

- case 0x24: Sets the loudness of a sound resource.
Used in Indy3 and Zak.
My guess is that foo is left loudness and bar is right
loudness, but UNZ doesn't play stereo :)
If foo + bar == 0 (which includes FF + 01 for example),
the default loudness will be used.
The default loudness is at 0x0E and 0x0F in the sound

- case 0x25: Sets the pitch of a sound resource.
Used in Indy3 and Loom.
If foo == 0, the sound is played normally.
pitch = foo - center semitones.
"center" is at 0x32 in the sfx resource (always 0x3C in
zak256, but sometimes different in Indy3).

in startMusic:
- case 0xFF: Gets the CD loudness.
Used in Loom (when the CD loudness is divided by 2 with
It returns (left + right + 1) / 2.

About the loudness and pitch:
In the original engine there's an array which contains the
loudness and the pitch of each sound.
After a sound is played (startSound), the pitch and
loudness are reset.
So if you set a pitch +1 and then play the sound twice
you'll hear +1 then +0.
At least that's how it worked with Indy3.

(for ender: i had already added a struct in the
disassembly, now you can replace field0 by count, field1
by left, field2 by right and field3 by pitch)

Ticket imported from: #805691. Ticket imported from: feature-requests/131.

Change History (9)

comment:1 by fingolfin, 16 years ago

Owner: set to fingolfin
Status: newclosed

comment:2 by fingolfin, 16 years ago

This isn't a bug. However the very useful information in here has
been added in form of TODO comments to the source code,
including a pointer to this tracker item. Thanks!

comment:3 by Kirben, 16 years ago

Owner: fingolfin removed
Status: closednew

comment:4 by SF/khalek, 16 years ago

just to update those not on irc etc,
loom towns does set the cd volume lower when doing things
like playing notes.

Hibernatus requested this be moved to feature requests and

comment:5 by athrxx, 9 years ago

Owner: set to athrxx
Status: newpending

comment:6 by athrxx, 9 years ago

Can this be closed?
All the above opcodes have been implemented.

We still don't support volume or balance settings for "real" CD audio (only for mp3/ogg/flac tracks). But this would be a different feature request.

I set this item to pending.

comment:7 by SF/sf-robot, 9 years ago

Status: pendingclosed

comment:8 by SF/sf-robot, 9 years ago

This Tracker item was closed automatically by the system. It was
previously set to a Pending status, and the original submitter
did not respond within 14 days (the time period specified by
the administrator of this Tracker).

comment:9 by digitall, 12 months ago

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