bsasaki@uhunix1.uhcc.Hawaii.Edu (04/30/91)
Hello, Whilest programming my game in Pascal 6.0, I wanted to add some sounds into the game, beeps, boops and such.. but upon reading the manual. (RTFM) it required a delay.. sound(45); delay(100); to hear the sound. I was wondering how to go about making a beep, without having to delay the whole game for .. delay(100) or whatever.. can it be done in regular pascal? Would be neat if I could add perhaps a background music also. also, can somebody direct me to ,(if there is..) perhaps a library of sound effects for the ibm in turbo pascal? thanks. newbie. 'hard work never hurt anybody.. but why take the risk?'
John G. Spragge <SPRAGGEJ@QUCDN.QueensU.CA> (05/01/91)
There are two ways to do it. Cheap & dangerous: REPEAT getinput (cmd); IF (CLOCK - startnote > notelen) AND NOT endsong THEN BEGIN getnextnote (tone, notelen); SOUND (tone) END ELSE NOSOUND; docmd (cmd, done); UNTIL done; In other words, put the sound generator in your main program loop, and check, change, or end the sound on each pass through. BIG danger: if your program slows down, your ditty gets distorted, and drives the user bats. Hard and safe: use the timer to drive your song. I think someone posted it here last year; information should be available at some FTP site. disclaimer: Queen's University supplies me with computer services, not my opinions. John G. Spragge