Hello,
I am having trouble with sound in Frotz on DOS, but it is likely operator error…
I recently learned to create my own Infocom-style SND files by creating a RAW file and adding the proper header. While testing, I found that Frotz 2.40 did not seem to care whether the repeats bit value was 0 or 1 (or what have you) in a Z3 story. Instead, it uses the third parameter from the opcode, just like Z5+.
So, I downloaded the latest (Frotz 2.55), and it can’t find any sound files at all. At this point, I decided the issue might be my game (and/or sounds), and I tried Lurking Horror in 2.55 – to find that it has the same issue.
Looking at the source code, Frotz seems to throw the missing sound error if it hasn’t loaded a blorb:
if (f_setup.blorb_file == NULL) {
runtime_error(ERR_SOUND_MISSING);
return;
}
It seems that the code concerning any SND files in a “sound” sub-folder will never run, since this error is thrown before that point (I think?). So, I created a blorb, but Frotz 2.55 still doesn’t find the sounds with a properly named blorb in the same directory.
I then commented that bit of code out and built Frotz 2.55 for DOS using Watcom on DOSBox, hoping it might load my SND files after that change. It seemed like it could work, because I see the code that uses the story name to build a string for the path, but it still played no sound (with no error message this time, since I’d removed this if
statement). So, I changed the code to just use my actual path for this specific test game, but there was still no sound.
At this point, I decided to find out when code was added to handle repeats based on Lurking Horror, but that code was there all the way back in 2.32 (if memory serves). So, I decided to pivot a little and test things in an even earlier version of Frotz. I ended up with frotzpl3 (which identifies itself as FROTZ V2.01+), and it reads the repeat bit from my SND files. It also lets me “stack” my calls to play sounds like so:
<SOUND 3 2 8> ;"This plays once"
<TELL "This \"music\" is terrible!" CR>
<SOUND 4 2 8> ;"This plays once after sound 3 finishes"
<TELL "...and it keeps getting worse!" CR> ;"This prints when SOUND 4 plays"
<SOUND 3 2 8> ;"This loops after sound 4 finishes, because the bit in its header is 0"
<TELL "MAKE IT STOP!!!" CR> ;"This prints when SOUND 3 plays the 2nd time"
That is the bee’s knees! I assume that’s how it used to work back when Lurking Horror was written? That seems to be the case, based on the routine with sounds 8 and 9 (and the routine with sounds 11 and 16).
I’m guessing the way this was handled needed to be changed when Windows Frotz was created.
Anyway, if I use Frotz 2.40, it works with SND files – just not the repeats bit from the headers when the story file is v3. Instead, v3 sounds are handled like v5 sounds (only we can’t include the fourth parameter for the “callback” routine when compiling to Z3, which is why I thought the “stacking” was so cool).
So, I need to change my <SOUND 3 2 8>
to <SOUND 3 2 264>
in the Z3 story’s code, adding 256 to tell it to play once. This is a little counter-intuitive to me, because in Z5+, <SOUND 3 2 8>
and <SOUND 3 2 264>
both only play the sound once. If we want a loop, we use <SOUND 3 2 -1>
.
This is fine, really, now that I know that’s how it works. My goal was to convert my own audio to a SND file that worked like the ones in The Lurking Horror, and I succeeded in that.
Now I’m just wondering if there’s something I’m missing when using Frotz 2.55. I built it using Watcom after commenting out the option to exclude blorbs. My soundt.z3 and soundt.blb files are in a folder along with frotz.exe. I don’t see a way to include the blorb from the command line on DOS (like the way it can be done using dfrotz from PowerShell), and I see in the source code where it builds the “filename**.blb**” string to look for the file.