Need help for this bug I'm having.
Blitz3D Forums/Blitz3D Programming/Need help for this bug I'm having.
| ||
Ok, this is a rare thing, sometimes, and only sometimes, around once every 15-20 loadings of a whole level, I began to notice that some of the sound files were mute, explosions-sounds or shot-sounds or whatever, were not being played, it doesn't happen with all the sounds, only with one or two at a time, when I stop the program execution I found my sound variables had a cero value. Then, if a sound is not loaded and you don't do any check, then the debugger never returns an error, that is why the game level still loads completely and run without problems ... Try this code and you will see no error prompts: Graphics3D 320,240,16,2 c=CreateCube() listener=CreateListener(0) sound=0 SoundVolume sound,.5 SoundPitch sound,.5 PlaySound(sound) PlaySound sound chan=EmitSound(sound,c) ChannelVolume chan,.5 ChannelPitch chan,44100 Print "no errror at all" But above all, my question is, what possible reasons could there be to make a Load3DSound() or LoadSound() returns a 0 value? I mean, the sounds are there, the path is correct, and they are loaded without problems most of time ... so I don't know what to do since this is a bug I can not reproduce whenever I want to. Paolo. |
| ||
There are errors there, doing a Print "playsound: "+PlaySound(sound)prints '0' indicating an error, but obviously it's not a showstopping 'mav'. |
| ||
i guess either the sound file itself causes an error or, what is more likely, something in the code causes a conflict. you could try doing a huge test per sound file like this to see if the file itself is a problem. Graphics3D 640,480,0,2 Type wav Field ent End Type For i=1 To 5000 ;load sounds sound.wav=New wav sound\ent=LoadSound("media/ufo.wav") Next For sound.wav=Each wav ;all half volume level SoundVolume sound\ent,0.5 Next sound=Last wav ;play last sound PlaySound sound\ent For sound.wav=Each wav ;test for errors If sound\ent=0 Then Print "LoadSound handle="+sound\ent Next While Not KeyHit(1) Wend |
| ||
sound and movies depend heavily on drivers. Sounddrivers are often not so stabile, so it may happen that one app crashes the sound drivers and disables the soundsystem until the next reboot. If you try to open it in blitz now, it may return 0. However, when a sound wasn't loaded and you try to play it, or even when you do a "PlaySound 0" , the world will not explode. |
| ||
Thanks for the inputs. I was trying but I can't find a way to force the bug to happen ... so I think it may be something related with what jfk said ... who knows :) Paolo. |