public object clipPlaying(ZstMethod methodData) { Dictionary <string, object> output = JsonConvert.DeserializeObject <Dictionary <string, object> >(methodData.output.ToString()); int trackIndex = Convert.ToInt32(output["trackindex"]); int slotIndex = Convert.ToInt32(output["slotindex"]); InstrumentClip playingClip = InstrumentController.Instance.GetInstrumentByTrackindex(trackIndex).playingClip; if (slotIndex < 0) { //Stopping if (playingClip != null) { playingClip.SetClipState(InstrumentClip.ClipState.IS_DISABLED); } } else { if (playingClip != null) { playingClip.SetClipState(InstrumentClip.ClipState.IS_DISABLED); } InstrumentClip clip = InstrumentController.Instance.FindClip(trackIndex, slotIndex); clip.SetClipState(InstrumentClip.ClipState.IS_PLAYING); } return(null); }
/* * Incoming methods */ public object instrumentValueUpdated(ZstMethod methodData) { Debug.Log(methodData.output); Dictionary <string, object> output = JsonConvert.DeserializeObject <Dictionary <string, object> >(methodData.output.ToString()); BaseInstrumentParam param = InstrumentController.Instance.FindParameter(Convert.ToInt32(output["trackindex"]), Convert.ToInt32(output["deviceindex"]), Convert.ToInt32(output["parameterindex"])); if (param != null) { param.setScaledVal(Convert.ToSingle(output["value"]), true); } return(null); }
public object clipFired(ZstMethod methodData) { Dictionary <string, object> output = JsonConvert.DeserializeObject <Dictionary <string, object> >(methodData.output.ToString()); int trackIndex = Convert.ToInt32(output["trackindex"]); int slotIndex = Convert.ToInt32(output["slotindex"]); if (slotIndex >= 0) { InstrumentClip clip = InstrumentController.Instance.FindClip(trackIndex, slotIndex); clip.SetClipState(InstrumentClip.ClipState.IS_QUEUED); } return(null); }
// Use this for initialization void Start() { m_instance = this; m_node = new ZstNode("UnityNode", "tcp://" + m_stageAddress + ":" + m_port); m_node.requestRegisterNode(); m_peers = m_node.requestNodePeerlinks(); m_livePeer = m_peers["LiveNode"]; m_node.subscribeToNode(m_livePeer); m_node.connectToPeer(m_livePeer); ZstMethod response = m_node.updateRemoteMethod(m_livePeer.methods["get_song_layout"]); string output = response.output.ToString(); m_instrumentSpawner.LoadLiveSessionXml(output); //Subscribe to value updates m_node.subscribeToMethod(m_livePeer.methods["value_updated"], instrumentValueUpdated); m_node.subscribeToMethod(m_livePeer.methods["fired_slot_index"], clipFired); m_node.subscribeToMethod(m_livePeer.methods["playing_slot_index"], clipPlaying); //m_node.subscribeToMethod(m_livePeer.methods["value_updated"], clipFired); }
public object layoutUpdated(ZstMethod methodData) { Debug.Log("Received layout update from Live"); Debug.Log(methodData.output.ToString()); //createLiveProxies(deserializeLayout(methodData.output.ToString())); return null; }