Пример #1
0
        public ScorePlayer(string filePath)
        {
            com = SharedSerialPort.StartInstance();
            sr  = new StreamReader(filePath);
            ss  = ScoreSharer.StartInstance();

            float.TryParse(ReadLine(), out bpm);
            float.TryParse(ReadLine(), out offset);

            notes     = new List <float> [4];
            types     = new List <char> [4];
            isGreenOn = new bool[4];
            isBlueOn  = new bool[4];
            for (int i = 0; i < 4; i++)
            {
                notes[i]     = new List <float>();
                types[i]     = new List <char>();
                isGreenOn[i] = false;
                isBlueOn[i]  = false;
            }

            //timer da 1000us = 1ms
            MsTimer = new Tick(MsTimer_Elapsed);
            MsTimer.Microseconds = 1000L;

            fillDone = false;
            FillLists();

            //parte da - (warmup + offset)
            currentMs = -(((60000.0f / bpm) / 4.0f * 20.0f + offset));
            MsTimer.Start();
        }
        public NotesPlayer(string filePath)
        {
            beatTimer = new Tick(BeatTimer_Elapsed);
            com       = SharedSerialPort.StartInstance();
            bbm       = new BeatBitMasker();
            sr        = new StreamReader(filePath);

            float.TryParse(ReadLine(), out float bpmt);
            float.TryParse(ReadLine(), out float offsett);

            bpm    = bpmt;
            offset = offsett;

            //timer: ogni beat
            beatTimer.Microseconds = (long)((60000.0f / bpm) / 4.0f * 1000.0f);
        }