Example #1
0
        // Check if a note matchs the note options.
        bool NoteFilter(MidiNoteControl note)
        {
            var device = (Minis.MidiDevice)note.device;

            if (_channel != Channel.All && (int)_channel != device.channel)
            {
                return(false);
            }

            var number = note.noteNumber;

            switch (_source)
            {
            case Source.NoteNumbers:
                foreach (var n in _noteNumbers)
                {
                    if (n == number)
                    {
                        return(true);
                    }
                }
                return(false);

            case Source.NoteRange:
                return(_lowestNote <= number && number <= _highestNote);

            default: // Source.AllNotes:
                return(true);
            }
        }
Example #2
0
 // Note off callback for MIDI device
 void OnMidiNoteOff(MidiNoteControl note)
 {
     if (NoteFilter(note))
     {
         OnNoteOff(note.noteNumber);
     }
 }
Example #3
0
 // Note on callback for MIDI device
 void OnMidiNoteOn(MidiNoteControl note, float velocity)
 {
     if (NoteFilter(note))
     {
         OnNoteOn(note.noteNumber, velocity);
     }
 }
 // Note off callback for MIDI device
 void OnMidiNoteOff(MidiNoteControl note)
 {
     if (NoteFilter(note))
     {
         OnNoteOff();
     }
 }
Example #5
0
    void OnPerformed(InputAction.CallbackContext ctx)
    {
        MidiNoteControl controller = ctx.control as MidiNoteControl;

        precisionManager.PadHit(controller.noteNumber);


        //color changing
        var cubeRenderer = cube.GetComponent <Renderer>();

        System.Random ran = new System.Random();
        //int r = (int)(255 * controller.velocity / (ran.NextDouble() * 8));
        //int g = (int)(255 * controller.velocity / (ran.NextDouble() * 8));
        //int b = (int)(255 * controller.velocity / (ran.NextDouble() * 8));

        int r = (int)(255 * 2.5 / (ran.NextDouble() * 8));
        int g = (int)(255 * 2 / (ran.NextDouble() * 8));
        int b = (int)(255 * 2 / (ran.NextDouble() * 8));

        cubeRenderer.material.SetColor("_Color", new Color(r / 255f, g / 255f, b / 255f));
    }
Example #6
0
    void OnPerformed(InputAction.CallbackContext ctx)
    {
        MidiNoteControl controller = ctx.control as MidiNoteControl;

        recordManager.PadHit(controller.noteNumber);
    }