// 0 = no dissolve.. just play for as long as it's meant to be played
// this was used in older v2.4 and under games i THINK
// 1 = not used
// 2 = v2.9+ games used a shorter dissolve
// 3 (default) = v3 games used this dissolve pattern.. slightly longer
Is this true? Do interpreters 2.4xx and below not have any volume envelope decay happening? And do 2.9XX and V3 games have it, but with different lengths of "dissolve"?
If so, does this imply that the AGI interpreter is using software to manipulate the volume envelope?
Yes, that is correct. Earlier versions (2.440 and earlier) did not have the dissolve feature. Version 2.089 also had no global volume control (all notes played at whatever attenuation value assigned to the note). Global volume control was added in version 2.272.
In all versions the interpreter sets up a 60 Hz timer that manages sound output. When a sound is playing, at each tick, each channel is checked for a change in note, and then volume is set for each channel (by combining note attenuation with global attenuation).
Beginning with version 2.903, dissolve values were also combined to generate note volume. The dissolve data was an array of 68 bytes in 2.9x versions and 78 bytes in 3.x versions. At each timer tick, a pointer to the dissolve data would increment, until the end was reached (indicated by a value of 0x80h). If the sound was longer than that the last value was used, with no further dissolve changes. In 2.9x versions, the dissolve lasted 68 ticks (1.13 seconds), and in 3.x versions it lasted 78 ticks (1.3 seconds).
I haven't done much analysis of the hardware side of the sounds, so I don't know exactly how the sound chip is controlled. The IN and OUT port opcodes are used to manipulate the chip, but I don't know what exactly is happening.
Dissolve Data for 2.9x:
FE FD FE FF 00 00 01 01
01 01 02 02 02 02 02 02
02 02 03 03 03 03 03 03
03 04 04 04 04 05 05 05
05 06 06 06 06 06 07 07
07 07 08 08 08 08 09 09
09 09 0A 0A 0A 0A 0B 0B
0B 0B 0B 0B 0C 0C 0C 0C
0C 0C 0D 80
Dissolve data for 3.x:
FE FD FE FF 00 00 00 00
00 01 01 01 01 01 01 02
02 02 02 02 02 02 02 02
02 03 03 03 03 03 03 03
03 04 04 04 04 04 05 05
05 05 05 06 06 06 06 06
07 07 07 07 08 08 08 08
09 09 09 09 0A 0A 0A 0A
0B 0B 0B 0B 0B 0B 0C 0C
0C 0C 0C 0C 0D 80
If you want it, I could send you the assembly code for the sound functions so you can examine how the sound chip is manipulated.