SetSoundPan

From Multi Theft Auto: Wiki
Revision as of 11:59, 27 August 2013 by Lexr128 (talk | contribs) (Created page with "__NOTOC__ {{Client function}} This function is used to change the pan level of the specified sound element. ==Syntax== <syntaxhighlight lang="lua">bool setSoundPan ( element theSound, fl...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This function is used to change the pan level of the specified sound element.

Syntax

bool setSoundPan ( element theSound, float pan )

Required Arguments

  • theSound: The sound element which volume you want to modify.
  • pan: A floating point number representing the desired pan level. Range is from 0.0 (left) to 1.0 (right)

Returns

Returns true if the sound element pan was successfully changed, false otherwise.

Example

Click to collapse [-]
Client
function playMusic ()
        local left = playSFX("genrl", 75, 6, true)    -- Play loading theme music
        local right = playSFX("genrl", 75, 7, true)
        setSoundPan(left, 0)                          -- switch the first music to left channel
        setSoundPan(right, 1)                         -- switch the second music to right channel
end

addCommandHandler("music", playMusic)                 -- add the command handler

See Also