コード例 #1
0
ファイル: BASSControl.cs プロジェクト: walney/KMC
        public static Boolean MidiFilterProc(int handle, int track, IntPtr midievent, bool seeking, IntPtr user)
        {
            try
            {
                Int32           Track = track;
                BASS_MIDI_EVENT temp  = BASS_MIDI_EVENT.FromIntPtr(midievent);

                if (temp.eventtype == BASSMIDIEvent.MIDI_EVENT_NOTE && (Properties.Settings.Default.IgnoreNotes1 || Properties.Settings.Default.AskForIgnoreTracks))
                {
                    if (TracksList[Track])
                    {
                        return(false);
                    }

                    int vel  = (temp.param >> 0x08) & 0xFF;
                    int note = temp.param & 0xFF;

                    // First check
                    if ((Properties.Settings.Default.IgnoreNotes1 && vel > 0) && (vel >= Properties.Settings.Default.IgnoreNotesLow && vel <= Properties.Settings.Default.IgnoreNotesHigh))
                    {
                        return(false);
                    }

                    // Second
                    if (Properties.Settings.Default.Limit88 && (temp.chan != 9 && !(note >= 21 && note <= 108)))
                    {
                        return(false);
                    }
                }

                if (MainWindow.VSTs.VSTInfo[0].isInstrument)
                {
                    BassVst.BASS_VST_ProcessEvent(MainWindow.VSTs._VSTiHandle, temp.chan, temp.eventtype, temp.param);
                }

                return(true); // process the event
            }
            catch (Exception ex)
            {
                BASSCloseStreamCrash(ex);
                return(false);
            }
        }