Problem with PlaySound...

Blitz3D Forums/Blitz3D Programming/Problem with PlaySound...

OrcSlayer(Posted 2006) [#1]
Ok, this is strange. I assumed that when using playsound, it would NOT be a 3D sound. However, when I play my music using this command, or even playmusic, the result can be heard properly while my player is at 0,0,0, but quickly fades out as he moves away from that point.

I do use 3D sounds for in-game effects, obviously, and have a listener attached to the camera, but I really need to be able to use 2D sounds as well, which are the same regardless of player location.

Anyone know what's going wrong here?


Stevie G(Posted 2006) [#2]
Why not just create a music channel and assign the sound to that?

Stevie


OrcSlayer(Posted 2006) [#3]
I've tried it two ways:

Global Music = LoadSound("music.ogg")
LoopSound(Music)
PlaySound(Music)

Global Music = PlayMusic("music.ogg")

Both ways it acts like it's actually a 3D sound at position 0,0,0.

I did however try loading it as a 3D sound, setting it to loop, and emitting it from the cam (same as listener), and it seems to work properly.

Is this the only way it can be done?


Stevie G(Posted 2006) [#4]
Does this work?

global MUSIC = loadsound("music.ogg")
Loopsound( MUSIC )
global MUSICchannel = playsound( MUSIC )


OrcSlayer(Posted 2006) [#5]
Same result...I suppose I'll have to use it as a 3D sound emitted from the cam...though thanks for reminding me about the channel thing. I'll need to use that anyway so I can control the playback.


markcw(Posted 2006) [#6]
try this test, it shows all scene objects/entitys moving away from 0,0,0 won't affect playsound volume.
you'll need to load a valid sound file.




OrcSlayer(Posted 2006) [#7]
Ok, that helped me figure it out. If I add a listener in there it DOES act as a 3D sound positioned at 0,0,0, even if it's not loaded as one. So apparently if you use a listener for 3D audio (which in my game is obviously important), every audio file will be treated that way.