Why dioes TChannel appear to have no code?

BlitzMax Forums/BlitzMax Beginners Area/Why dioes TChannel appear to have no code?

sswift(Posted 2006) [#1]
From AUDIO.BMX:
Type TChannel
	Rem
	bbdoc: Stop audio channel playback
	about:
	Shuts down the audio channel. Further commands on this audio channel will have no effect.
	End Rem
	Method Stop()
	End Method
	Rem
	bbdoc: Pause or unpause audio channel playback
	about:
	If @paused is True, the audio channel is paused. Otherwise, the audio channel is unpaused.
	End Rem
	Method SetPaused( paused )
	End Method
	Rem
	bbdoc: Set audio channel volume
	about:
	@volume should be in the range 0 (silence) to 1 (full volume).
	End Rem
	Method SetVolume( volume# )
	End Method
	Rem
	bbdoc: Set audio channel stereo pan
	about:
	@pan should be in the range -1 (full left) to 1 (full right).
	End Rem
	Method SetPan( pan# ) 
	End Method
	Rem
	bbdoc: Set audio channel depth
	about: 
	@depth should be in the range -1 (back) to 1 (front).
	End Rem
	Method SetDepth( depth# )
	End Method
	Rem
	bbdoc: Set audio channel playback rate
	about:
	@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).
	End Rem
	Method SetRate( rate# )
	End Method
	Rem
	bbdoc: Determine whether audio channel is playing
	returns: True if @channel is currently playing
	about:
	#Playing will return False if the audio channel is either paused, or has been stopped
	using #Stop.
	End Rem
	Method Playing()
	End Method

End Type



This doesn't appear to be a case of the methods for the type not being implemented but the regular commands being implemented, because the regular commands seemingly call these empty methods:

Rem
bbdoc: Stop an audio channel
about:
Shuts down an audio channel. Further commands using this channel will have no effect.
end rem
Function StopChannel( channel:TChannel )
	channel.Stop
End Function

Rem
bbdoc: Determine whether an audio channel is playing
returns: #True if @channel is currently playing
about:
#ChannelPlaying will return #False if either the channel has been paused using #PauseChannel,
or stopped using #StopChannel.
end rem
Function ChannelPlaying( channel:TChannel )
	Return channel.Playing()
End Function



What gives?


TartanTangerine (was Indiepath)(Posted 2006) [#2]
freeaudio.cpp it's all done there.


skidracer(Posted 2006) [#3]
It's a null audio device for when the freeaudio or other driver fails to start.

If anyone does get confused with BlitzMax I recomend just placing a DebugStop in some test code before the command you want to know about and then Step In using the debugger to get a far better idea of whats happening "under the hood".


sswift(Posted 2006) [#4]
Okay. Well on another subject... I was considering extending the TSound type, but once again I think I've got a problem extending stuff.

If I'm not mistaken, I can't have a Play method in my extended type if it has different parameters than the Play method in the TSound type. Why is that again? I can't count the number of times I've wanted to make an extended type but couldn't do it the way I wanted because the function/method names really needed to be the same. Why would I want to use something other than Play to play a sound after all?

What I wanted to do was add volume and rate parameters to play and keep track of the last time a sound was played so that I don't play it too soon over itself which sounds bad.


Yan(Posted 2006) [#5]
Audio.bmx is the 'Null' driver. The freeaudio driver code is contained in freeaudioaudio.bmx.

It's briefly explained here.


[edit]
Bah...Got distracted mid post again...
[/edit]


sswift(Posted 2006) [#6]
"It's a null audio device for when the freeaudio or other driver fails to start."

Well I guess that begs the question then of whether or not it would even work if I tried to extend the TSound type?


sswift(Posted 2006) [#7]
Yan:
You know, it MIGHT be useful if this were mentioned in the help file! :-)


skidracer(Posted 2006) [#8]
Like TGadget, TSound is designed to be extended by the driver developer not the application developer.


Grey Alien(Posted 2006) [#9]
I tried to extend TSound a when I started but ran into problems. You can exetend Play() with different parameters otherwise the polymorphism wouldn't work and BlitzMax doesn't support overloading like C++.