API MuteSoundFile

From Wowpedia
Jump to: navigation, search

Mutes a sound file.

MuteSoundFile("soundFile" or fileDataID)

Arguments

soundFile 
string - File path to an addon sound.
or fileDataID 
number - FileDataID of a game sound.

Example

Plays the Sound/Spells/LevelUp.ogg sound

/run PlaySoundFile(569593)

Mutes it, the sound won't play

/run MuteSoundFile(569593); PlaySoundFile(569593) 

Unmutes it and plays it

/run UnmuteSoundFile(569593); PlaySoundFile(569593)

Details

  • Muted sound settings only persist through relogging and /reload. They have to be muted again after restarting the game client.
  • This works on all internal game sounds, addon sounds and sounds played manually by PlaySoundFile()
  • There is no API to replace sound files.

Finding Sound IDs

File Data IDs

Sound Kit Names/IDs

Addon example

Mutes the fizzle sounds.

local sounds = {
	569772, -- sound/spells/fizzle/fizzleholya.ogg
	569773, -- sound/spells/fizzle/fizzlefirea.ogg
	569774, -- sound/spells/fizzle/fizzlenaturea.ogg
	569775, -- sound/spells/fizzle/fizzlefrosta.ogg
	569776, -- sound/spells/fizzle/fizzleshadowa.ogg
}

for _, fdid in pairs(sounds) do
	MuteSoundFile(fdid)
end

Patch changes

  • Battle for Azeroth Patch 8.2.0 (2019-06-25): Added. (Build 30948 Jun 27 2019)

See also