Beispiel #1
0
        //long Mis = 0;
        internal void MIDI(byte Note, byte Velocity)
        {
            Note note = new Note(Note);
            note.Time -= StartNoteTime-(tbCorrection.Value-500);

            for (int i = 0; i < nNote; i++)
            {
                if (Misure[TimerTick / Tick].Notes[TimerTick % Tick, i] == Note)
                {
                    note.Hit = true;
                    note.Error = (note.Time - (long)(Interval * TimerTick));
                    Difference += Math.Abs(note.Error);
                    nDifference++;
                    PlayedNotes.Add(note);
                    return;
                }
                else
                {
                    for (int tcount = 1; tcount < HitFinder; tcount++)
                    {
                        if ((((TimerTick - tcount) / Tick) >= 0 && (TimerTick - tcount) % Tick>=0 && Misure[(TimerTick - tcount) / Tick].Notes[(TimerTick - tcount) % Tick, i] == Note))
                        {
                            note.Hit = true;
                            note.Error = (note.Time - (long)(Interval * (TimerTick - tcount)));
                            Difference += Math.Abs(note.Error);
                            nDifference++;
                            PlayedNotes.Add(note);
                            return;
                        }
                        else if ((((TimerTick + tcount) / Tick) < nMisure && Misure[(TimerTick + tcount) / Tick].Notes[(TimerTick + tcount) % Tick, i] == Note))
                        {
                            note.Hit = true;
                            note.Error = (note.Time - (long)(Interval * (TimerTick + tcount)));
                            Difference += Math.Abs(note.Error);
                            nDifference++;
                            PlayedNotes.Add(note);
                            return;
                        }
                    }
                }
            }
            //if (note.Hit == false) Mis++;
             PlayedNotes.Add(note);

            //this.Text = "Error:" + (Difference / nDifference).ToString() + " Mis:" + Mis.ToString();
        }
Beispiel #2
0
        public VirtualForm(MainForm main)
        {
            Singleton = this;
            InitializeComponent();
            mainForm = main;

            string OptionPath = Application.StartupPath + System.IO.Path.DirectorySeparatorChar.ToString() + "Option.ini";

            string sBassDrum=UtilityIniFile.GetIniString("Virtual", "BassDrum", OptionPath);
            string sSnare = UtilityIniFile.GetIniString("Virtual", "Snare", OptionPath);
            string sTom1 = UtilityIniFile.GetIniString("Virtual", "Tom1", OptionPath);
            string sTom2 = UtilityIniFile.GetIniString("Virtual", "Tom2", OptionPath);
            string sTom3 = UtilityIniFile.GetIniString("Virtual", "Tom3", OptionPath);
            string sFloorTom1 = UtilityIniFile.GetIniString("Virtual", "FloorTom1", OptionPath);
            string sFloorTom2 = UtilityIniFile.GetIniString("Virtual", "FloorTom2", OptionPath);
            string sHH = UtilityIniFile.GetIniString("Virtual", "HH", OptionPath);
            string sCrash1 = UtilityIniFile.GetIniString("Virtual", "Crash1", OptionPath);
            string sCrash2 = UtilityIniFile.GetIniString("Virtual", "Crash2", OptionPath);
            string sRide = UtilityIniFile.GetIniString("Virtual", "Ride", OptionPath);
            string sChina = UtilityIniFile.GetIniString("Virtual", "China", OptionPath);

            foreach (Keys k in Enum.GetValues(typeof(Keys)))
            {
                cbBassDrum.Items.Add(k);
                cbSnare.Items.Add(k);
                cbTom1.Items.Add(k);
                cbTom2.Items.Add(k);
                cbTom3.Items.Add(k);
                cbFloorTom1.Items.Add(k);
                cbFloorTom2.Items.Add(k);
                cbCrash1.Items.Add(k);
                cbCrash2.Items.Add(k);
                cbHH.Items.Add(k);
                cbRide.Items.Add(k);
                cbChina.Items.Add(k);
                if (k.ToString() == sBassDrum.Split(',')[0]) cbBassDrum.SelectedItem = k;
                if (k.ToString() == sTom1.Split(',')[0]) cbTom1.SelectedItem = k;
                if (k.ToString() == sTom2.Split(',')[0]) cbTom2.SelectedItem = k;
                if (k.ToString() == sTom3.Split(',')[0]) cbTom3.SelectedItem = k;
                if (k.ToString() == sFloorTom1.Split(',')[0]) cbFloorTom1.SelectedItem = k;
                if (k.ToString() == sFloorTom2.Split(',')[0]) cbFloorTom2.SelectedItem = k;
                if (k.ToString() == sHH.Split(',')[0]) cbHH.SelectedItem = k;
                if (k.ToString() == sCrash1.Split(',')[0]) cbCrash1.SelectedItem = k;
                if (k.ToString() == sCrash2.Split(',')[0]) cbCrash2.SelectedItem = k;
                if (k.ToString() == sRide.Split(',')[0]) cbRide.SelectedItem = k;
                if (k.ToString() == sChina.Split(',')[0]) cbChina.SelectedItem = k;
                if (k.ToString() == sSnare.Split(',')[0]) cbSnare.SelectedItem = k;
            }

            for (byte n = 0; n < 84; n++)
            {
                Note note = new Note(n);
                cbNoteBassDrum.Items.Add(note);
                cbNoteSnare.Items.Add(note);
                cbNoteTom1.Items.Add(note);
                cbNoteTom2.Items.Add(note);
                cbNoteTom3.Items.Add(note);
                cbNoteFloorTom1.Items.Add(note);
                cbNoteFloorTom2.Items.Add(note);
                cbNoteHH.Items.Add(note);
                cbNoteCrash1.Items.Add(note);
                cbNoteCrash2.Items.Add(note);
                cbNoteRide.Items.Add(note);
                cbNoteChina.Items.Add(note);
                if (n == Convert.ToInt32(sBassDrum.Split(',')[1])) cbNoteBassDrum.SelectedItem = note;
                if (n == Convert.ToInt32(sSnare.Split(',')[1])) cbNoteSnare.SelectedItem = note;
                if (n == Convert.ToInt32(sTom1.Split(',')[1])) cbNoteTom1.SelectedItem = note;
                if (n == Convert.ToInt32(sTom2.Split(',')[1])) cbNoteTom2.SelectedItem = note;
                if (n == Convert.ToInt32(sTom3.Split(',')[1])) cbNoteTom3.SelectedItem = note;
                if (n == Convert.ToInt32(sFloorTom1.Split(',')[1])) cbNoteFloorTom1.SelectedItem = note;
                if (n == Convert.ToInt32(sFloorTom2.Split(',')[1])) cbNoteFloorTom2.SelectedItem = note;
                if (n == Convert.ToInt32(sHH.Split(',')[1])) cbNoteHH.SelectedItem = note;
                if (n == Convert.ToInt32(sCrash1.Split(',')[1])) cbNoteCrash1.SelectedItem = note;
                if (n == Convert.ToInt32(sCrash2.Split(',')[1])) cbNoteCrash2.SelectedItem = note;
                if (n == Convert.ToInt32(sRide.Split(',')[1])) cbNoteRide.SelectedItem = note;
                if (n == Convert.ToInt32(sChina.Split(',')[1])) cbNoteChina.SelectedItem = note;
            }
        }