maxint-rd / MmlMusic

Arduino library to play multi-track MML music using different sound devices.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

continuePlaying() reads beyond numbers at end of string

maxint-rd opened this issue · comments

When ending the play-string with a number (eg. "T120 O4 G16") the parser may read beyond the end of the string and play whatever is next in memory. That could be another play-string which is then also played, but it could also be something else.
Workaround: use alternative notation (eg. "T120 O4 L16 G") or an addional terminator (eg. "T120 O4 G16\0").

What is the cause of this? Is this just using the stack and not calculating and allocating memory?

Just curious before I start looking, I need this fixed. and null termination doesn't seem to be working reliably for me.

I haven't debugged this yet. It's probably just a bug in the section that converts the number part from the string. Have you tried the alternative notation that I mentioned (see issue). What you could also try is adding some spaces.

I am having better luck now, not sure what changed, I will just use a wrapper for now and null terminate and see if it happens again. Thanks, I did a quick look , and the code was a bit more that my knowledge of mml atm, so I could not really trace it.

Good to read you have some success. I don't know when, but if I found time to debug and fix this, I will publish the new version here on GitHub and update this issue.

Another issue I would like to improve is multi-channel synchronization, but that isn't as easy and digging into that rabbit hole will take some more time. You can follow to be notified of updates.

Fixed in commit b2e7d2a