Opened 21 years ago

Closed 21 years ago

Last modified 5 years ago

#8233 closed patch

Zak&MM: Sound support

Reported by: SF/hoenicke Owned by: SF/jamieson630
Priority: normal Component: Engine: SCUMM
Version: Keywords:
Cc: Game: Zak McKracken

Description

This patch adds sound and music support for zak and maniac mansion. The patch may break loom and other games that are GF_OLD_BUNDLE if they are not using the same format (is a GF_AFTER_V2 check needed?)

The patch consists of a small diff and two new files which should be copied to the scumm subdirectory.

Known bugs: When sound is idle there is a constant pulse. The intro doesn't sound completely right (it doesn't sound the same as my test program). Sometimes sound samples are omitted.

Ticket imported from: #743121. Ticket imported from: patches/338.

Attachments (2)

player_v2.zip (8.8 KB ) - added by SF/hoenicke 21 years ago.
sound patch archive
spk2wav.c (26.4 KB ) - added by (none) 21 years ago.
spk2wav (or rather spk2dsp :)

Download all attachments as: .zip

Change History (12)

by SF/hoenicke, 21 years ago

Attachment: player_v2.zip added

sound patch archive

comment:1 by SF/khalek, 21 years ago

yes a GF_AFTER_V2 check should be used, another bug to add to your list... when playing maniac when you press a button on the keypad and it plays sound 64 I think ScummVM seems to lock up and needs to be manually killed.

nice work though, will be great once all the bugs are sorted out :)

comment:2 by SF/khalek, 21 years ago

ah keypad bit not related to sound patch at all it would seem oops

comment:3 by SF/jamieson630, 21 years ago

Owner: set to SF/jamieson630

comment:4 by SF/jamieson630, 21 years ago

Fingolfin and I have been going over the source from which this patch is based (thanks for all the info on your Web site, Hoenicke). Due to the unusual pointer-based parameter access used by the music scripts, this code is not endian- safe. Furthermore, the fact that the pointers are treating a the ChannelInfo struct as a flat array causes problems on systems that align structure members differently. Finally, some of the global arrays are generating more than 1,300 warnings under Microsoft Visual C++.

I'm going to go through the original source (NOT the patch) and try to clean up the pointers and make everything endian- safe (with Fingolfin's help). After we get the original utility working across platforms, my recommendation is that the functionality be encapsulated into the MidiDriver and MidiParser classes we have now. The V2 games don't necessarily have to go through iMuse (it might just complicate things needlessly), but the waveform generator in this code should be made available to post-V2 games such as MI2, so that we can offer support for the 'SPK' PC-speaker- based music resources therein.

by (none), 21 years ago

Attachment: spk2wav.c added

spk2wav (or rather spk2dsp :)

comment:5 by SF/hoenicke, 21 years ago

Jamieson630: I think the problem you had with spk2wav.c and AUTHENTIC_SOUND was that level wasn't declared static. I fixed that now.

Also the freqmod_table should be uint8, which should fix most of the warnings. The hulls array has both int16 and uint16 entries. Maybe some explicit casts will fix the warnings.

The channel_info struct should become an array with some predefined constant indices to fix the struct-alignment issues.

I think only place where READ_LE_INT16 was missing is execute_cmd() (several places, look for (int16*)script_ptr).

comment:6 by fingolfin, 21 years ago

Yeah we discussed all that last night (see #scummvm channel logs). Jamieson already made a version which also works on my BE system and fixes those issues, but he's asleep right now I guess (well I hope, for his health :-)

Thanks

comment:7 by SF/hoenicke, 21 years ago

To correct myself: freqmod_table must be signed, i.e. int8 I corrected spk2wav.cpp (which khalek published) and put it at http://csd.informatik.uni-oldenburg.de/~hoenicke/scummvm/

You only need to copy the array constants.

comment:8 by SF/jamieson630, 21 years ago

I've added the player to CVS. Any upgrades (I believe you were working on loom script commands, Hoenicke?) can be patched against that. I'll continue looking into doing a MidiDriver encapsulation of this code.

comment:9 by SF/jamieson630, 21 years ago

Status: newclosed

comment:10 by digitall, 5 years ago

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