Ejemplo n.º 1
0
    public void AddListener(OSCListener listener, bool doNotDestroyOnLoad)
    {
        if (!m_OSCListeners.Contains(listener))
        {
            if (listener.m_Address == null)
            {
                print("-- OSC: address is null");
            }
            else if (listener.m_Address == "")
            {
                print("-- OSC: Address is empty. Cannot register listener");
            }
            else if (listener.m_Address[0] != '/')
            {
                print("-- OSC: address does not contain leading slash");
            }
            else
            {
                m_OSCListeners.Add(listener);
            }
        }

        if (doNotDestroyOnLoad)
        {
            if (!m_DoNoDestroyOSCListeners.Contains(listener))
            {
                m_DoNoDestroyOSCListeners.Add(listener);
            }
        }
    }
Ejemplo n.º 2
0
    //public bool m_ActiveInput = false;

    //public float[]        m_ChangeAmounts;


    protected override void Start()
    {
        base.Start();

        m_OSCFFT = new OSCListener(m_OSCAddress, false);

//		m_ChangeAmounts = new float[ m_SampleCount ];
    }
Ejemplo n.º 3
0
 public void RemoveListener(OSCListener listener)
 {
     /*
      * if( !m_OSCListenerAddresses.Contains( listener.m_Address ) )
      * {
      *  m_OSCListenerAddresses.Add( listener.m_Address );
      * }
      */
 }
Ejemplo n.º 4
0
 public void addListener(string addressPrefix, OSCListener listener)
 {
     lock (this){
         if (!messageListeners.ContainsKey(addressPrefix))
         {
             messageListeners.Add(addressPrefix, new HashSet <OSCListener>());
         }
         messageListeners[addressPrefix].Add(listener);
     }
 }
Ejemplo n.º 5
0
 public void RemoveCallback(OSCListener cb)
 {
     try
     {
         callbacks.Remove(cb);
     }
     catch (Exception e)
     {
         Debug.LogError("Error removing callback: " + e.Message);
     }
 }
Ejemplo n.º 6
0
 public void removeListener(OSCListener listener)
 {
     lock (this){
         foreach (KeyValuePair <string, HashSet <OSCListener> > entry in messageListeners)
         {
             entry.Value.Remove(listener);
         }
     }
     // Notice: empty hashsets are not removed. Only a memory leak if you de-register a lot
     // of random addressPrefixes - which is really a weird thing
 }
Ejemplo n.º 7
0
    void Start()
    {
        m_GUIWindow = gameObject.GetComponent <ET_GUIWindow>() as ET_GUIWindow; // Add GUI window componant
        m_GUIWindow.Init("OSC Settings", gameObject, KeyCode.O);                // Initalize GUI Window

        m_OSCMute = new OSCListener("/osc/mute");                               // Setup the osc muste listener
        Debug.Log("My IP: " + Network.player.ipAddress);

        if (m_AutoSaveLoad)
        {
            Load("AutoSave");
        }
        else
        {
            StartServer(m_ServerPort);  // Start server
        }
        m_ServerPort = m_Server.LocalPort;
        tempPortIn   = m_Server.LocalPort.ToString();   // Set the temp port in to display in GUI
    }
    // Use this for initialization
    public void Start( )
    {
        m_Tform = transform;

        if (m_GetPos != RecieveState.Off)
        {
            m_PosOSC = new OSCListener(m_OSCName + "/pos");
        }
        if (m_GetRot != RecieveState.Off)
        {
            m_RotOSC = new OSCListener(m_OSCName + "/rot");
        }
        if (m_GetScale != RecieveState.Off)
        {
            m_ScaleOSC = new OSCListener(m_OSCName + "/scale");
        }

        // hack until multivalue osc fixed
        m_PosXOSC = new OSCListener(m_OSCName + "/pos/x");
        m_PosYOSC = new OSCListener(m_OSCName + "/pos/y");
        m_PosZOSC = new OSCListener(m_OSCName + "/pos/z");
    }
 void Awake()
 {
     m_DynamicInputListener = new OSCListener("/dynamicinput/");
     m_DynamicInputListener.m_ListenForChildren = true;
     LoadMappingConfig();
 }
Ejemplo n.º 10
0
 public void AddCallback(OSCListener cb)
 {
     callbacks.Add(cb);
 }
    void Start()
    {
        cameraDistance = transform.localPosition.z;

        OscScript = GetComponent<OSCListener>();
    }
Ejemplo n.º 12
0
 void Start()
 {
     m_OSCLookup = new OSCListener(m_OSCAddress);
 }