TChannel
Audio channel Type
Example
'TChannel controls the pipe thru which the sound plays
SuperStrict
Graphics 640 , 480
Local noise:TSound = TSound.Load(blitzmaxpath()+"\samples\hitoro\sounds\gameover.ogg",0)
Local channel:TChannel = PlaySound(noise)
Repeat
Cls
DrawText "Press P to play sound", 10, 10
If channel.Playing() Then
DrawText "You should hear something...",10,30
End If
If KeyHit(KEY_P) Then
Channel=PlaySound(Noise)
End If
Flip
Until AppTerminate() Or KeyHit(KEY_ESCAPE)
Methods
Method Stop()
Stop audio channel playback
Shuts down the audio channel. Further commands on this audio channel will have no effect.
Method SetPaused( paused:Int )
Pause or unpause audio channel playback
If paused is True, the audio channel is paused. Otherwise, the audio channel is unpaused.
Method SetVolume( volume# )
Set audio channel volume
volume should be in the range 0 (silence) to 1 (full volume).
Method SetPan( pan# )
Set audio channel stereo pan
pan should be in the range -1 (full left) to 1 (full right).
Method SetDepth( depth# )
Set audio channel depth
depth should be in the range -1 (back) to 1 (front).
Method SetRate( rate# )
Set audio channel playback rate
rate is a multiplier used to modify the audio channel's frequency. For example, a rate of .5 will cause the audio channel to play at half speed (ie: an octave down) while a rate of 2 will cause the audio channel to play at double speed (ie: an octave up).
Method Playing:Int()
Determine whether audio channel is playing
Playing will return False if the audio channel is either paused, or has been stopped using Stop.
Returns
True if channel is currently playing
Example
'TChannel Playing Method Example
SuperStrict
Graphics 640, 480
Local noise:TSound = TSound.Load(blitzmaxpath()+"\samples\hitoro\sounds\gameover.ogg",0)
Local channel:TChannel = PlaySound(noise)
Repeat
Cls
DrawText "Press P to play sound", 10, 10
If channel.Playing() Then
DrawText "You should hear something...", 10, 30
End If
If KeyHit(KEY_P) Then
channel = PlaySound(noise)
End If
Flip
Until AppTerminate() Or KeyHit(KEY_ESCAPE)