public void Play(MyMMLClip Clip) { if (sequencer == null) { return; } sequencer.Stop(playOutTime); clip = Clip; state = PlayState.Prepareing; }
private void OnDisable() { if (sequencer != null) { sequencer.Stop(0.0f); syntheStation.RemoveSequencer(sequencer); sequencer = null; } syntheStation = null; }
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); } }