StopChannel.htm 2.0 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>StopChannel channel_handle</h1>
  8. <h1>Parameters</h1>
  9. <table>
  10. <tr>
  11. <td>
  12. channel_handle = variable assigned to the channel when played
  13. </td>
  14. </tr>
  15. </table>
  16. <h1>Description</h1>
  17. <table>
  18. <tr>
  19. <td>
  20. This command replaced StopSound in the latter versions of Blitz Basic. <br />
  21. <br />
  22. Once you have a sound playing, and a channel variable attached to it, you use this command to stop the sound. This works for all sound channel types, including MP3, WAV, MIDI, and CD track playback.
  23. </td>
  24. </tr>
  25. </table>
  26. <h1><a href=../2d_examples/StopChannel.bb>Example</a></h1>
  27. <table>
  28. <tr>
  29. <td>
  30. ; Channel examples <br />
  31. <br />
  32. Print "Loading sound ..." <br />
  33. ; Load the sample - you'll need to point this to a sound on your computer <br />
  34. ; For best results, make it about 5-10 seconds... <br />
  35. sndWave=LoadSound("level1.wav") <br />
  36. ; Prepare the sound for looping <br />
  37. LoopSound sndWave <br />
  38. <br />
  39. chnWave=PlaySound(sndWave) <br />
  40. <br />
  41. Print "Playing sound for 2 seconds ..." <br />
  42. Delay 2000 <br />
  43. <br />
  44. Print "Pausing sound for 2 seconds ..." <br />
  45. PauseChannel chnWave <br />
  46. Delay 2000 <br />
  47. <br />
  48. Print "Restarting sound ..." <br />
  49. ResumeChannel chnWave <br />
  50. Delay 2000 <br />
  51. <br />
  52. Print "Changing Pitch of sound ..." <br />
  53. ;StopChannel chnWave <br />
  54. ChannelPitch chnWave, 22000 <br />
  55. Delay 2000 <br />
  56. <br />
  57. Print "Playing new pitched 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=StopChannel&ref=comments target=_blank>here</a> to view the latest version of this page online</body>
  77. </html>