Exemplo n.º 1
0
    void Update()
    {
        if (!isInitialized || !csoundUnity.IsInitialized)
        {
            return;
        }

        if (Input.GetKeyDown("1"))
        {
            csoundUnity.SendScoreEvent("i\"ClearSequencer\" 0 0 ");
            Invoke("updateSequencerGUI", .1f);
        }

        if (Input.GetKeyDown("2"))
        {
            csoundUnity.SendScoreEvent("i\"RandomSequencer\" 0 0 ");
            Invoke("updateSequencerGUI", .1f);
        }


        if (csoundUnity)
        {
            csoundUnity.SetChannel("BPM", BPM);
        }

        if (beatNumber != csoundUnity.GetChannel("beatNumber"))
        {
            beatNumber = (int)csoundUnity.GetChannel("beatNumber");

            if (showSequencerGUI)
            {
                for (int voice = 0; voice < numberOfVoices; voice++)
                {
                    for (int beat = 0; beat < numberOfBeats; beat++)
                    {
                        if (beat == beatNumber)
                        {
                            pads[beat + (voice * numberOfBeats)].transform.localScale = new Vector3(0.8f, 0.8f, 0.1f);
                        }

                        else
                        {
                            pads[beat + (voice * numberOfBeats)].transform.localScale = new Vector3(0.5f, 0.5f, 0.1f);
                        }
                    }
                }
            }
        }
    }
Exemplo n.º 2
0
    private void DrawTestScore()
    {
        m_drawTestScore.boolValue = EditorGUILayout.Foldout(m_drawTestScore.boolValue, "Test Score Section", true);
        if (m_drawTestScore.boolValue)
        {
            EditorGUILayout.HelpBox("Write test score here, syntax: \n\n\tp1\tp2\tp3\tp4\t...\tpN\ni\tinum\tstart\tdur\t...\t...\t...", MessageType.None);
            m_csoundScore.stringValue = EditorGUILayout.TextField(m_csoundScore.stringValue);

            if (GUILayout.Button("Send score") && m_csoundScore.stringValue.Length > 3 && Application.isPlaying && csoundUnity != null)
            {
                Debug.Log("sending score: " + m_csoundScore.stringValue);
                csoundUnity.SendScoreEvent(m_csoundScore.stringValue);
            }
        }

        /*
         * EditorGUI.BeginChangeCheck();
         * _drawTestScore = EditorGUILayout.Foldout(_drawTestScore, "Test Score Section");
         * if (EditorGUI.EndChangeCheck()) {
         *  if (_drawTestScore)
         *  {
         *
         *      EditorGUILayout.HelpBox("Write test score here, syntax: \n\n\tp1\tp2\tp3\tp4\t...\tpN\ni\tinum\tstart\tdur\t...\t...\t...", MessageType.None);
         *      m_csoundScore.stringValue = EditorGUILayout.TextField(m_csoundScore.stringValue);
         *
         *      if (GUILayout.Button("Send score") && m_csoundScore.stringValue.Length > 3 && Application.isPlaying && csoundUnity != null)
         *      {
         *          Debug.Log("sending score: " + m_csoundScore.stringValue);
         *          csoundUnity.SendScoreEvent(m_csoundScore.stringValue);
         *      }
         *  }
         * }
         */
    }