View Single Post
  #1  
Old 10-09-2002, 12:38 AM
R0bin R0bin is offline
Banned
R0bin's Avatar
Join Date: Oct 2002
Location: Wales, UK
Posts: 828
R0bin is on a distinguished road
Send a message via AIM to R0bin
New sound function

Function to get the length of a sound / music file in the memory.

E.g. Like imgwidth.. soundlength(soundfile)

play stef23.mid;
this.length=soundlength(stef23.mid);

Also a function to find the current position of the file.

currentsoundpos(stef23.mid);

or you could use indexes instead of the filename, but it would mean changing the play function to be more like showimg

play 56,stef23.mid;
if (currentsoundpos(56)>soundlength(56)-2000) {
fadeout();
}
function fadeout() {
for (i=1;i<-0.05;i-=0.05) {
setmusicvolume i,i;
}
}

the currentsoundpos return value would be in milliseconds, so would the sound length. hence the "-2000" part in my script, because 2000 milliseconds is 2 seconds
Reply With Quote