EmitSound.htm 2.1 KB

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