Page 1 of 1

I don't know how SoundRange3D works or there is a bug !

Posted: Fri Jan 09, 2015 1:24 pm
by falsam
I think the function SoundRange3D() work fine if a sound is on a node located at 0,0,0.

■ Snippet code (The distance between the camera and the node is always the same.)

Code: Select all

Enumeration
  #Mainform
EndEnumeration

InitEngine3D()
InitKeyboard()
InitSprite()

OpenWindow(#Mainform,0, 0, 800, 600, "", #PB_Window_SystemMenu)
OpenWindowedScreen(WindowID(#Mainform), 0, 0, 800, 600, 0, 0, 0)

Add3DArchive(#PB_Compiler_Home + "Examples/3D/Data/", #PB_3DArchive_FileSystem)
 
Camera = CreateCamera(#PB_Any,0,0,100,100)
CameraBackColor(Camera, RGB(145, 182, 201))

;Test Sound (x=y=z = n)
n = 0 ;Test with a zero value then the value 400 

;The distance between the camera and the node is always the same.
MoveCamera(Camera, n+500, n+500, n+500)
CameraLookAt(Camera, n, n, n)

;Load Sound
WaterFallSound = LoadSound3D(#PB_Any, "Siren.ogg")

If WaterFallSound 
  WaterFallNode = CreateNode(#PB_Any, n, n, n)
  CreateEntity(#PB_Any, MeshID(CreateSphere(#PB_Any, 25)), #PB_Material_None, n, n, n)  ;Node Landmark
  AttachNodeObject(WaterFallNode, SoundID3D(WaterFallSound))
  SoundVolume3D(WaterFallSound, 100)
  SoundRange3D(WaterFallSound, 100, 800)
  PlaySound3D(WaterFallSound, #PB_Sound3D_Loop)
EndIf 

Repeat
  Repeat
    Event  = WindowEvent()
    Select Event
      Case #PB_Event_CloseWindow
        End
        
    EndSelect
  Until Event = 0
  
  If ExamineKeyboard()
    
    If KeyboardPushed (#PB_Key_Escape)
      Break
    EndIf
  EndIf
  
  RenderWorld(80)
  FlipBuffers()  
  
ForEver

Re: I don't know how SoundRange3D works or there is a bug !

Posted: Sat Jan 10, 2015 9:42 am
by Bananenfreak
@Alexi:
How to use this? Can we load it or which way to go?

@Topic:
I agree, it´s not functional. Also I can´t hear anything if I use n=500.
Is there also an IMA on your pc (On End)? http://www.purebasic.fr/english/viewtop ... =4&t=59473

Re: I don't know how SoundRange3D works or there is a bug !

Posted: Sat Jan 10, 2015 12:33 pm
by falsam
Bananenfreak wrote:Is there also an IMA on your pc (On End)
No IMA if i press escape key or close button.

Re: I don't know how SoundRange3D works or there is a bug !

Posted: Sun Jan 11, 2015 12:17 pm
by Bananenfreak
falsam wrote:No IMA if i press escape key or close button.
Very misterious...

Re: I don't know how SoundRange3D works or there is a bug !

Posted: Wed Jan 28, 2015 3:02 pm
by falsam