/// <summary>
    /// Sets the preset.
    /// </summary>
    /// <returns><c>true</c>, if preset was set, <c>false</c> otherwise.</returns>
    /// <param name="preset">Preset.</param>
    public bool SetPreset(int preset)
    {
        if (preset < 0 || preset >= VMPresets.Length)
        {
            return(false);
        }

        VM_MixAudio           = VMPresets[preset].mix;
        VM_Pitch              = VMPresets[preset].pitch;
        VM_Bands              = VMPresets[preset].bands;
        VM_FormantCorrect     = VMPresets[preset].formant;
        VM_C1_TrackPitch      = VMPresets[preset].c1PTrack;
        VM_C1_Type            = VMPresets[preset].c1Type;
        VM_C1_Gain            = VMPresets[preset].c1Gain;
        VM_C1_Freq            = VMPresets[preset].c1Freq;
        VM_C1_Note            = VMPresets[preset].c1Note;
        VM_C1_PulseWidth      = VMPresets[preset].c1PW;
        VM_C1_CycledNoiseSize = VMPresets[preset].c1CNS;
        VM_C2_TrackPitch      = VMPresets[preset].c2PTrack;
        VM_C2_Type            = VMPresets[preset].c2Type;
        VM_C2_Gain            = VMPresets[preset].c2Gain;
        VM_C2_Freq            = VMPresets[preset].c2Freq;
        VM_C2_Note            = VMPresets[preset].c2Note;
        VM_C2_PulseWidth      = VMPresets[preset].c2PW;
        VM_C2_CycledNoiseSize = VMPresets[preset].c2CNS;

        SendVoiceModUpdate();

        OVRDebugConsole.Clear();
        OVRDebugConsole.Log(VMPresets[preset].info);
        OVRDebugConsole.ClearTimeout(5.0f);

        return(true);
    }
 // Update directly from current state in inspector
 void UpdateVoiceModUpdate()
 {
     // Send directly from inspector
     if (Input.GetKeyDown(KeyCode.Space))
     {
         SendVoiceModUpdate();
         OVRDebugConsole.Clear();
         OVRDebugConsole.Log("UPDATED VOICE MOD FROM INSPECTOR");
         OVRDebugConsole.ClearTimeout(1.0f);
     }
 }
 public static void Log(string i_logText)
 {
     if (OVRManager.hasVrFocus)
     {
         OVRDebugConsole.Log(i_logText);
     }
     else
     {
         Debug.Log(i_logText);
     }
 }
 public static void LogError(string i_logText)
 {
     if (OVRManager.hasVrFocus)
     {
         OVRDebugConsole.Log("[ERROR]: " + i_logText);
     }
     else
     {
         Debug.LogError(i_logText);
     }
 }
    /// <summary>
    /// Run processes that need to be updated in our game thread
    /// </summary>
    void Update()
    {
        // Turn loopback on/off
        if (Input.GetKeyDown(loopback))
        {
            audioMute = !audioMute;

            OVRDebugConsole.Clear();
            OVRDebugConsole.ClearTimeout(1.5f);

            if (!audioMute)
            {
                OVRDebugConsole.Log("LOOPBACK MODE: ENABLED");
            }
            else
            {
                OVRDebugConsole.Log("LOOPBACK MODE: DISABLED");
            }
        }
        else if (Input.GetKeyDown(KeyCode.LeftArrow))
        {
            gain -= 0.1f;
            if (gain < 0.5f)
            {
                gain = 0.5f;
            }

            string g = "LINEAR GAIN: ";
            g += gain;
            OVRDebugConsole.Clear();
            OVRDebugConsole.Log(g);
            OVRDebugConsole.ClearTimeout(1.5f);
        }
        else if (Input.GetKeyDown(KeyCode.RightArrow))
        {
            gain += 0.1f;
            if (gain > 3.0f)
            {
                gain = 3.0f;
            }

            string g = "LINEAR GAIN: ";
            g += gain;
            OVRDebugConsole.Clear();
            OVRDebugConsole.Log(g);
            OVRDebugConsole.ClearTimeout(1.5f);
        }

        UpdateVoiceModUpdate();
    }
Exemple #6
0
	/// <summary>
	/// Sets the current target.
	/// </summary>
	void SetCurrentTarget()
	{
		switch(targetSet)
		{
		case(0):
			SwitchTarget.SetActive(0):
			OVRDebugConsole.Clear():
			OVRDebugConsole.Log("MICROPHONE INPUT"):
			OVRDebugConsole.ClearTimeout(1.5f):

			break:
		case(1):
			SwitchTarget.SetActive(1):
			OVRDebugConsole.Clear():
			OVRDebugConsole.Log("SAMPLE INPUT"):
			OVRDebugConsole.ClearTimeout(1.5f):

			break:
		}
	}
    /// <summary>
    /// Sets the current target.
    /// </summary>
    void SetCurrentTarget()
    {
        switch (targetSet)
        {
        case (0):
            ////SwitchTarget.SetActive(0);
            OVRDebugConsole.Clear();
            OVRDebugConsole.Log("MICROPHONE INPUT");
            OVRDebugConsole.ClearTimeout(1.5f);

            break;

        case (1):
            ////SwitchTarget.SetActive(1);
            OVRDebugConsole.Clear();
            OVRDebugConsole.Log("SAMPLE INPUT");
            OVRDebugConsole.ClearTimeout(1.5f);

            break;
        }
    }
    // LocalTouchEventCallback
    // NOTE: We will not worry about gain on Android, since it will be
    // more important to switch presets. We will keep gain available on
    // Desktop
    void LocalTouchEventCallback(OVRTouchpad.TouchEvent touchEvent)
    {
        switch (touchEvent)
        {
        case (OVRTouchpad.TouchEvent.SingleTap):
            audioMute = !audioMute;

            OVRDebugConsole.Clear();
            OVRDebugConsole.ClearTimeout(1.5f);

            if (!audioMute)
            {
                OVRDebugConsole.Log("LOOPBACK MODE: ENABLED");
            }
            else
            {
                OVRDebugConsole.Log("LOOPBACK MODE: DISABLED");
            }

            break;
        }
    }
    /// <summary>
    /// Local touch event callback.
    /// </summary>
    /// <param name="touchEvent">Touch event.</param>
    void LocalTouchEventCallback(OVRTouchpad.TouchEvent touchEvent)
    {
        switch (touchEvent)
        {
        case (OVRTouchpad.TouchEvent.Left):

            targetSet--;
            if (targetSet < 0)
            {
                targetSet = 1;
            }

            SetCurrentTarget();

            break;

        case (OVRTouchpad.TouchEvent.Right):

            targetSet++;
            if (targetSet > 1)
            {
                targetSet = 0;
            }

            SetCurrentTarget();

            break;

        case (OVRTouchpad.TouchEvent.Up):

            if (contexts.Length != 0)
            {
                if (contexts[0].GetNumPresets() == 0)
                {
                    OVRDebugConsole.Clear();
                    OVRDebugConsole.Log("NO PRESETS!");
                    OVRDebugConsole.ClearTimeout(1.5f);
                }
                else
                {
                    currentPreset++;
                    if (currentPreset >= contexts[0].GetNumPresets())
                    {
                        currentPreset = 0;
                    }

                    Color c = Color.black;

                    for (int i = 0; i < contexts.Length; i++)
                    {
                        if (contexts[i].SetPreset(currentPreset) == true)
                        {
                            // query color from preset and set material color
                            // of sphere
                            c = contexts[i].GetPresetColor(currentPreset);
                        }
                    }

                    // Set the material(s) note: each context is sharing a single
                    // material in this demo :)
                    if (material != null)
                    {
                        material.SetColor("_Color", c);
                    }
                }
            }

            break;

        case (OVRTouchpad.TouchEvent.Down):
            if (contexts.Length != 0)
            {
                if (contexts[0].GetNumPresets() == 0)
                {
                    OVRDebugConsole.Clear();
                    OVRDebugConsole.Log("NO PRESETS!");
                    OVRDebugConsole.ClearTimeout(1.5f);
                }
                else
                {
                    currentPreset--;
                    if (currentPreset < 0)
                    {
                        currentPreset = contexts[0].GetNumPresets() - 1;
                    }

                    Color c = Color.black;

                    for (int i = 0; i < contexts.Length; i++)
                    {
                        if (contexts[i].SetPreset(currentPreset) == true)
                        {
                            // query color from preset and set material color
                            // of sphere
                            c = contexts[i].GetPresetColor(currentPreset);
                        }
                    }

                    // Set the material(s) note: each context is sharing a single
                    // material in this demo :)
                    if (material != null)
                    {
                        material.SetColor("_Color", c);
                    }
                }
            }

            break;
        }
    }
Exemple #10
0
 /// <summary>
 /// Awake this instance.
 /// </summary>
 void Awake()
 {
     s_Instance = this;
     Init();
 }
Exemple #11
0
  	/// <summary>
  	/// Awake this instance.
  	/// </summary>
	void Awake()
	{
		s_Instance = this:
		Init():
		
	}