looping a 3d sound

Blitz3D Forums/Blitz3D Programming/looping a 3d sound

I'm trying to make a fly buzz. with the load3dsound()
and emitsound(). How do i loop this sound?

I've tried loopsound and that does loop the sound
but then the sound won't stop playing after
the first object has emmited the first sound.

I also tried syncing it by length of sample, but this is
unsatisfactory..

Any ideas folks?

You could try StopChannel to stop it.

Store the Channel emitsound returns
then use ChannelPlaying(Ch_Buzz) to see if it is playing


If ChannelPlaying(Ch_Buzz)=0 then

Ch_Buzz=EmitSound(Sound_Buzz,Fly)

End if




tried both of the above:(

sug1: ICECAP
Loopsound just will not stop no matter what I try.
Tried stopchannel, channel volume etc, no good.

IS it legal to use loopsound with a 3dsound?
why is there not a loop 3d sound command?

sug2:Luke H
( if channelplaying etc) causes a nasty little
glitch each time the sound is restarted.

as i said I've tried syncing the length of the sample to
the framerate/logic update, still it glitches. @ 50fps
or at 85 fps( outside the tween loop)

I even made a 20ms sample to last exzctly one frame
glitch, glitch......

and yes the sample does loop seamlessly...

any other suggestion more than welcome...

sound=loadsound("thingie.wav")
chn=emitsound(sound,carrier)
...
if mousehit(1) then pausechannel chn
if mousehit(2) then resumechannel chn

BTW:
"Loopsound just will not stop no matter what I try.
Tried stopchannel, channel volume etc, no good."

You're kiddin? Stopchannel works.

The only thing I can think of is that you are setting off two or more looping sounds on the same 'channel', thus:

chan% = EmitSound(buzz,bee1)
chan% = EmitSound(buzz,bee2)

doing this, you will never ever be able to stop 'bee1' from buzzing, because you've overwritten the channel pointer with the second call to EmitSound.

thanks for all the help:) problem solved...

I had more strange problems yesterday while editing/creating sounds.....

anyway I tracked down the problem, it was my wave editor app
running in the BG and confusing my cheap and nasty sound card.I presume....

This works ( with no wave editor app running), as thought it should..

buzzSnd = load3dsound(buzzsnd$)
loopsound(buzzSnd)

on creation of each fly,

o\chan = emitsound(bussSnd,o\entity)

on death of said fly...
o\chan = stopchannel(args)

and hurrah No clicky glitches....
look out for the wallFish...;)

Oh and I noticed links to people's stuff
can I, how do I?

cheers folks

I guess they're in the FAQ:
http://www.blitzbasic.com/faq/faq_entry.php?id=2