3Dsound problems
Blitz3D Forums/Blitz3D Programming/3Dsound problems
| ||
Hi there... is it possible to delete a channel created with emitsound() or to stop this channel ? camera=CreateCamera() CreateListener(camera) sound=load3dsound("test.wav") loopsound sound Ch_sound = emitsound(sound,cube) ... and now delete or stop Ch_sound |
| ||
Press F1 for the Help file. Select 2D - Category. Click Sound/Music. You want to be looking at all the Channel commands. Yes, I know... the 3Dsound channel controllers are in the 2D section.(?) |
| ||
Ch_sound is the channel handle (if memory serves :) ), so yes, simpy say StopChannel Ch_sound ... |
| ||
Thanks for your help, But in fact the problem I have is : ********* StopChannel works well Graphics3D 640,480 SetBuffer BackBuffer() camera=CreateCamera() cube=CreateCube() PositionEntity cube,0,0,3 CreateListener(camera) Intro=Load3DSound("intro.mp3") LoopSound(Intro) CH_Sound=EmitSound(Intro,cube) While Not KeyDown( 1 ) If KeyDown(16) Then StopChannel(CH_Sound) EndIf RenderWorld Flip Wend End ********* StopChannel doesn't work Graphics3D 640,480 SetBuffer BackBuffer() camera=CreateCamera() cube=CreateCube() PositionEntity cube,0,0,3 CreateListener(camera) Intro=Load3DSound("intro.mp3") LoopSound(Intro) While Not KeyDown( 1 ) If KeyDown(30) Then CH_Sound=EmitSound(Intro,cube) EndIf If KeyDown(16) Then StopChannel(CH_Sound) EndIf RenderWorld Flip Wend End |
| ||
You should be doing:Graphics3D 640,480 SetBuffer BackBuffer() camera=CreateCamera() cube=CreateCube() PositionEntity cube,0,0,3 CreateListener(camera) Intro=Load3DSound("ExcuseMe.wav") LoopSound(Intro) CH_Sound=EmitSound(Intro,cube) While Not KeyDown( 1 ) If KeyDown(30) ; A StopChannel(CH_Sound) ' ******* CH_Sound=EmitSound(Intro,cube) EndIf If KeyDown(16) ; Q StopChannel(CH_Sound) EndIf RenderWorld Flip Wend End Always use StopChannel() before EnitSound() otherwise a new instance is created. Also you should be liberally sprinkling your code with ChannelPlaying() queries. |
| ||
Ok, it works well, thanks John and Jfk for your help ! |