added custom gain per sound

This commit is contained in:
TenPlus1 2016-12-24 11:43:38 +00:00
parent 7d2599c5bc
commit a2cca9c6a5
2 changed files with 8 additions and 9 deletions

View File

@ -9,6 +9,6 @@ Based on Immersive Sounds .36 mod by Neuromancer and optimized to run on servers
- 0.5 - Changed to kilbiths smaller sound files and removed canadianloon1, adjusted timings - 0.5 - Changed to kilbiths smaller sound files and removed canadianloon1, adjusted timings
- 0.6 - Using new find_nodes_in_area features to count nodes and speed up execution (thanks everamzah) - 0.6 - Using new find_nodes_in_area features to count nodes and speed up execution (thanks everamzah)
- 0.7 - Code tweaks and added Jungle sounds for day and night time - 0.7 - Code tweaks and added Jungle sounds for day and night time
- 0.8 - override default water sounds for 0.4.14 dev and above - 0.8 - override default water sounds for 0.4.14 dev and above, add separate gain for each sound
Code license: MIT Code license: MIT

View File

@ -1,9 +1,8 @@
--= Ambience lite by TenPlus1 (23rd December 2016) --= Ambience lite by TenPlus1 (24th December 2016)
local max_frequency_all = 1000 -- larger number means more frequent sounds (100-2000) local max_frequency_all = 1000 -- larger number means more frequent sounds (100-2000)
local SOUNDVOLUME = 1 local SOUNDVOLUME = 1.0
local volume = 0.3
local ambiences local ambiences
-- override default water sounds -- override default water sounds
@ -12,12 +11,12 @@ minetest.override_item("default:water_flowing", { sounds = {} })
minetest.override_item("default:river_water_source", { sounds = {} }) minetest.override_item("default:river_water_source", { sounds = {} })
minetest.override_item("default:river_water_flowing", { sounds = {} }) minetest.override_item("default:river_water_flowing", { sounds = {} })
-- sound sets -- sound sets (gain defaults to 0.3 unless specifically set)
local night = { local night = {
handler = {}, frequency = 40, handler = {}, frequency = 40,
{name = "hornedowl", length = 2}, {name = "hornedowl", length = 2},
{name = "wolves", length = 4}, {name = "wolves", length = 4, gain = 0.4},
{name = "cricket", length = 6}, {name = "cricket", length = 6},
{name = "deer", length = 7}, {name = "deer", length = 7},
{name = "frog", length = 1}, {name = "frog", length = 1},
@ -74,7 +73,7 @@ local underwater = {
local splash = { local splash = {
handler = {}, frequency = 1000, handler = {}, frequency = 1000,
{name = "swim_splashing", length=3}, {name = "swim_splashing", length = 3},
} }
local lava = { local lava = {
@ -94,7 +93,7 @@ local smallfire = {
local largefire = { local largefire = {
handler = {}, frequency = 1000, handler = {}, frequency = 1000,
{name = "fire_large", length = 8} {name = "fire_large", length = 8, gain = 0.8}
} }
local jungle = { local jungle = {
@ -251,7 +250,7 @@ local play_sound = function(player_name, list, number)
local handler = minetest.sound_play(list[number].name, { local handler = minetest.sound_play(list[number].name, {
to_player = player_name, to_player = player_name,
gain = volume * SOUNDVOLUME gain = (list[number].gain or 0.3) * SOUNDVOLUME
}) })
if handler then if handler then