Garry's Mod Wiki

IGModAudioChannel

A sound channel returned by a callback of sound.PlayURL and sound.PlayFile.

Methods

IGModAudioChannel:EnableLooping( boolean enable )
Enables or disables looping of audio channel, requires noblock flag.
number IGModAudioChannel:FFT( table tbl, number size )
Computes the DFT (discrete Fourier transform) of the sound channel. The size parameter specifies the number of consecutive audio samples to use as the input to the DFT and is restricted to a power of two. A Hann window is applied to the input data. The computed DFT has the same number of frequency bins as the number of samples. Only half of this DFT is returned, since the DFT magnitudes are symmetric for real input data. The magnitudes of the DFT (values from 0 to 1) are used to fill the output table, starting at index 1. Visualization protip: For a size N DFT, bin k (1-indexed) corresponds to a frequency of (k - 1) / N * sampleRate. Visualization protip: Sound energy is proportional to the square of the magnitudes. Adding magnitudes together makes no sense physically, but adding energies does. Visualization protip: The human ear works on a logarithmic amplitude scale. You can convert to decibels by taking 20 * math. log10 of frequency magnitudes, or 10 * math. log10 of energy. The decibel values will range from -infinity to 0.
number, number, number IGModAudioChannel:Get3DCone()
Returns 3D cone of the sound channel. See IGModAudioChannel:Set3DCone.
boolean IGModAudioChannel:Get3DEnabled()
Returns if the sound channel is currently in 3D mode or not. This value will be affected by IGModAudioChannel:Set3DEnabled.
number, number IGModAudioChannel:Get3DFadeDistance()
Returns 3D fade distances of a sound channel.
number IGModAudioChannel:GetAverageBitRate()
Returns the average bit rate of the sound channel.
number IGModAudioChannel:GetBitsPerSample()
Retrieves the number of bits per sample of the sound channel. Doesn't work for mp3 and ogg files.
number IGModAudioChannel:GetBufferedTime()
Returns the buffered time of the sound channel in seconds, for online streaming sound channels. (sound. PlayURL) For offline channels this will be equivalent to IGModAudioChannel:GetLength.
string IGModAudioChannel:GetFileName()
Returns the filename for the sound channel.
number IGModAudioChannel:GetLength()
Returns the length of sound played by the sound channel in seconds.
number, number IGModAudioChannel:GetLevel()
Returns the right and left levels of sound played by the sound channel.
number IGModAudioChannel:GetPan()
Gets the relative volume of the left and right channels.
number IGModAudioChannel:GetPlaybackRate()
Returns the playback rate of the sound channel.
Vector IGModAudioChannel:GetPos()
Returns position of the sound channel
number IGModAudioChannel:GetSamplingRate()
Returns the sample rate for currently playing sound.
number IGModAudioChannel:GetState()
Returns the state of a sound channel
table IGModAudioChannel:GetTagsHTTP()
Retrieves HTTP headers from a bass stream channel created by sound. PlayURL, if available.
table IGModAudioChannel:GetTagsID3()
Retrieves the ID3 version 1 info from a bass channel created by sound. PlayFile or sound. PlayURL, if available. ID3v2 is not supported.
string IGModAudioChannel:GetTagsMeta()
Retrieves meta stream info from a bass stream channel created by sound. PlayURL, if available.
table IGModAudioChannel:GetTagsOGG()
Retrieves OGG media info tag, from a bass channel created by sound. PlayURL or sound. PlayFile, if available.
string IGModAudioChannel:GetTagsVendor()
Retrieves OGG Vendor tag, usually containing the application that created the file, from a bass channel created by sound. PlayURL or sound. PlayFile, if available.
number IGModAudioChannel:GetTime()
Returns the current time of the sound channel in seconds
number IGModAudioChannel:GetVolume()
Returns volume of a sound channel
boolean IGModAudioChannel:Is3D()
Returns if the sound channel is in 3D mode or not.
boolean IGModAudioChannel:IsBlockStreamed()
Returns whether the audio stream is block streamed or not.
boolean IGModAudioChannel:IsLooping()
Returns if the sound channel is looping or not.
boolean IGModAudioChannel:IsOnline()
Returns if the sound channel is streamed from the Internet or not.
boolean IGModAudioChannel:IsValid()
Returns if the sound channel is valid or not.
IGModAudioChannel:Pause()
Pauses the stream. It can be started again using IGModAudioChannel:Play
IGModAudioChannel:Play()
Starts playing the stream.
IGModAudioChannel:Set3DCone( number innerAngle, number outerAngle, number outerVolume )
Sets 3D cone of the sound channel.
IGModAudioChannel:Set3DEnabled( boolean enable )
Sets the 3D mode of the channel. This will affect IGModAudioChannel:Get3DEnabled but not IGModAudioChannel:Is3D. This feature requires the channel to be initially created in 3D mode, i. e. IGModAudioChannel:Is3D should return true or this function will do nothing.
IGModAudioChannel:Set3DFadeDistance( number min, number max )
Sets 3D fade distances of a sound channel.
IGModAudioChannel:SetPan( number pan )
Sets the relative volume of the left and right channels.
IGModAudioChannel:SetPlaybackRate( number rate )
Sets the playback rate of the sound channel. May not work with high values for radio streams.
IGModAudioChannel:SetPos( Vector pos, Vector dir = Vector( 0, 0, 0 ) )
Sets position of sound channel in case the sound channel has a 3d option set.
IGModAudioChannel:SetTime( number secs, boolean dont_decode = false )
Sets the sound channel to specified time ( Rewind to that position of the song ). Does not work on online radio streams. Streamed sounds must have "noblock" parameter for this to work and IGModAudioChannel:IsBlockStreamed must return false. Streamed sounds can only have their time set to up to the current IGModAudioChannel:GetBufferedTime.
IGModAudioChannel:SetVolume( number volume )
Sets the volume of a sound channel
IGModAudioChannel:Stop()
Stop the stream. It can be started again using IGModAudioChannel:Play. Calling this invalidates the IGModAudioChannel object rendering it unusable for further functions. Issue Tracker: 1497