Changing sound volume
Hi,
I would like to temporarily change the volume of a played sound in my addon. From https://wiki.esoui.com/Sounds I can apparently do this by: You can also play with volume by modifying audio settings before playing your sound (settingId = AUDIO_SETTING_UI_VOLUME) Forgive my newb-ness, but how do I change this settingId? Is it just an additional parameter to the PlaySound call? Thanks for any help, Mirrorman |
If you just want to change the volume of that 1 sound just call PlaySound with the same parameters more than once. It will get louder that way but that does not work with all sounds of the SOUNDS table! So you need to test it.
Lua Code:
About your question with the settings: Changing the overall sound volume will affect ALL sounds played and other effects too so it might make your whole game be loud, not only that 1 sound :D If you want to achieve this you need to use the GetSetting* and SetSetting* API functions to set/get the correct category and index in that category. There should be one category constant for the audio settings e.g. and then different index constants for the volumes. You can fidn those at the vailla source code, where the settings menu is build: https://github.com/esoui/esoui/blob/...shared.lua#L11 If I'm not wrong the main category(or system) would be SETTING_TYPE_AUDIO and the index AUDIO_SETTING_AUDIO_VOLUME Code:
--- @param system [SettingSystemType|#SettingSystemType] and if you use GetSetting convert that value with tonumber(GetSetting(SETTING_TYPE_AUDIO, AUDIO_SETTING_AUDIO_VOLUME)) so you can do mathematics with it properly (allthough lua should accept mathematics with string numbers too I guess :-) ) |
@Baertram, thanks very much! Your repeating the PlaySound command worked for what I needed. Now back to listening to all 500 or so sounds to find the one that I want!
|
Install merTorchbug, ingame type /tb and click on the Sounds tab. Clicking a row will play it as preview.
Is your want the user to choose a sound and your addon uses LibAddonMenu for settings, try the LibAddonMenu SoundSlider widget. You can choose a sound there and let it preview upon selection. |
All times are GMT -6. The time now is 04:47 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI