PauseChannel.htm 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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>PauseChannel 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. When you are playing a sound channel, there may come a time you wish to pause the sound for whatever reason (like to play another sound effect). This command does this - and the channel can be resumed with the ResumeChannel command. You can use StopChannel to actually halt the sound. This works with any channel playback (WAV, MP3, MIDI, etc.).
  21. </td>
  22. </tr>
  23. </table>
  24. <h1><a href=../2d_examples/PauseChannel.bb>Example</a></h1>
  25. <table>
  26. <tr>
  27. <td>
  28. ; Channel examples <br />
  29. <br />
  30. Print "Loading sound ..." <br />
  31. ; Load the sample - you'll need to point this to a sound on your computer <br />
  32. ; For best results, make it about 5-10 seconds... <br />
  33. sndWave=LoadSound("level1.wav") <br />
  34. ; Prepare the sound for looping <br />
  35. LoopSound sndWave <br />
  36. <br />
  37. chnWave=PlaySound(sndWave) <br />
  38. <br />
  39. Print "Playing sound for 2 seconds ..." <br />
  40. Delay 2000 <br />
  41. <br />
  42. Print "Pausing sound for 2 seconds ..." <br />
  43. PauseChannel chnWave <br />
  44. Delay 2000 <br />
  45. <br />
  46. Print "Restarting sound ..." <br />
  47. ResumeChannel chnWave <br />
  48. Delay 2000 <br />
  49. <br />
  50. Print "Changing Pitch of sound ..." <br />
  51. ;StopChannel chnWave <br />
  52. ChannelPitch chnWave, 22000 <br />
  53. Delay 2000 <br />
  54. <br />
  55. Print "Playing new pitched sound ..." <br />
  56. Delay 2000 <br />
  57. <br />
  58. Print "Left speaker only" <br />
  59. ChannelPan chnWave,-1 <br />
  60. Delay 2000 <br />
  61. <br />
  62. Print "Right speaker only" <br />
  63. ChannelPan chnWave,1 <br />
  64. Delay 2000 <br />
  65. <br />
  66. Print "All done!" <br />
  67. StopChannel chnWave <br />
  68. </td>
  69. </tr>
  70. </table>
  71. <br>
  72. <a target=_top href=../index.htm>Index</a><br>
  73. <br>
  74. Click <a href=http://www.blitzbasic.co.nz/b3ddocs/command.php?name=PauseChannel&ref=comments target=_blank>here</a> to view the latest version of this page online</body>
  75. </html>