Example #1
0
        //private void ScheduleStopTimeOut() {
        //  StopTimeOut = new System.Threading.Timer(
        //    StopTimeOutCallback,
        //    null,
        //    2000,  //2000 msecs
        //    System.Threading.Timeout.Infinite);  //no periodic callbacks
        //}

        //private void StopTimeOutCallback(object state) {
        //  LogicError.Throw(eStopError.Y000, "Stream Stop Failure");
        //  P.frmStart.StreamPlayOffAll();
        //  StopTimeOut = null;
        //}

        //private void KillStopTimeOut() {
        //  if (StopTimeOut == null) return;
        //  StopTimeOut.Change(System.Threading.Timeout.Infinite, System.Threading.Timeout.Infinite);
        //}

        //private void CheckMarkAndSave() {
        //  if (P.F.frmShowChords == null || !P.F.frmShowChords.Play.NewEvsChanged) return;
        //  P.F.CFTxt.Evs = P.F.CFTxt.NewEvs;
        //  P.F.CFTxt.NewEvs = new List<clsCF.clsEv>();
        //  foreach (clsCF.clsEv ev in P.F.CFTxt.Evs) P.F.CFTxt.NewEvs.Add(new clsCF.clsEv(ev));  //copy
        //  P.F.frmShowChords.Play.NewEvsChanged = false;
        //  P.F.frmShowChords.Refresh();
        //}

        private void StartSub()
        {
            BBTQueue.Clear();
            foreach (IFormPlayable pf in PlayableForms.Active)
            {
                ((Form)pf).BeginInvoke(new delegBBT(pf.StartSub), P.F.CurrentBBT);
            }
        }
Example #2
0
        //internal void StartRecord(Form playform, clsFileStream filestream, clsMute mute) {
        //  if (P.F.FileStreamMM != null) P.F.FileStreamMM.InitRec();
        //  StartPlayRecord(playform, filestream, mute);
        //}

        //internal void StartPlay(Form playform, clsFileStream filestream, clsMute mute) {
        //  StartPlayRecord(playform, filestream, mute);
        //}

        internal void StartPlay(Form playform, clsFileStream filestream, clsMute mute)
        {
            //* called from form thread
            //if (PlayCmdOn) DebugPlay();  //already playing?
            PlayableForms.CmdState_Stopped(); //before play starts - in case it fails
            RefreshBBTTimer.Stop();
            BBTQueue.Clear();

            //if (P.F.AutoSync != null && (!P.F.MidiFileLoaded || !P.frmStart.chkPlayMidiPriority.Checked)) {
            if (MidiPlay.OutMStream == null)
            {
                return;
            }
            P.F.Mute.StartPlay();
            //if (P.F.CurrentBBT.Bar >= new clsMTime.clsBBT(P.F.MaxTicks).Bar - 2) return;  //don't start too near the end
            if (P.F.CurrentBBT.Bar >= P.F.MaxBBT.Bar - 2)
            {
                return;                                      //don't start too near the end
            }
            if (/*clsPlay.PlayExists() &&*/ Forms.frmSC.MenuMonitor)
            {
                clsPlay.InitStopwatch();
            }
            Forms.frmSC.ShowfrmPCKBIn();
            if (P.frmSC.Play != null)
            {
                P.frmSC.Play.BBTSwitch = null;
                P.frmSC.Play.NewReset();
            }
            ShowGCCollectionCounts("Start Play");
            P.F.WaitPlay  = new clsWaitPlay(filestream, MidiPlay.OutMStream, mute);
            StreamStartBB = P.F.CurrentBBT.Copy();
            BeatCount     = StreamStartBB.Bar;
            try {
                //lock (TimerLock) {
                P.F.WaitPlay.Start();
                //}
            }
            catch {
                DebugPlay();
                return;
            }

            //if (P.frmStart.chkPlaySustain.Checked) clsPlay.clsSustain.PlayPedalStatic(true);
            //clsPlayKeyboard.PlayNearestChordNote = P.frmStart.chkPlayKBChord.Checked;
            P.frmStart.StreamPlayOnAll();      //enable/disable StartPlay/StopPlay etc.
            P.frmStart.FormsStreamOnOff(true); //enable/disable controls (not StartPlay/StopPlay etc.)
        }