Banner Image

Module Sound.UserSound

Sound - Manage user sound.


Features:

  • Play sounds wihtin running missions.

Management of DCS User Sound.


Author: FlightControl


Global(s)

Global USERSOUND

Management of DCS User Sound.

#USERSOUND USERSOUND

Management of DCS User Sound.

USERSOUND constructor

Type(s)

Fields and Methods inherited from USERSOUND Description

USERSOUND:New(UserSoundFileName)

USERSOUND Constructor.

USERSOUND:SetFileName(UserSoundFileName)

Set usersound filename.

USERSOUND:ToAll()

Play the usersound to all players.

USERSOUND:ToClient(The, Delay, Client)

Play the usersound to the given Wrapper.Client.

USERSOUND:ToCoalition(Coalition)

Play the usersound to the given coalition.

USERSOUND:ToCountry(Country)

Play the usersound to the given country.

USERSOUND:ToGroup(Group, Delay)

Play the usersound to the given Wrapper.Group.

USERSOUND:ToUnit(Unit, Delay)

Play the usersound to the given Wrapper.Unit.

USERSOUND.UserSoundFileName

Field(s)

Function(s)

USERSOUND Constructor.

Defined in:

USERSOUND

Parameter:

#string UserSoundFileName

The filename of the usersound.

Return value:

Set usersound filename.

Defined in:

USERSOUND

Parameter:

#string UserSoundFileName

The filename of the usersound.

Return value:

The usersound instance.

Usage:

  local BlueVictory = USERSOUND:New( "BlueVictory.ogg" )
  BlueVictory:SetFileName( "BlueVictoryLoud.ogg" ) -- Set the BlueVictory to change the file name to play a louder sound.
  

Play the usersound to all players.

Defined in:

USERSOUND

Return value:

The usersound instance.

Usage:

  local BlueVictory = USERSOUND:New( "BlueVictory.ogg" )
  BlueVictory:ToAll() -- Play the sound that Blue has won.
  

Play the usersound to the given Wrapper.Client.

Defined in:

USERSOUND

Parameters:

Wrapper.Client to play the usersound to.

#number Delay

(Optional) Delay in seconds, before the sound is played. Default 0.

Client

Return value:

The usersound instance.

Usage:

  local BlueVictory = USERSOUND:New( "BlueVictory.ogg" )
  local PlayerUnit = CLIENT:FindByPlayerName("Karl Heinz")-- Search for the active client with playername "Karl Heinz", a human player.
  BlueVictory:ToClient( PlayerUnit ) -- Play the victory sound to the player unit.
  

Play the usersound to the given coalition.

Defined in:

USERSOUND

Parameter:

DCS#coalition Coalition

The coalition to play the usersound to.

Return value:

The usersound instance.

Usage:

  local BlueVictory = USERSOUND:New( "BlueVictory.ogg" )
  BlueVictory:ToCoalition( coalition.side.BLUE ) -- Play the sound that Blue has won to the blue coalition.
  

Play the usersound to the given country.

Defined in:

USERSOUND

Parameter:

DCS#country Country

The country to play the usersound to.

Return value:

The usersound instance.

Usage:

  local BlueVictory = USERSOUND:New( "BlueVictory.ogg" )
  BlueVictory:ToCountry( country.id.USA ) -- Play the sound that Blue has won to the USA country.
  

Play the usersound to the given Wrapper.Group.

Defined in:

USERSOUND

Parameters:

The Wrapper.Group to play the usersound to.

#number Delay

(Optional) Delay in seconds, before the sound is played. Default 0.

Return value:

The usersound instance.

Usage:

  local BlueVictory = USERSOUND:New( "BlueVictory.ogg" )
  local PlayerGroup = GROUP:FindByName( "PlayerGroup" ) -- Search for the active group named "PlayerGroup", that contains a human player.
  BlueVictory:ToGroup( PlayerGroup ) -- Play the victory sound to the player group.
  

Play the usersound to the given Wrapper.Unit.

Defined in:

USERSOUND

Parameters:

The Wrapper.Unit to play the usersound to.

#number Delay

(Optional) Delay in seconds, before the sound is played. Default 0.

Return value:

The usersound instance.

Usage:

  local BlueVictory = USERSOUND:New( "BlueVictory.ogg" )
  local PlayerUnit = UNIT:FindByName( "PlayerUnit" ) -- Search for the active unit named "PlayerUnit", a human player.
  BlueVictory:ToUnit( PlayerUnit ) -- Play the victory sound to the player unit.