I believe there is an error at row 2076, 2077 in Player.cs

Jun 21, 2012 at 1:02 PM
Edited Jun 21, 2012 at 1:06 PM

in Player.cs at row 2076 and 2077.

is:

if (a.Period > 8000)
    a.Period = 8000;

should be:

if (a.Period > 7680)
    a.Period = 7680;

Thanks for an otherwise great library.

//Peter Mattsson

Jun 25, 2012 at 10:23 AM

hi,


Before all things I wanted to thank you for your generosity.


On this issue that you mentioned, it is the result of transcription of the original Mikmod source code. I had no documentation about it. Despite my tests with different modules, this value never exceeds 7680. However I'm curious how you found this result. If this allows Sharpmod to evolve, it is with pleasure that I would include your suggestion.

Jun 26, 2012 at 8:37 AM
Edited Jun 26, 2012 at 7:02 PM

Hi again.

 

The fault appears when playing this module.

http://amp.dascene.net/downmod.php?index=92625

Somewhere in the middle of the module there is a period with the value 7740. Which is parsed to -60 in GetFreq2(). And When trying to get the position of -60%768 in the lintab array the library crash... obviously... since there is no negative indexes in that array.

It's quite some time ago now since I made my own little modplayer for a demo on my Amiga (12-15 years ago or so). But I'm quite sure that the documentation says that a "period" should not have values above 7680.

 

I've made some other adjustments to the library for making it more suitable for a WP7 mod player that I'm thinking of releasing. I will try to clean up my code (it looks horrible right now) and provide the most important of these changes to you (a couple of .mod playback improvements and finding the end of some looping songs.). But this bug I thought was quite important to inform you about since it produces a crash.

Jun 26, 2012 at 3:48 PM

you're absolutely right !

I still had in mind the old method of calculating the frequency that did not use the conversion table.

Thank you, you just solved a bug for sharpMod, but also mikmod which I was inspired !

Jun 26, 2012 at 7:01 PM

No problem. Always happy to help. :)