toniebox-reverse-engineering / teddy

With this tool you can dump existing files for the famous audio box or create custom ones.
246 stars 32 forks source link

Teddy: Use two-digit numbers when decoding #51

Closed steve8x8 closed 10 months ago

steve8x8 commented 1 year ago

Currently (version 1.2.0 seems to be latest?), output filenames use the pattern "%s-%08X - Track #%d.ogg", with the original filename for the first variable, and - apparently - the audio ID for the second. It's the third variable part that breaks sorting order once there are more than 9 tracks. Since tonies are limited to 99 tracks, using "%02d" instead of "%d" should be sufficient to fix this.

I currently cannot use TeddyBench, therefore I'm unable to check whether it's affected as well.

PS.: Checking the source code (TonieAudio.cs) I'm now aware it's not C (line 856) and the suggested format string doesn't apply, but what about replacing

                    string fileName = Path.Combine(outDirectory, outFileName + " - Track #" + (chapter + 1) + ".ogg");

with something like

                    string fileName = Path.Combine(outDirectory, outFileName + " - Track #" + (chapter + 1) + ".ogg");
                    if (chapter + 1 < 10)
                    {
                        fileName = Path.Combine(outDirectory, outFileName + " - Track #0" + (chapter + 1) + ".ogg");
                    }

? (Should I set up a MR for this?)

steve8x8 commented 1 year ago

What about

int trackNum = chapter + 1;
string fileName = Path.Combine(outDirectory, outFileName + " - Track #" + trackNum.ToString("00") + ".ogg");

to avoid the conditional clause?

steve8x8 commented 10 months ago

Fixed by merge #53

steve8x8 commented 9 months ago

The previous comment should have had a trailing question mark...

If there was a new build of Teddy / TeddyBench we might find out. Any volunteers?