public void Unload() { if (_MIDISequence != null) { _MIDISequence.Clear(); } if (_MIDIOutDevice != null) { _MIDIOutDevice.Close(); } }
/* * public int Position * { * get{return FPosition;} * set{FPosition = value;} * } * * public int MaxWindowNotes * { * get{return FWindowMaxNotes;} * set{FWindowMaxNotes = value;} * } * * public float MUpT * { * get{return FMUpT;} * set{FMUpT = value;} * } * * public int ExternalBar * { * set * { * if (value == 0) * { * FRhythmChangedAtBar = 0; * FRhythmChangedOffset = 0; * FRhythmChangedOffsetInPixel = 0; * } * if (value < FExternalBar) * { * FExternalBar = value; * * int min = FRhythmChangedOffset + FBarLength * (FExternalBar-1-FRhythmChangedAtBar); * MidiNote m = FMidiNotes.Find(delegate (MidiNote mn) {return mn.Start >= (min);}); * * FWindowFromNote = FMidiNotes.IndexOf(m); * FWindowToNote = FWindowFromNote + FWindowMaxNotes; * } * else * { * FExternalBar = value; * * //first note of this bar * int min = FRhythmChangedOffset + FBarLength * (FExternalBar-1-FRhythmChangedAtBar); * MidiNote m = FMidiNotes.Find(delegate (MidiNote mn) {return mn.Start >= (min);}); * * //open the window 4 notes to the left (in case the bar was fwdd a bit too early) * FWindowFromNote = Math.Max(FWindowFromNote, FMidiNotes.IndexOf(m) - 4); * * //open the window to the right * FWindowToNote = Math.Min(FWindowToNote, FWindowFromNote + FWindowMaxNotes); * * //make sure the window is at least open 5 notes into the new bar * FWindowToNote = Math.Max(FWindowFromNote + 4 + 5, FWindowToNote); * * //clamp at max index * FWindowToNote = Math.Min(FWindowToNote, FMidiNotes.Count); * } * * //System.Diagnostics.Debug.WriteLine("external bar: from: " + FWindowFromNote.ToString() + " to: " + FWindowToNote.ToString()); * } * } * * public int BarFrom * { * get{return FBarFrom;} * set * { * FBarFrom = value; * * UpdateNotesOfBar(); * } * } * * public int BarTo * { * get{return FBarTo;} * set * { * FBarTo = value; * * UpdateNotesOfBar(); * } * } * * public void SaveLastWindowStart() * { * FWindowFromNoteOld = FWindowFromNote; * } * * private void UpdateNotesOfBar() * { * FNotesOfBar.Clear(); * if ((FBarFrom == 0) && (FBarTo == 0)) * FNotesOfBar = new List<TMidiNote>(FMidiNotes.ToArray()); * else * { * int min = (FBarFrom-1) * FBarLength; * int max = (FBarTo) * FBarLength; * foreach (TMidiNote mn in FMidiNotes) * { * if ((mn.Start >= min) && (mn.Start < max)) * FNotesOfBar.Add(mn); * } * } * }*/ public void Clear() { FSequence.Clear(); }