From 9dd2417898fc630059703d9fc0e51717a99de332 Mon Sep 17 00:00:00 2001 From: Neuromancer Date: Sun, 16 Sep 2012 22:48:38 -0500 Subject: [PATCH] .30 adjust sound and music volume ingame --- ambience.zip | Bin 9514411 -> 9514791 bytes ambience/init.lua | 137 ++++++++++++++++++++++++++++++---------------- 2 files changed, 91 insertions(+), 46 deletions(-) diff --git a/ambience.zip b/ambience.zip index b6fef1c4a267fb48712e34fdfaa3b5804c943769..a62a636beac88a7d0e8029997fe6c77c2a4aaa17 100644 GIT binary patch delta 5716 zcmZA5Ra8{p-v)3PnxPwp?(XiEP)fSHq`PF0PGP7cARvu25+X>Wq*5ZO)Q?6|6hY;` zUGLp{@mXg*&)RG6?>^`5)US?U)_fhoY*C{i5^Wb&q55b`Tu+LImgSaXNI`?NIm+A? zC%Lm`|BLfbapskWN6#@jUn(XJ?uf2qc$9JtxAzxGFFJ_*OYc{YU#kVQtF6UmIXh32 zKK1taI8CR!MT)7N-QB$dQIrb^n@p|!-IZ}eNS@44{% zENSz`>(p;V9$n6%tg^?_k-j)~$R+0>nLcCMBIfkvL^mG!dlp@psv8#c7M+Cit*Go& zwYR)F1rz_xi$+t9d(-$nOKv{*XMp8MJ0C|!I{&=Ra&;^na-#9?eEL+mKGjua>iUu& z&z#@%`8#>7rNYZ}mssz(Fs$zuLvfTk{luarEzB=-fEPFIbHQ1!26Gx+w+A~J@q_0}#Z*)M4*2pm1owKA_g*@96n*%^3t3#0UK)Md7^II+5?AZpvVKYP-759V z)41i0kIb@XxdLG!(=6~*x(_d;g>eXnUd*k;t5c;!stOuZ?LH@OZ))hvW*yelJ@Zsg zugZEkn%;Q5&}u+$dQmU>fQ>q-$lDbkXU&xyyCvn8`)a8-`Q$|yWd06$L9g>Sxm8D{ zY2<)1#hP>TBHwL6qsLKVoL9O#n^T9ZycLbX#I3{7{VJccnRYZ1IWv;C&;W_oT5zJC?MrxZsW*pBG=mns}3(oNCh1c0KUaw4fcsI*+!wfBca&rXz( zl|QM|b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uZ@|EuCA0xD*S|6lQdeJ%SJf?>z6 zp@&F5cKn38t<@$8jW0unkw6Br?xGXxz9hj(}XmAIkQ zGvJuYyu|;c-)9JR6koNI{*(OB1P_=H0vbaTB48OC|DNp76-k0Ug^E)O^v*d24SkdZ z`~NCTfij9yP>?+ajP#N%RE;47Qy5*wL#r-$en>?M^zdZkp~f7%1oRXnSV=$hSBel# yp-rBVFHJy0Rni0pnA%+kCPN6JIKx4Jh@9Z4R2k4}&jHQJ5DclOISFKBWd8?Ws+XVu diff --git a/ambience/init.lua b/ambience/init.lua index 4f25b85..df2bf4f 100644 --- a/ambience/init.lua +++ b/ambience/init.lua @@ -1,12 +1,12 @@ -------------------------------------------------------------------------------------------------------- ---Ambiance Configuration for version .29 ---working on Flying ---PROB: wind stops short even though it says we are still flying and don't hear the start sound. ---really BIG prob, it ruins water meaning you hear beach while treading water. (find out if still hear it in .28) because ---it is fairly rare in .29 ---need a separate onstart variable for flying? ---removing unneeded stuff. - +--Ambience Configuration for version .30 +--added music volume /mvol 0-3.3 music gain gets multiplied by this. +--added sound volume /mvol 0-1 sound gain gets multiplied by this. +--Working on: +--find out why wind stops while flying +--add an extra node near feet to handle treading water as a special case, and don't have to use node under feet. which gets + --invoked when staning on a ledge near water. +--reduce redundant code (stopplay and add ambience to list) local max_frequency_all = 1000 --the larger you make this number the lest frequent ALL sounds will happen recommended values between 100-2000. @@ -36,11 +36,20 @@ local desert_frequent_frequency = 700 --desertwind local desert_frequent_volume = 1.0 local swimming_frequent_frequency = 1000 --swimming splashes local swimming_frequent_volume = 1.0 +local water_surface_volume = 1.0 -- sloshing water +local lava_volume = 1.0 --lava +local flowing_water_volume = .4 --waterfall +local splashing_water_volume = 1 local music_frequency = 7 --music (suggestion: keep this one low like around 6) local music_volume = 0.3 + --End of Config ---------------------------------------------------------------------------------------------------- +local ambiences local counter=0--***************** +local SOUNDVOLUME = 1 +local MUSICVOLUME = 1 +local sound_vol = 1 local last_x_pos = 0 local last_y_pos = 0 local last_z_pos = 0 @@ -48,9 +57,11 @@ local node_under_feet local node_at_upper_body local node_at_lower_body local node_3_under_feet - local played_on_start = false + + + local night = { handler = {}, frequency = night_frequency, @@ -144,8 +155,8 @@ local flying = { local water = { handler = {}, frequency = 0,--dolphins dont fit into small lakes - {name="dolphins", length=6}, - {name="dolphins_screaming", length=16.5} + {name="dolphins", length=6, gain=1}, + {name="dolphins_screaming", length=16.5, gain=1} } local water_frequent = { @@ -154,7 +165,7 @@ local water_frequent = { on_stop = "drowning_gasp", --on_start = "Splash", {name="scuba1bubbles", length=11, gain=water_frequent_volume}, - {name="scuba1calm", length=10}, --not sure why but sometimes I get errors when setting gain=water_frequent_volume here. + {name="scuba1calm", length=10, gain=water_frequent_volume}, --not sure why but sometimes I get errors when setting gain=water_frequent_volume here. {name="scuba1calm2", length=8.5, gain=water_frequent_volume}, {name="scuba1interestingbubbles", length=11, gain=water_frequent_volume}, {name="scuba1tubulentbubbles", length=10.5, gain=water_frequent_volume} @@ -165,35 +176,35 @@ local water_surface = { frequency = 1000, on_stop = "Splash", on_start = "Splash", - {name="lake_waves_2_calm", length=9.5}, - {name="lake_waves_2_variety", length=13.1} + {name="lake_waves_2_calm", length=9.5, gain=water_surface_volume}, + {name="lake_waves_2_variety", length=13.1, gain=water_surface_volume} } local splashing_water = { handler = {}, frequency = 1000, - {name="Splash", length=1.22, gain=1} + {name="Splash", length=1.22, gain=splashing_water_volume} } local flowing_water = { handler = {}, frequency = 1000, - {name="small_waterfall", length=14, gain=.4} + {name="small_waterfall", length=14, gain=flowing_water_volume} } local flowing_water2 = { handler = {}, frequency = 1000, - {name="small_waterfall", length=11, gain=.3} + {name="small_waterfall", length=11, gain=flowing_water_volume} } local lava = { handler = {}, frequency = 1000, - {name="earth01a", length=20} + {name="earth01a", length=20, gain=lava_volume} } local lava2 = { handler = {}, frequency = 1000, - {name="earth01a", length=15} + {name="earth01a", length=15, gain=lava_volume} } @@ -201,6 +212,7 @@ local play_music = minetest.setting_getbool("music") or false local music = { handler = {}, frequency = music_frequency, + is_music=true, {name="mtest", length=4*60+33, gain=music_volume}, {name="echos", length=2*60+26, gain=music_volume}, {name="FoamOfTheSea", length=1*60+50, gain=music_volume}, @@ -455,12 +467,18 @@ local get_ambience = function(player) end -- start playing the sound, set the handler and delete the handler after sound is played -local play_sound = function(player, list, number) +local play_sound = function(player, list, number, is_music) local player_name = player:get_player_name() if list.handler[player_name] == nil then local gain = 1.0 if list[number].gain ~= nil then - gain = list[number].gain + if is_music then + gain = list[number].gain*MUSICVOLUME + --minetest.chat_send_all("gain music: " .. gain ) + else + gain = list[number].gain*SOUNDVOLUME + --minetest.chat_send_all("gain sound: " .. gain ) + end end local handler = minetest.sound_play(list[number].name, {to_player=player_name, gain=gain}) if handler ~= nil then @@ -484,7 +502,7 @@ local stop_sound = function(still_playing, player) local list = cave if list.handler[player_name] ~= nil then if list.on_stop ~= nil then - minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=SOUNDVOLUME}) end minetest.sound_stop(list.handler[player_name]) list.handler[player_name] = nil @@ -494,7 +512,7 @@ local stop_sound = function(still_playing, player) local list = cave_frequent if list.handler[player_name] ~= nil then if list.on_stop ~= nil then - minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=SOUNDVOLUME}) end minetest.sound_stop(list.handler[player_name]) list.handler[player_name] = nil @@ -504,7 +522,7 @@ local stop_sound = function(still_playing, player) local list = swimming_frequent if list.handler[player_name] ~= nil then if list.on_stop ~= nil then - minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=SOUNDVOLUME}) end minetest.sound_stop(list.handler[player_name]) list.handler[player_name] = nil @@ -514,7 +532,7 @@ local stop_sound = function(still_playing, player) local list = beach if list.handler[player_name] ~= nil then if list.on_stop ~= nil then - minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=SOUNDVOLUME}) end minetest.sound_stop(list.handler[player_name]) list.handler[player_name] = nil @@ -524,7 +542,7 @@ local stop_sound = function(still_playing, player) local list = beach_frequent if list.handler[player_name] ~= nil then if list.on_stop ~= nil then - minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=SOUNDVOLUME}) end minetest.sound_stop(list.handler[player_name]) list.handler[player_name] = nil @@ -534,7 +552,7 @@ local stop_sound = function(still_playing, player) local list = desert if list.handler[player_name] ~= nil then if list.on_stop ~= nil then - minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=SOUNDVOLUME}) end minetest.sound_stop(list.handler[player_name]) list.handler[player_name] = nil @@ -544,7 +562,7 @@ local stop_sound = function(still_playing, player) local list = desert_frequent if list.handler[player_name] ~= nil then if list.on_stop ~= nil then - minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=SOUNDVOLUME}) end minetest.sound_stop(list.handler[player_name]) list.handler[player_name] = nil @@ -554,7 +572,7 @@ local stop_sound = function(still_playing, player) local list = night if list.handler[player_name] ~= nil then if list.on_stop ~= nil then - minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=SOUNDVOLUME}) end minetest.sound_stop(list.handler[player_name]) list.handler[player_name] = nil @@ -564,7 +582,7 @@ local stop_sound = function(still_playing, player) local list = night_frequent if list.handler[player_name] ~= nil then if list.on_stop ~= nil then - minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=SOUNDVOLUME}) end minetest.sound_stop(list.handler[player_name]) list.handler[player_name] = nil @@ -574,7 +592,7 @@ local stop_sound = function(still_playing, player) local list = day if list.handler[player_name] ~= nil then if list.on_stop ~= nil then - minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=SOUNDVOLUME}) end minetest.sound_stop(list.handler[player_name]) list.handler[player_name] = nil @@ -584,7 +602,7 @@ local stop_sound = function(still_playing, player) local list = day_frequent if list.handler[player_name] ~= nil then if list.on_stop ~= nil then - minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=SOUNDVOLUME}) end minetest.sound_stop(list.handler[player_name]) list.handler[player_name] = nil @@ -594,7 +612,7 @@ local stop_sound = function(still_playing, player) local list = music if list.handler[player_name] ~= nil then if list.on_stop ~= nil then - minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=SOUNDVOLUME}) end minetest.sound_stop(list.handler[player_name]) list.handler[player_name] = nil @@ -604,7 +622,7 @@ local stop_sound = function(still_playing, player) local list = flowing_water if list.handler[player_name] ~= nil then if list.on_stop ~= nil then - minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=SOUNDVOLUME}) end minetest.sound_stop(list.handler[player_name]) list.handler[player_name] = nil @@ -614,7 +632,7 @@ local stop_sound = function(still_playing, player) local list = flowing_water2 if list.handler[player_name] ~= nil then if list.on_stop ~= nil then - minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=SOUNDVOLUME}) end minetest.sound_stop(list.handler[player_name]) list.handler[player_name] = nil @@ -624,7 +642,7 @@ local stop_sound = function(still_playing, player) local list = lava if list.handler[player_name] ~= nil then if list.on_stop ~= nil then - minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=SOUNDVOLUME}) end minetest.sound_stop(list.handler[player_name]) list.handler[player_name] = nil @@ -634,7 +652,7 @@ local stop_sound = function(still_playing, player) local list = lava2 if list.handler[player_name] ~= nil then if list.on_stop ~= nil then - minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=SOUNDVOLUME}) end minetest.sound_stop(list.handler[player_name]) list.handler[player_name] = nil @@ -644,7 +662,7 @@ local stop_sound = function(still_playing, player) local list = water if list.handler[player_name] ~= nil then if list.on_stop ~= nil then - minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=SOUNDVOLUME}) end minetest.sound_stop(list.handler[player_name]) list.handler[player_name] = nil @@ -654,7 +672,7 @@ local stop_sound = function(still_playing, player) local list = water_surface if list.handler[player_name] ~= nil then if list.on_stop ~= nil then - minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=SOUNDVOLUME}) played_on_start = false end minetest.sound_stop(list.handler[player_name]) @@ -665,7 +683,7 @@ local stop_sound = function(still_playing, player) local list = water_frequent if list.handler[player_name] ~= nil then if list.on_stop ~= nil then - minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=SOUNDVOLUME}) -- minetest.chat_send_all("list.on_stop " .. list.on_stop ) played_on_start = false end @@ -680,7 +698,7 @@ local stop_sound = function(still_playing, player) -- minetest.chat_send_all("handler flying " ) if list.on_stop ~= nil then -- minetest.chat_send_all("onstop flying" ) - minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=SOUNDVOLUME}) played_on_start = false end minetest.sound_stop(list.handler[player_name]) @@ -691,7 +709,7 @@ local stop_sound = function(still_playing, player) local list = splashing_water if list.handler[player_name] ~= nil then if list.on_stop ~= nil then - minetest.sound_play(list.on_stop, {to_player=player:get_player_name()}) + minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=SOUNDVOLUME}) end minetest.sound_stop(list.handler[player_name]) list.handler[player_name] = nil @@ -709,7 +727,7 @@ minetest.register_globalstep(function(dtime) timer = 0 for _,player in ipairs(minetest.get_connected_players()) do - local ambiences = get_ambience(player) + ambiences = get_ambience(player) stop_sound(ambiences, player) for _,ambience in pairs(ambiences) do if math.random(1, 1000) <= ambience.frequency then @@ -720,15 +738,42 @@ minetest.register_globalstep(function(dtime) -- end if ambience.on_start ~= nil and played_on_start == false then played_on_start = true - minetest.sound_play(ambience.on_start, {to_player=player:get_player_name()}) + minetest.sound_play(ambience.on_start, {to_player=player:get_player_name(),gain=SOUNDVOLUME}) end -- minetest.chat_send_all("ambience: " ..ambience ) -- if ambience.on_start ~= nil and played_on_start_flying == false then -- played_on_start_flying = true -- minetest.sound_play(ambience.on_start, {to_player=player:get_player_name()}) -- end - play_sound(player, ambience, math.random(1, #ambience)) + local is_music =false + if ambience.is_music ~= nil then + is_music = true + end + play_sound(player, ambience, math.random(1, #ambience),is_music) end end end -end) \ No newline at end of file +end) + +minetest.register_chatcommand("svol", { + params = "", + description = "set volume of sounds, default 1 normal volume.", + privs = {server=true}, + func = function(name, param) + SOUNDVOLUME = param + -- local player = minetest.env:get_player_by_name(name) + -- ambiences = get_ambience(player) + -- stop_sound({}, player) + minetest.chat_send_player(name, "Sound volume set.") + end, }) +minetest.register_chatcommand("mvol", { + params = "", + description = "set volume of music, default 1 normal volume.", + privs = {server=true}, + func = function(name, param) + MUSICVOLUME = param + -- local player = minetest.env:get_player_by_name(name) + -- stop_sound({}, player) + -- ambiences = get_ambience(player) + minetest.chat_send_player(name, "Music volume set.") + end, }) \ No newline at end of file