ChannelVolume.htm 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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>ChannelVolume channel_handle, volume#</h1>
  8. <h1>Parameters</h1>
  9. <table>
  10. <tr>
  11. <td>
  12. channel_handle = variable assigned to the channel when played <br />
  13. volume# = volume level floating value between 0 and 1
  14. </td>
  15. </tr>
  16. </table>
  17. <h1>Description</h1>
  18. <table>
  19. <tr>
  20. <td>
  21. While SoundVolume happily changes the volume of the entire program, this command will let you adjust volume rates on a 'per channel' basis. Extremely useful. <br />
  22. <br />
  23. The volume value is a floating point value between 0 and 1 (0 = silence, .5 = half volume, 1= full volume). You can do other cool stuff like ChannelPitch and ChannelPan too!
  24. </td>
  25. </tr>
  26. </table>
  27. <h1><a href=../2d_examples/ChannelVolume.bb>Example</a></h1>
  28. <table>
  29. <tr>
  30. <td>
  31. ; Channel examples <br />
  32. <br />
  33. Print "Loading sound ..." <br />
  34. ; Load the sample - you'll need to point this to a sound on your computer <br />
  35. ; For best results, make it about 5-10 seconds... <br />
  36. sndWave=LoadSound("level1.wav") <br />
  37. ; Prepare the sound for looping <br />
  38. LoopSound sndWave <br />
  39. <br />
  40. chnWave=PlaySound(sndWave) <br />
  41. <br />
  42. Print "Playing sound for 2 seconds ..." <br />
  43. Delay 2000 <br />
  44. <br />
  45. Print "Pausing sound for 2 seconds ..." <br />
  46. PauseChannel chnWave <br />
  47. Delay 2000 <br />
  48. <br />
  49. Print "Restarting sound ..." <br />
  50. ResumeChannel chnWave <br />
  51. Delay 2000 <br />
  52. <br />
  53. Print "Changing volume of sound ..." <br />
  54. ChannelVolume chnWave, .5 <br />
  55. Delay 2000 <br />
  56. <br />
  57. Print "Playing new half-volume sound ..." <br />
  58. Delay 2000 <br />
  59. <br />
  60. Print "Left speaker only" <br />
  61. ChannelPan chnWave,-1 <br />
  62. Delay 2000 <br />
  63. <br />
  64. Print "Right speaker only" <br />
  65. ChannelPan chnWave,1 <br />
  66. Delay 2000 <br />
  67. <br />
  68. Print "All done!" <br />
  69. StopChannel chnWave <br />
  70. </td>
  71. </tr>
  72. </table>
  73. <br>
  74. <a target=_top href=../index.htm>Index</a><br>
  75. <br>
  76. Click <a href=http://www.blitzbasic.co.nz/b3ddocs/command.php?name=ChannelVolume&ref=comments target=_blank>here</a> to view the latest version of this page online</body>
  77. </html>