Example #1
0
        internal void Pause()
        {
            //if (!PlayCmdOn) DebugPlay();
            //PlayCmdOn = false;
            PlayableForms.CmdState_Stopped();
            //foreach (IPlayable pf in PlayableForms.Active) {
            //  pf.StreamPlayOff();  //enable general controls
            //}

            indPause = true;
            //if (P.F.PFPlay != null && P.F.PFPlay.XPlay != null) {
            if (P.F.WaitPlay != null)
            {
                //ScheduleStopTimeOut();
                //lock (TimerLock) {
                P.F.WaitPlay.Stop();
                P.F.WaitPlay = null;
                //}
            }
            else if (P.F.AudioSync != null)
            {
                P.F.AudioSync.Pause();
                P.frmStart.StreamPlayOffAll();
            }

            if (P.frmSC != null)
            {
                P.frmSC.nudStartBar.Value =
                    Math.Max(0, Math.Min(P.frmSC.nudStartBar.Maximum - 1, P.F.CurrentBBT.Bar + 1));
            }

            P.frmPCKBIn?.Invoke(new delegClosefrmPCKBIn(P.frmPCKBIn.Close));
            ShowGCCollectionCounts("Stop Play");
            //CheckMarkAndSave();
        }
Example #2
0
        internal void Stop()
        {
            //if (!PlayCmdOn) DebugPlay();
            //PlayCmdOn = false;
            PlayableForms.CmdState_Stopped();
            //foreach (IPlayable pf in PlayableForms.Active) {
            //  pf.StreamPlayOff();  //enable general controls
            //}

            indPause = false;
            //if (P.F.PFPlay != null && P.F.PFPlay.XPlay != null) {
            if (P.F.WaitPlay != null)
            {
                //lock (TimerLock) {
                P.F.WaitPlay.Stop();
                P.F.WaitPlay = null;
                //}
            }

            if (P.F.AudioSync != null)
            {
                P.F.AudioSync.Stop();
                //P.frmStart.StreamPlayOffAll();
            }

            //P.frmPCKBIn?.Invoke(new delegClosefrmPCKBIn(P.frmPCKBIn.Close));
            ShowGCCollectionCounts("Stop Play");
        }
Example #3
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.)
        }