Audio issue

Blitz3D Forums/Blitz3D Beginners Area/Audio issue

Hansie(Posted 2003) [#1]
all,

this is weird: look below

Local infinite% = 1
Local maxvolume# = 1

If vh_fadeintro_sfx = LoadSound ("audio/fade-intro.wav") = True Then
SoundVolume (vh_fadeintro_sfx,maxvolume)
PlaySound (vh_fadeintro_sfx,infinite)
Else
RuntimeError "error" 
End If 
	
While Not KeyHit(1)

Wend

FreeSound (vh_fadeintro_sfx)

End


The above sample code works FINE if I *exclude* the "if" and "end if" .. but as soon as I add the "if" to check if the file exists (which is does!) the code exits with runtimeerror!

WEIRD!!!

Suggestions?


jfk EO-11110(Posted 2003) [#2]
Personally I think this isn't a fully correct way of use of the LoadSound command. while in other Languages such assignements might work properly, I woulndt event try it in Blitz.
Instead try this:
vh_fadeintro_sfx = LoadSound ("audio/fade-intro.wav")
If  vh_fadeintro_sfx <> false Then
 SoundVolume (vh_fadeintro_sfx,maxvolume)
 PlaySound (vh_fadeintro_sfx,infinite)
Else
 RuntimeError "error" 
End If 



Hansie(Posted 2003) [#3]
JFK,

Now it works perfectly! But I still don't understand what was wrong with my original code ??


jfk EO-11110(Posted 2003) [#4]
"true" has a value of 1 which is completely diffrent from the value of the sound handle. You can ask if it's <> false (or diffrent from zero), but you cannot compare it to 1.


Hansie(Posted 2003) [#5]
of course JFK

BUMMER from my side ...