playTimer=Timer.new(0)
playTimer:reset()

function startTimer()
	playTimer:start()
end

function stopTimer()
	playTimer:reset()
end

--returns nil if no event, otherwise returns something (for the moment, the time past since the last event)
function getPlayEvent(fast)
	local timerTime=playTimer:time()
	if (fast and timerTime>=USERPREF["fastSpeed"]) or 
		(fast==false and timerTime>=USERPREF["slowSpeed"])  then
		playTimer:reset()
		playTimer:start()
		return timerTime
	end
	return nil
end