setchannelpan.bmx 469 B

123456789101112131415161718192021222324
  1. ' setchannelpan.bmx
  2. Graphics 640, 480
  3. channel = AllocChannel ()
  4. sound = LoadSound ("shoot.wav") ' Use a short sample...
  5. Repeat
  6. If MouseHit(1) PlaySound sound,channel
  7. pan# = MouseX () / (GraphicsWidth () / 2.0) - 1
  8. vol# = 1 - MouseY () / 480.0
  9. SetChannelPan channel, pan
  10. SetChannelVolume channel, vol*2
  11. Cls
  12. DrawText "Click to play...", 240, 200
  13. DrawText "Pan : " + pan, 240, 220
  14. DrawText "Volume: " + vol, 240, 240
  15. Flip
  16. Until KeyHit (KEY_ESCAPE)
  17. End