-
Notifications
You must be signed in to change notification settings - Fork 155
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug?] Custom voice alerts assume contiguous and ascending ordering in voice.ini #999
Comments
That is why I just append new voices to the end and have a excel to create the file just in case. But it would be nice if the file supported non-contiguous |
I was never overly satisfied with the whole voice handling, but it grew out of limits due to unidirectional communication with dfplayer and ram limitations on some targets. If we use internal id's in the model files, those can't be edited manually anymore, which is also not a good solution. |
The current implementation already uses internal ids in model files, they just happen to look like the real mp3 ids. Manual editing shouldn't get any harder after the change. Although on the topic of causing new issues, I realise now that that naive fix could screw up model files for users who have non-standard edited voice files that unknowingly hit this bug. |
I went ahead and made a branch with this fixed: https://github.com/somewhatlurker/deviation/tree/model-voiceid-fix |
Can you make a PR? It's always easier to have Travis checking things early on. |
Sure |
Not necessarily a huge issue, but I noticed it when playing around in emulator.
Custom alerts in
voice_map
seem to be created by writing to indexes 200+ in the order alerts are found in the file, not corresponding to the key in voice.ini.While the firmware seems to handle this fine internally (the order of alerts in the selector changes, but they're played using the correct id from voice_map), model files just store the internally used index and will break if voice.ini is merely reordered.
For example, two voice.ini files containing
200=0,300\n201=1,300
and201=1,300\n200=0,300
in the custom section are handled differently. (In the second case, alert 200 in model files is actually1
(mp3 file 201) and alert 201 is0
(mp3 file 200))It's a very non-intuitive behaviour and I assume it's not intentional.
It seems pretty simple to fix; ids in the model file should just have to be converted to the proper internal id:
when saving: (src/config/model.c line 1385 -- near
fprintf(fh, "[%s]\n", SECTION_VOICE);
?)look up the correct id of music in voice_map
when loading: (src/config/model.c line 1030 -- near
if (MATCH_SECTION(SECTION_VOICE)) {
?)iterate on voice_map until an entry with id == val is found (a little slow, but probably fine)
if no match return 0
The text was updated successfully, but these errors were encountered: