glk 0.7.4 sound calls

My understanding is that the ability to pause a sound was introduced in glk 0.7.4.

As my main machine’s a Mac, my sound-making interpreter is out-of-date Gargoyle and I understand it supports an earlier glk.

At least for purposes of helping me test my game while trying to write in up-to-date sound features, I wondered if my game can distinguish whether it’s running in a glk 0.7.4 interpreter or earlier, soundwise?

Looking at the 0.7.4 spec, it says to test the following gestalt to see if an interpreter has all sound powers (or alternately, not all of them, or none of them, which would both give a 0 if I read this right):

glui32 res;
res = glk_gestalt(gestalt_Sound2, 0);

Then it says the old calls are no longer needed, but you can test them. So I could check the following one to see if an interpreter has the more basic sound powers:

res = glk_gestalt(gestalt_Sound, 0);

Sooo, am I right to think that if I check the first one and get a 1, I’m in glk 0.7.4 and have all powers-

  • and that if I check the first one and get a 0, I could then check the second one, and if I get a 1 there, I’m back in an earlier glk, with sound, but without the latest sound code?

(and 0 and 0 would mean no sound at all)

This would help because then I could have the game just stop a sound instead of pause it when running in an interpreter which lacks the ability to pause.



A couple of points:

  1. The new sound stuff was added in Glk 0.7.3, but that doesn’t make much difference.
  2. The gestalt test could return 0 even for a Glk 0.7.3 library - not all libraries necessarily support sound.

Having made those rather nit-picking points, your basic strategy is right. If you test for gestalt_Sound2 and get back a 1, then all the sound stuff described in the Glk 0.7.3 specification is available to you, including pausing. If you get back a 0, but testing for gestalt_Sound gives you back a 1, then you’ve got the older sound functions, but not the new ones.

OK, thanks David.