[A89] Re: sound
[Prev][Next][Index][Thread]
[A89] Re: sound
Check out the JESystems Sound tutorial at http://jesystems.cjb.net, but it seems to be down right now. Or, check out Flib, by François Leiber, at leiber.free.fr. Here is the source of the beep function, copied from the source. The JESystems tutorial is based off it, I believe:
/////////////////////////////////////////////////////////////////////////////////////////
// Joue une note de fréquence 'freq' pour une durée 'duree'.
//
// Plays a note at frequency 'freq' for a time 'duree'.
/////////////////////////////////////////////////////////////////////////////////////////
void beep(short freq, long duree)
{
unsigned long *rombase = (unsigned long*)((*(unsigned long*)0xC8) & 0x600000), hwpb = *(rombase+65); // Pour détecter le hardware,
long loop, maxloop = freq*duree/50 ; // adaptation de la méthode de JM.
short i, j = peekIO(0x60000E) ;
OSSetSR(0x0700) ;
freq = (hwpb-(unsigned long)rombase < 0x10000 && *(unsigned short *)hwpb > 22 ? (*(unsigned long *)(hwpb + 22) == 1 ? 278000 : 364000) : 278000)/freq ;
pokeIO(0x60000C, 6) ;
for (loop = 0 ; loop < maxloop ; loop++)
{
pokeIO(0x60000E, j ^= 0x03) ;
for (i = 0 ; i <= freq ; i--) i += 2 ;
}
pokeIO(0x60000E, j &= 0xFC) ;
pokeIO(0x60000C, 0x8D) ;
OSSetSR(0x0000) ;
}
I'm sure it is copyrighted. The full source is at http://leiber.free.fr/ti/flib/Source.zip
---------------------------------
Do You Yahoo!?
Yahoo! Shopping - Mother's Day is May 12th!
References: