예제 #1
0
 public void Play(MyMMLClip Clip)
 {
     if (sequencer == null)
     {
         return;
     }
     sequencer.Stop(playOutTime);
     clip  = Clip;
     state = PlayState.Prepareing;
 }
예제 #2
0
 private void OnDisable()
 {
     if (sequencer != null)
     {
         sequencer.Stop(0.0f);
         syntheStation.RemoveSequencer(sequencer);
         sequencer = null;
     }
     syntheStation = null;
 }
예제 #3
0
        public MyMMLClip Play(int port, int channel, float tempoScale, float volume, params string[] mml)
        {
            if (sequencer == null)
            {
                return(null);
            }
            sequencer.Stop(playOutTime);
            if ((port < 0) || (port >= MyMMLSequence.MaxNumPorts))
            {
                return(null);
            }
            if ((channel < 0) || (channel >= MySynthesizer.NumChannels))
            {
                return(null);
            }
            if ((mml.Length == 0) || (mml.Length >= MyMMLSequence.MaxNumTracks))
            {
                return(null);
            }
            clip            = new MyMMLClip();
            clip.Name       = "Impromptu";
            clip.TempoScale = tempoScale;
            clip.Volume     = volume;
            var sb = MyFountain <System.Text.StringBuilder> .Get(() => new System.Text.StringBuilder());

            sb.Length = 0;
            for (int i = 0; i < mml.Length; i++)
            {
                if (mml[i] == null)
                {
                    continue;
                }
                sb.Append("$t" + i.ToString("d2") + "=" + port.ToString() + ":" + channel.ToString() + "\n");
            }
            for (int i = 0; i < mml.Length; i++)
            {
                if (mml[i] == null)
                {
                    continue;
                }
                sb.Append("t" + i.ToString("d2") + "=" + mml[i] + "\n");
            }
            clip.TextB = sb.ToString();
            sb.Length  = 0;
            MyFountain <System.Text.StringBuilder> .Put(sb);

            state = PlayState.Prepareing;
            return(clip);
        }
 public void Stop(float fadeOutTime)
 {
     if (Sequencer != null)
     {
         Sequencer.Stop(fadeOutTime);
     }
 }