| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- <html>
- <head>
- <title>Blitz3D Docs</title>
- <link rel=stylesheet href=../css/commands.css type=text/css>
- </head>
- <body>
- <h1>ChannelVolume channel_handle, volume#</h1>
- <h1>Parameters</h1>
- <table>
- <tr>
- <td>
- channel_handle = variable assigned to the channel when played
<br />
- volume# = volume level floating value between 0 and 1
- </td>
- </tr>
- </table>
- <h1>Description</h1>
- <table>
- <tr>
- <td>
- 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 />
-
<br />
- 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!
- </td>
- </tr>
- </table>
- <h1><a href=../2d_examples/ChannelVolume.bb>Example</a></h1>
- <table>
- <tr>
- <td>
- ; Channel examples
<br />
-
<br />
- Print "Loading sound ..."
<br />
- ; Load the sample - you'll need to point this to a sound on your computer
<br />
- ; For best results, make it about 5-10 seconds...
<br />
- sndWave=LoadSound("level1.wav")
<br />
- ; Prepare the sound for looping
<br />
- LoopSound sndWave
<br />
-
<br />
- chnWave=PlaySound(sndWave)
<br />
-
<br />
- Print "Playing sound for 2 seconds ..."
<br />
- Delay 2000
<br />
-
<br />
- Print "Pausing sound for 2 seconds ..."
<br />
- PauseChannel chnWave
<br />
- Delay 2000
<br />
-
<br />
- Print "Restarting sound ..."
<br />
- ResumeChannel chnWave
<br />
- Delay 2000
<br />
-
<br />
- Print "Changing volume of sound ..."
<br />
- ChannelVolume chnWave, .5
<br />
- Delay 2000
<br />
-
<br />
- Print "Playing new half-volume sound ..."
<br />
- Delay 2000
<br />
-
<br />
- Print "Left speaker only"
<br />
- ChannelPan chnWave,-1
<br />
- Delay 2000
<br />
-
<br />
- Print "Right speaker only"
<br />
- ChannelPan chnWave,1
<br />
- Delay 2000
<br />
-
<br />
- Print "All done!"
<br />
- StopChannel chnWave
<br />
- </td>
- </tr>
- </table>
- <br>
- <a target=_top href=../index.htm>Index</a><br>
- <br>
- 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>
- </html>
|