Load3DSound.htm 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <html>
  2. <head>
  3. <title>Blitz3D Docs</title>
  4. <link rel=stylesheet href=../css/commands.css type=text/css>
  5. </head>
  6. <body>
  7. <h1>Load3DSound ( file$ )</h1>
  8. <h1>Parameters</h1>
  9. <table>
  10. <tr>
  11. <td>
  12. file$ - filename of sound file to be loaded and used as 3D sound
  13. </td>
  14. </tr>
  15. </table>
  16. <h1>Description</h1>
  17. <table>
  18. <tr>
  19. <td>
  20. Loads a sound and returns its handle for use with EmitSound.
  21. </td>
  22. </tr>
  23. </table>
  24. <h1><a href=../3d_examples/Load3DSound.bb>Example</a></h1>
  25. <table>
  26. <tr>
  27. <td>
  28. ; Load3DSound Example <br />
  29. ; ------------------- <br />
  30. <br />
  31. Graphics3D 640,480 <br />
  32. SetBuffer BackBuffer() <br />
  33. <br />
  34. camera=CreateCamera() <br />
  35. PositionEntity camera,0,1,-10 <br />
  36. <br />
  37. light=CreateLight() <br />
  38. RotateEntity light,90,0,0 <br />
  39. <br />
  40. plane=CreatePlane() <br />
  41. ground_tex=LoadTexture("media/Chorme-2.bmp") <br />
  42. EntityTexture plane,ground_tex <br />
  43. <br />
  44. cube=CreateCube() <br />
  45. cube_tex=LoadTexture("media/b3dlogo.jpg") <br />
  46. EntityTexture cube,cube_tex <br />
  47. PositionEntity cube,0,1,0 <br />
  48. <br />
  49. microphone=CreateListener(camera) ; Create listener, make it child of camera <br />
  50. sound=Load3DSound("media/ufo.wav") ; Load 3D sound <br />
  51. <br />
  52. While Not KeyDown(1) <br />
  53. <br />
  54. If KeyDown(205)=True Then TurnEntity camera,0,-1,0 <br />
  55. If KeyDown(203)=True Then TurnEntity camera,0,1,0 <br />
  56. If KeyDown(208)=True Then MoveEntity camera,0,0,-0.05 <br />
  57. If KeyDown(200)=True Then MoveEntity camera,0,0,0.05 <br />
  58. <br />
  59. ; If left mouse button hit then emit sound from cube <br />
  60. If MouseHit(1) = True Then EmitSound(sound,cube) <br />
  61. <br />
  62. RenderWorld <br />
  63. <br />
  64. Text 0,0,"Use cursor keys to move about" <br />
  65. Text 0,20,"Press left mouse button to make a sound be emitted from the cube" <br />
  66. <br />
  67. Flip <br />
  68. <br />
  69. Wend <br />
  70. <br />
  71. End
  72. </td>
  73. </tr>
  74. </table>
  75. <br>
  76. <a target=_top href=../index.htm>Index</a><br>
  77. <br>
  78. Click <a href=http://www.blitzbasic.co.nz/b3ddocs/command.php?name=Load3DSound&ref=comments target=_blank>here</a> to view the latest version of this page online</body>
  79. </html>