Garry's Mod Wiki

CSoundPatch

CSoundPatch class.

Created with CreateSound

Methods

CSoundPatch:ChangePitch( number pitch, number deltaTime = 0 )
Adjust the pitch, alias the speed at which the sound is being played. This invokes the GM:EntityEmitSound.
CSoundPatch:ChangeVolume( number volume, number deltaTime = 0 )
Adjusts the volume of the sound played. Appears to only work while the sound is being played.
CSoundPatch:FadeOut( number seconds )
Fades out the volume of the sound from the current volume to 0 in the given amount of seconds.
number CSoundPatch:GetDSP()
Returns the DSP (Digital Signal Processor) effect ID for the sound.
number CSoundPatch:GetPitch()
Returns the current pitch.
number CSoundPatch:GetSoundLevel()
Returns the current sound level.
number CSoundPatch:GetVolume()
Returns the current volume.
boolean CSoundPatch:IsPlaying()
Returns whenever the sound is being played.
CSoundPatch:Play()
Starts to play the sound. This will reset the sound's volume and pitch to their default values. See CSoundPatch:PlayEx
CSoundPatch:PlayEx( number volume, number pitch )
Same as CSoundPatch:Play but with 2 extra arguments allowing to set volume and pitch directly.
CSoundPatch:SetDSP( number dspEffectId )
Sets the DSP (Digital Signal Processor) effect for the sound. Similar to Player:SetDSP but for individual sounds.
CSoundPatch:SetSoundLevel( number level )
Sets the sound level in decibel.
CSoundPatch:Stop()
Stops the sound from being played. This will not work if the entity attached to this sound patch (specified by CreateSound) is invalid. Issue Tracker: 3260