Audio issue
Blitz3D Forums/Blitz3D Beginners Area/Audio issue
| ||
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? |
| ||
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 |
| ||
JFK, Now it works perfectly! But I still don't understand what was wrong with my original code ?? |
| ||
"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. |
| ||
of course JFK BUMMER from my side ... |