|
|
Line 122: |
Line 122: |
|
| |
|
| === Sound === | | === Sound === |
| * Sound - [http://qmt.ath.cx/~quietust/scumm/maniac/music.txt] | | * Still need to link in an NES APU module to get sound output; otherwise, Player_NES is complete. |
| | |
| Sound Format:
| |
| uint16 length (added by extract util)
| |
| uint8 slot - specifies which slot the sound plays in - 2 for music, 0/1/4 for sound effects
| |
| - slot 4 sound effects appear to play in slot 0, but only if no music is playing?
| |
| uint8 type - 10 (0x0A) for sound effects, 100 (0x64) for music
| |
| uint8 data[]
| |
| | |
| Type 10 data:
| |
| [03/07/0B/0F] - next 4 bytes is data for sound channel 0/1/2/3 (square1, square2, triangle, noise)
| |
| [10] - next byte is a number of frames to wait before processing the next update
| |
| [FE] - loop back to beginning
| |
| [FF] - terminate sound
| |
| | |
| Type 100 data:
| |
| uint8 auxLen - specifies length of auxiliary data blocks
| |
| uint8 noteInstrs[auxLen] - Specifies the instrument of each predefined note
| |
| uint8 noteFreqs[auxLen] - Specifies the pitch of each predefined note
| |
| uint8 music[]:
| |
| 00 thru (auxLen-1) - start playing a note using the specified instrument at the specified pitch
| |
| auxLen thru (auxLen+15) - update the note playing in the specified instrument (?)
| |
| (auxLen+16) thru 0xFF - delay N-auxLen-16 frames before parsing next byte
| |
| [FE] - loop back to beginning
| |
| [FF] - terminate sound
| |
| | |
| There are a total of 16 instruments, spread out over the 4 NES sound channels using the following mapping:
| |
| A total of 28 commands exist within the sound engine, each tied to one or more instruments.
| |
| Sound channels: (00 = square A, 01 = square B, 02 = triangle, 03 = noise)
| |
| * 00 00 00 00 00 00 00 01 01 01 02 02 01 03 03 03
| |
| Start commands:
| |
| * 05 03 06 08 0B 01 01 1A 16 06 04 17 02 10 0E 0D
| |
| Update (?) commands:
| |
| * 0F 00 00 09 00 14 15 00 00 00 1B 1B 0F 0F 0F 0F
| |
| To make matters worse, each command automatically chains to another after a set number of frames:
| |
| 00 -> xx
| |
| 01 -> xx
| |
| 02 -> xx
| |
| 03 -> xx
| |
| 04 -> 17 (3)
| |
| 05 -> xx
| |
| 06 -> 07 (3)
| |
| 07 -> xx
| |
| 08 -> xx
| |
| 09 -> 0A (5)
| |
| 0A -> 09 (8)
| |
| 0B -> 0C (3)
| |
| 0C -> 00 (0?)
| |
| 0D -> 00 (0?)
| |
| 0E -> 00 (0)
| |
| 0F -> 00 (0)
| |
| 10 -> 11 (2)
| |
| 11 -> 12 (2)
| |
| 12 -> 11 (2)
| |
| 13 -> 03 (0)?
| |
| 14 -> xx
| |
| 15 -> xx
| |
| 16 -> 18 (3)
| |
| 17 -> 00 (0)?
| |
| 18 -> 19 (3)
| |
| 19 -> 00 (0)?
| |
| 1A -> 00 (0)?
| |
| 1B -> 00 (0)?
| |
| | |
| Behavior of each command has not yet been determined
| |