Re: [Inform] Sound


Tue, 28 Nov 1995 12:17:15 -0500

jools@arnod.demon.co.uk (Julian Arnold) writes:
> The SZM 0.2 says,
> In Version 5 and later, a game should have bit 7 of `Flags 2' set in its
> story file if it wants to use sound effects. The interpreter should then
> clear this bit if it cannot oblige.
>
> Just when, and indeed how, should I set this bit? Do I do something like
> `0->16=0->16 & 7;' in the Initialise routine? Or is that totally wrong?

If I understand correctly, the capability flags must actually be set
in the game file itself. Setting them programmatically in Initialize
(or even Main) is too late; the interpreter checks them before it
starts running the program.

The best way to handle this is to add a new directive to Inform which
sets whichever flags you want as it generates the game file. (Just as
#Release sets the release number in the game file header.) I expect
that Graham already has plans to toss this in the next release.

> Also, when should I "finish with" a sound? Just after starting it, or does
> this stop it immediately? Should I instead finish with it at a point where I
> know for certain it has stopped "naturally"?

Logically, when you "finish with" a sound, the interpreter is allowed
to release any resources associated with playing it -- a sound
channel, the digital sound data, whatever. So you shouldn't do it
until the sound is finished. Actually, you don't have to do it at all;
you could load all your sounds at the beginning of the program and
never finish them off at all. (Interpreters short on memory might have
trouble, but I think they're supposed to be written as bullet-proof as
possible, so the trouble would just be extra loading delays.)

> Should I `@sound_effect 1 #r$Routine;' or `@sound_effect 1 0 0 #r$Routine;'?

Looks liks '@sound_effect 1 2 1 #r$Routine;' Sound number 1, 2 means
start playing, volume 1, routine.

I know most ZIP ports support at least the '@sound_effect 1;' beep,
but do any handle the full opcode plus the callback?

--Z

"And Aholibamah bare Jeush, and Jaalam, and Korah: these were the borogoves..."