private void ProcessMidiNotifications(MidiChannel channel, int note, float velocity)
        {
            // This is to prevent any button press recognition.
            if (velocity == 1 || velocity == 0)
            {
                return;
            }

            MidiBookmark getActiveBookMark = midiTweak.GetActiveBookmark();

            if (getActiveBookMark.KnobID != note)
            {
                int getBookMarkIndex = -1;

                //  Switch the parameter to the bookmark it is bound to.
                if (IsInputBoundToBookMark(note, out getBookMarkIndex))
                {
                    SwitchParameterWithTolerance(note, getBookMarkIndex);
                    return;
                }
            }

            if (midiTweak.ConfigSettings.LimitInputToMidiAssignments && getActiveBookMark.KnobID != note)
            {
                return;
            }

            midiTweak.SetValueByPercentage(velocity);
        }
Esempio n. 2
0
        /// <summary>
        /// Parameter bookmarks are used to quickly access obtained reflection data
        /// The play mode data will also be saved with this method.
        /// </summary>
        /// <returns></returns>
        private List <MidiBookmark> CreateParameterBookmarks()
        {
            List <MidiBookmark> createParameterBookMark = new List <MidiBookmark>();

            for (int i = 0; i < componentManipulator.parameterDataCollection.Count; i++)
            {
                for (int i2 = 0; i2 < componentManipulator.parameterDataCollection[i].data.Count; i2++)
                {
                    for (int i3 = 0; i3 < componentManipulator.parameterDataCollection[i].data[i2].fieldData.Count; i3++)
                    {
                        ParameterData getParameterData = componentManipulator.parameterDataCollection[i].data[i2];

                        if (componentManipulator.GetFieldValue(getParameterData.component, getParameterData.fieldData[i3]) == null)
                        {
                            continue;
                        }

                        // Create midi bookmarks
                        MidiBookmark createParamBookmark =
                            new MidiBookmark(
                                getParameterData.fieldData[i3].assignedMidiInput,
                                getParameterData.component,
                                getParameterData.fieldData[i3],
                                0);

                        createParameterBookMark.Add(createParamBookmark);

                        // Store a link to the parameter data location, so it knows where to save the value later
                        configPlayMode.AddData(i, i2, i3);
                    }
                }
            }

            return(createParameterBookMark);
        }