thanks for your help & detailed answer. You're probably right about the module. I made that myself very quickly and it may not run on a real amiga.
I was able to fix my code. In particular this was plain wrong:
Code:
static UWORD hardware_period(int bytes, int hertz)
{
return ((UWORD) 100000000L / (bytes*hertz*28));
}
for the reason you explained, and also because (UWORD) 100000000L wraps to a small value, and the period always ended up being zero (when the cast isn't useful, I copied that wrongly from somewhere like Amiga Bible). fixed:
Code:
static UWORD hardware_period(int bytes, int hertz)
{
return ((UWORD) 100000000L / (bytes*hertz*28));
}
Code:
static UWORD hardware_period(int hertz)
{
return 100000000L / (hertz*28);
}
I'm sure I had hardcoded that at some point, and it didn't work, but there were too many things that didn't work. BTW there's a small error in your sample code (that you definitely should include in the player package). The sfx structure ends with 2 bytes, not words. It works but by luck. Fix:
Code:
sfx: dc.l sample
dc.w (sampleend-sample)/2,320,64
dc.b -1,1