func_audio_setchannelpan.rst 1006 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. .. _func_audio_setchannelpan:
  2. =============
  3. SetChannelPan
  4. =============
  5. SetChannelPan -
  6. Description
  7. ===========
  8. .. code-block:: blitzmax
  9. SetChannelPan( channel:TChannel,pan# )
  10. Set stereo balance of an audio channel
  11. @pan should be in the range -1 (left) to 1 (right)
  12. Parameters
  13. ==========
  14. Return Values
  15. =============
  16. Nothing.
  17. Examples
  18. ========
  19. .. code-block:: blitzmax
  20. ' setchannelpan.bmx
  21. Graphics 640, 480
  22. channel = AllocChannel ()
  23. sound = LoadSound ("shoot.wav") ' Use a short sample...
  24. Repeat
  25. If MouseHit(1) PlaySound sound,channel
  26. pan# = MouseX () / (GraphicsWidth () / 2.0) - 1
  27. vol# = 1 - MouseY () / 480.0
  28. SetChannelPan channel, pan
  29. SetChannelVolume channel, vol*2
  30. Cls
  31. DrawText "Click to play...", 240, 200
  32. DrawText "Pan : " + pan, 240, 220
  33. DrawText "Volume: " + vol, 240, 240
  34. Flip
  35. Until KeyHit (KEY_ESCAPE)
  36. End
  37. See Also
  38. ========