Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ MUSHclient
➜ General
➜ Volume of sounds attached through trigger dialog
Volume of sounds attached through trigger dialog
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Seriley
(42 posts) Bio
|
Date
| Tue 01 Jun 2010 03:52 PM (UTC) |
Message
| Is there a way to adjust the default volume of these sounds? I know I could always use PlaySound in a script to do this. I would like to continue to attach sounds to triggers in the manner provided. | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #1 on Tue 01 Jun 2010 08:48 PM (UTC) Amended on Tue 01 Jun 2010 08:54 PM (UTC) by Nick Gammon
|
Message
| There is no direct way, as the trigger-based sounds were developed long before I had heard about DirectSound.
However if you just want to play all sounds more quietly, the plugin below will do it:
 |
To save and install the Sound_Volume_Reducer plugin do this:
- Copy between the lines below (to the Clipboard)
- Open a text editor (such as Notepad) and paste the plugin into it
- Save to disk on your PC, preferably in your plugins directory, as Sound_Volume_Reducer.xml
- Go to the MUSHclient File menu -> Plugins
- Click "Add"
- Choose the file Sound_Volume_Reducer.xml (which you just saved in step 3) as a plugin
- Click "Close"
|
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<muclient>
<plugin
name="Sound_Volume_Reducer"
author="Nick Gammon"
id="b1308ed1e6d5e4facdaf7bdd"
language="Lua"
purpose="Plays trigger sounds more quietly"
date_written="2010-06-02 06:33:40"
requires="4.40"
version="1.0"
>
<description trim="y">
<![CDATA[
Install this to play trigger sounds at reduced volume.
]]>
</description>
</plugin>
<!-- Script -->
<script>
<![CDATA[
function OnPluginPlaySound (sound)
PlaySound (0, sound, false, -12) -- play supplied sound 12 db softer
end -- function
]]>
</script>
</muclient>
That detects attempts to play sounds and plays the same file itself 12 db more softly (obviously you can change the -12 to something else).
If you want to play individual sounds in different ways (eg. some more softly than others, or some from the left speaker and some from the right speaker) then you could use string.match (or a simple test for string equal) on the file name, and choose your volume level from a table lookup.
For example:
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<muclient>
<plugin
name="Sound_Volume_Reducer"
author="Nick Gammon"
id="b1308ed1e6d5e4facdaf7bdd"
language="Lua"
purpose="Plays trigger sounds more quietly"
date_written="2010-06-02 06:33:40"
requires="4.40"
version="1.0"
>
<description trim="y">
<![CDATA[
Install this to play trigger sounds at reduced volume.
]]>
</description>
</plugin>
<!-- Script -->
<script>
<![CDATA[
volumes = {
["west"] = { volume = -6, pan = -100} ,
["east"] = { volume = -15, pan = 100} ,
-- add more here
} -- end of volumes table
function OnPluginPlaySound (sound)
-- defaults
local volume = -12
local pan = 0
-- search file name for a keyword that affects its volume
for k, v in pairs (volumes) do
if string.match (sound, k) then
volume = v.volume
pan = v.pan
break
end -- if matched part of sound name
end -- for
PlaySound (0, sound, false, volume, pan) -- play supplied sound as required
end -- function
]]>
</script>
</muclient>
In this case a sound with the word "east" in its filename will be played from the right speaker at -15 db, and a sound with the word "west" in its name will be played at -6 db from the left speaker. Other sounds will be played at -12 db centered. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
11,802 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top