Esempio n. 1
0
        private void UpdateLabel()
        {
            var label = gameObject.transform.Find("Label");

            if (label)
            {
                var text = label.GetComponent <Text>();
                if (!_useControl)
                {
                    text.text = _midiChannel.ToString().ToUpper() + " N" + _noteNumber;
                }
                else
                {
                    text.text = _midiChannel.ToString().ToUpper() + " C" + _controlNumber;
                }
            }
        }
Esempio n. 2
0
        public override void WriteSVG(SvgWriter w, bool staffIsVisible, int systemNumber, int staffNumber, int voiceNumber)
        {
            w.SvgStartGroup("outputVoice", "sys" + systemNumber.ToString() + "staff" + staffNumber.ToString() + "voice" + voiceNumber.ToString());

            if (MasterVolume != null) // is non-null only in the first system
            {
                w.WriteAttributeString("score", "midiChannel", null, MidiChannel.ToString());
                w.WriteAttributeString("score", "masterVolume", null, MasterVolume.ToString());
            }

            base.WriteSVG(w, staffIsVisible);
            w.SvgEndGroup(); // outputVoice
        }
Esempio n. 3
0
        /// <summary>
        /// Writes out the noteObjects, and possibly the performanceOptions for an InputVoice.
        /// </summary>
        public override void WriteSVG(SvgWriter w, bool staffIsVisible, int systemNumber, int staffNumber, int voiceNumber)
        {
            w.SvgStartGroup("inputVoice", "sys" + systemNumber.ToString() + "staff" + staffNumber.ToString() + "voice" + voiceNumber.ToString());

            if (_midiChannel < byte.MaxValue)
            {
                // This can only happen on the first system in the score. See SetMidiChannel(...) below.
                w.WriteAttributeString("score", "midiChannel", null, MidiChannel.ToString());
            }

            base.WriteSVG(w, true); // input voices are always visible

            w.SvgEndGroup();        // inputVoice
        }
Esempio n. 4
0
    public override void NodeGUI()
    {
        GUILayout.BeginHorizontal();
        GUILayout.BeginVertical();
        if (!bound && !binding)
        {
            if (GUILayout.Button("Bind input note"))
            {
                MidiMaster.noteOnDelegate += BindMIDINote;
                binding = true;
            }
        }
        else
        {
            if (bound)
            {
                string label = string.Format("{0} note {1}: {2:0.00}", channel.ToString(), note, value);
                GUILayout.Label(label);
                if (GUILayout.Button("Unbind"))
                {
                    MidiMaster.noteOnDelegate  -= ReceiveNoteDown;
                    MidiMaster.noteOffDelegate -= ReceiveNoteUp;
                    note  = 0;
                    bound = false;
                }
            }
            else
            {
                GUILayout.Label("Play note to bind");
            }
        }
        GUILayout.EndVertical();
        valueKnob.DisplayLayout();
        GUILayout.EndHorizontal();

        if (GUI.changed)
        {
            NodeEditor.curNodeCanvas.OnNodeChange(this);
        }
    }
Esempio n. 5
0
    public override void NodeGUI()
    {
        GUILayout.BeginHorizontal();
        GUILayout.BeginVertical();
        if (!bound && !binding)
        {
            if (GUILayout.Button("Bind input knob"))
            {
                MidiMaster.knobDelegate += BindMIDIControl;
                binding = true;
            }
        }
        else
        {
            if (bound)
            {
                string label = string.Format("{0} ctrl {1}: {2:0.00}", channel.ToString(), controlID, value);
                GUILayout.Label(label);
                if (GUILayout.Button("Unbind"))
                {
                    MidiMaster.knobDelegate -= ReceiveMIDIMessage;
                    controlID = 0;
                    bound     = false;
                }
            }
            else
            {
                GUILayout.Label("Use control to bind");
            }
        }
        GUILayout.EndVertical();
        valueKnob.DisplayLayout();
        GUILayout.EndHorizontal();

        if (GUI.changed)
        {
            NodeEditor.curNodeCanvas.OnNodeChange(this);
        }
    }
Esempio n. 6
0
    public static bool ConfigMidi()
    {
        foreach (MidiChannel mCh in Enum.GetValues(typeof(MidiChannel)))
        {
            for (int note = 0; note < 127; note++)
            {
                if (MidiMaster.GetKey(mCh, note) != 0)
                {
                    usingMidi   = true;
                    midiChannel = mCh;
                    midiNote    = note;

                    Debug.Log("Configuring midi controller...");
                    Debug.Log("Using midi channel [" + midiChannel.ToString() + "]...");
                    Debug.Log("Using midi root note [" + midiNote.ToString() + "]...");

                    return(true);
                }
            }
        }

        if (Input.anyKey)
        {
            if (Input.GetKey(KeyCode.A))
            {
                usingMidi = false;

                Debug.Log("Configuring computer keyboard...");
                Debug.Log("Using default keyboard setup...");

                return(true);
            }
        }


        return(false);
    }
 public override string ToString()
 {
     return(Command.ToString() + " - " + MidiChannel.ToString() + " - " + Data1.ToString() + " - " + Data2.ToString());
 }
Esempio n. 8
0
 private void OnNoteOff(MidiChannel channel, int note)
 {
     Log("[NoteOff] channel: " + channel.ToString() + " note: " + note);
     CheckNoteRange(note);
     luxKeys.OnKeyReleased(note);
 }
Esempio n. 9
0
 private void OnNoteOn(MidiChannel channel, int note, float velocity)
 {
     Log("[NoteOn] channel: " + channel.ToString() + " note: " + note + " velocity: " + velocity);
     CheckNoteRange(note);
     luxKeys.OnKeyPressed(note, velocity);
 }