Trying to understand and clear confusion in Github "mnum" update

I didn’t want to hijack the Additional Voicepacks thread, so here it is:

Just trying to clear this up because I think one of the two needs to be updated:

For me 1. & 2. are different:

  1. means: the “mnum” files are in the “mnum” folder, so the rest of the voice pack files should go in the “mnum” folder too ?
  2. next to mnum means: “dump everything (mnum folder included) in the root of the font” ?

@profezzorn, I believe, from your latest comment, that “1)” is incorrect and should be edited to:
"Basically it assumes that the voice pack files are in the same location as the “mnum” folder.

Am I right ?

(1) is just not very precise, what I meant was “in the directory where the mnum files/folder is”. What I actually wrote can be interpreted in multiple ways, and some of those ways are, as you point out, incorrect.

Note that mnum doesn’t have to be a folder, it could just be a set of files.

Now, if you’re not interested in how all of this actually works; stop reading now.

ProffieOS has a class called ‘Effect’. Each Effect has:

  • a name (“hum”, “mnum”, etc.)
  • smallest file number seen
  • largest file number seen
  • the directory the files were seen in
  • the file pattern, like “NAME##.wav” or “NAME/###.wav”

There is an Effect object for each sound effect, so there is one for “hum”, one for “clash”, etc.

When you switch the font path to something like “hero;common” the “hero” and the “common” directories are scanned, and all the effect objects are initialized so that we know how many files of each type there are.

When effect occurs, like a clash, we generate a file name based on what the effect class found during scanning. The effect class will tell how how many files were found, in what directory, and what the file pattern was, so it can quickly generate something like “hero/clsh/005.wav” without having to search through the files again.

However, voice pack files are different. There are a lot of them, and I didn’t want to have one Effect object for each one of them. For that reason I made it so that it would search for these files when you need them, rather than during the scan phase. The search is fairly simplistic though. When looking for maccept.wav, it would only look in “hero/maccept.wav” and “common/maccept.wav” (assuming your font path is “hero;common”).

The problem is that this doesn’t work with alt sounds. One way to fix this would be to check “hero/alt###/maccept.wav” and “common/alt###/maccept.wav” in addition to the two paths we already check, but this is both more code and more checks, which can slow things down.

Since “mnum” should be a part of all voice packs, we should already know the path to the voice pack. This means that we don’t need to search at all. If “mnum” exists in “hero/alt###/mnum”, then clearly maccept.wav should be in “hero/alt###/maccept.wav”. So basically we just take the directory from the mnum Effect, append “maccept.wav” and use that. No searching required, and it works with alt directories. And since we don’t need the old search code, it takes nearly the same amount of space in FLASH memory.

For most people, none of this matters. The only way you would notice a difference is if you have some of your voice pack files in your font directory, and the rest in “common”, and if that’s what you have, then there is a define for getting the old behavior back: SEARCH_FOR_SOUND_LIBRARY_FILES

2 Likes

I am definitely interested in how all of this works.

Thank you for the detailed explanation.

And also “hero/clsh/clsh05.wav”, correct ?

Disregarding the alt sounds, unless this new code is only supposed to work for alt sounds, what would/should happen if my font path is “hero;common” and my font has a subfolder named “voicepck” (missing the “a” to keep it at 8 characters) containing my whole voice pack sounds and mnum files/folder sounds ?

Will maccept.wav be found in “hero/voicepck/maccept.wav” if it exists before looking in common ?

Edit: probably wrong choice of words above, will ProffieOS find “hero/voicepck/mnum” and then just call “hero/voicepck/maccept.wav” ?

yes, that is correct

No.

Also no.

You would need your font path to be “hero;hero/voicepck;common” for this to work.

With ProffieOS 8.x you can set FONT_PATTERN to "*;*/voicepck;common", which will make this work even if you modify the font path with edit mode or similar options.

I was thinking about that while falling asleep.

But then each font must have a “/voicepck” sub-folder containing either:

  • a full voice pack
  • part of a voice pack, a few select files of my choosing
  • nothing at all

or else I would get error font_directory_not_found, correct ?

That is true if using OS8 “menues” but not if using FETT263_EDIT_MODE_MENU since @Fett263 has not (yet) incorporated FONT_PATTERN in his prop.

I’ll try to take a look at adding when I get some free time.

That would be great.

According to this post:

All you have to do is replace this:

strcat(font, ";common");
current_preset_.font = mkstr(font);

with this:

current_preset_.font = format_pattern(FONT_PATTERN, font);

And then FONT_PATTERN should become available to all saber_fett263_buttons.f users.

This should be a great addition to the collection!

That is correct.

1 Like