--[[
---------------------------------------------------------------------------
Remote Train Control Program for Windows

© Copyright 2019 by Mark DiVecchio

	This file is part of Remote Train Control.

	Remote Train Control is free software: you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation, either version 3 of the License, or
	(at your option) any later version.

	Remote Train Control is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with Remote Train Control.  If not, see <http://www.gnu.org/licenses/>.

 Home Page : http://www.silogic.com/trains/RTC_Running.html
---------------------------------------------------------------------------]]
-- Semicolons are not required in Lua code
-- Volume Level Test
title = "Volume Level Test"
require("defines");

math.randomseed(os.time());	-- random seed

function setup(Engine, TIU)

-- read up the volume levels
	vol = GetVolume(0, Engine, TIU);
	print ("Master Volume " .. vol);
	vol = GetVolume(1, Engine, TIU);
	print ("Engine Volume " .. vol);
	vol = GetVolume(2, Engine, TIU);
	print ("Accent Volume " .. vol);
	vol = GetVolume(3, Engine, TIU);
	print ("Horn Volume " .. vol);
	vol = GetVolume(4, Engine, TIU);
	print ("Bell Volume " .. vol);
	
	print("Setting Volume Levels");
	
	vol = SetVolume(0, math.random(0,100), 0, Engine, TIU);
	vol = SetVolume(1, math.random(0,100), 0, Engine, TIU);
	vol = SetVolume(2, math.random(0,100), 0, Engine, TIU);
	vol = SetVolume(3, math.random(0,100), 0, Engine, TIU);
	vol = SetVolume(4, math.random(0,100), 0, Engine, TIU);
	
	Sleep(5);	-- let the SetVolume() functions complete
	
	vol = GetVolume(0, Engine, TIU);
	print ("Master Volume " .. vol);
	vol = GetVolume(1, Engine, TIU);
	print ("Engine Volume " .. vol);
	vol = GetVolume(2, Engine, TIU);
	print ("Accent Volume " .. vol);
	vol = GetVolume(3, Engine, TIU);
	print ("Horn Volume " .. vol);
	vol = GetVolume(4, Engine, TIU);
	print ("Bell Volume " .. vol);		
	return true;
	end
	
function loop(Engine, TIU)
	return false;	-- false=do not loop, true=continue to loop
	end
	
function cleanup(Engine, TIU)
	return true;
	end
	