mysoundhandle=loadsound("put your filename in here.")
if mysoundhandle=0 then runtimeerror("Probably your filename was wrong or it was an invalid sound file?")
repeat
if keyhit(57) then
;space bar was hit
mysoundchannelhandle=playsound(mysoundhandle)
;note normally you would record the channelhandle if you wanted to alter the volume, pause, or pan a sound while it is playing. You do not need to free the channelhandle produced by playsound, although you do need to free the soundhandle created from loadsound when tidying up memory
endif
until keydown(1)
freesound mysoundhandle
Hope that helps somewhat.
|