Question: How to add another sound channel?

@Draconis and @mathbrush 's sound addons?

I tried having a go at it by modifying the extension but I’m not clever enough

(I want to add a channel for the environment loops)

(my background is my OST)
(my foreground is my SFX)
(my midground occasionally plays things that overlap both, eg spell casting and other voices)

so I need a space for the blowing of trees or rushing of rivers for example

i was just adding these into their own soundtracks but this causes the sound track to have to replay from the start when entering a new environment

Is this the Music by Daniel Stelzer one?


From past posts I believe that is so:

I just tried to see if there was any easy way to add an extra channel but there’s some I6 (for dereferencing) that is too subtle for me to adjust.

1 Like

This is the code that would need to change. Maybe the Inform 10 version will make this possible without using I6.

A sound channel is a kind of value. The sound channels are foreground, background, midground, and environmental.

Include (-

Global gg_midgroundchan = 0;

Global gg_envchan = 0;
Constant GG_ENVCHAN_ROCK 413;

[ MidgroundCreate;
	if (glk_gestalt(gestalt_Sound, 0)) {
		if (gg_midgroundchan == 0)
			gg_midgroundchan = glk_schannel_create(GG_MIDGROUNDCHAN_ROCK);
		if (gg_envchan == 0)
			gg_envchan = glk_schannel_create(GG_ENVCHAN_ROCK);

-) before "Glulx.i6t".

And then, to map from the I7 value to the I6 value:

[ DereferenceChannel channel N;
		1: N = gg_foregroundchan;
		2: N = gg_backgroundchan;
		3: N = gg_midgroundchan;
		4: N = gg_envchan;
		default: N = -1;
	return N;

The details of why it has to be done this way are a massive headache, but in general, if you search for “midground” and duplicate any lines that refer to it specifically, you’ll be off to a good start.


Replies sincerely appreciated!

1 Like