module.exports = {

    init: function(){
        // this will be executed once when the osc server starts
    },

    oscInFilter:function(data) {

      var {host, port, address, args} = data

			if (address === '/playing') {
				receive("/measure", args[0].value)
				receive("/beat", args[1].value)
				receive("/visual_click", 1)
      }

			return

    },

    oscOutFilter:function(data) {

        var {host, port, address, args} = data

				if (address.substring(1, 6) == 'mixer') {
					tokens = address.split('/')
					ins = tokens[2]
					type = tokens[3]
					index = tokens[4]
					val = args[0].value
					args = [{'type': 's', 'value': ins}, {'type': 's', 'value': type}, {'type': 's', 'value': index}, {'type': 'f', 'value': val}]
          //console.log(data)
					address = '/mixer'
          return {host, port, address, args}
        }

				if (address === '/transport') {
          return {host, port, address, args}
        }

        return

    },

    unload: function(){
        // this will be executed when the custom module is reloaded
    },

}
