IGModAudioChannel/SetVolume

From Garry's Mod
(Difference between revisions)
Jump to: navigation, search
 
Line 8: Line 8:
 
|name=volume
 
|name=volume
 
|desc=Volume to set. 1 meaning 100% volume, 0.5 is 50% and 3 is 300%, etc.
 
|desc=Volume to set. 1 meaning 100% volume, 0.5 is 50% and 3 is 300%, etc.
 
+
}}
 
+
{{Example
 +
|Description=Plays the a Half-Life 1 sound track at 300% volume
 +
|Code=sound.PlayFile( "sound/music/hl1_song20.mp3", "", function( channel )
 +
if ( IsValid( channel ) ) then
 +
channel:Play()
 +
channel:SetVolume( 3 )
 +
end
 +
end )
 
}}
 
}}

Latest revision as of 18:24, 22 May 2019

 IGModAudioChannel:SetVolume( )

Contents

Description

Sets the volume of a sound channel

Arguments

number volume

Volume to set. 1 meaning 100% volume, 0.5 is 50% and 3 is 300%, etc.

Examples

Example

Plays the a Half-Life 1 sound track at 300% volume

sound.PlayFile( "sound/music/hl1_song20.mp3", "", function( channel )
	if ( IsValid( channel ) ) then
		channel:Play()
		channel:SetVolume( 3 )
	end
end )


Personal tools
Navigation