Ejemplo n.º 1
0
 /// <param name="trkDef">The target trk</param>
 /// <param name="inputControls">If non-null, this inputControls overrrides the InputControls in the InputNote or InputChord</param>
 public TrkOn(TrkDef trkDef, InputControls inputControls)
 {
     _trkMidiChannel    = trkDef.MidiChannel;
     _trkMsPosition     = trkDef.StartMsPosition;
     _trkNumMidiObjects = trkDef.DurationsCount;             // includes MidiChordDef, RestDef
     _inputControls     = inputControls;
 }
Ejemplo n.º 2
0
 /// <param name="trkDef">The target trk's midi channel</param>
 /// <param name="trkStartPosition">The target trk's startMsPosition</param>
 /// <param name="trkNumMidiObjects">The number of MidiChordDefs and RestDefs in the target trk.</param>
 /// <param name="inputControls">If non-null, this inputControls overrrides the InputControls in the InputNote or InputChord</param>
 public TrkOn(byte trkMidiChannel, int trkStartPosition, int trkNumMidiObjects, InputControls inputControls)
 {
     _trkMidiChannel    = trkMidiChannel;
     _trkMsPosition     = trkStartPosition;
     _trkNumMidiObjects = trkNumMidiObjects;
     _inputControls     = inputControls;
 }
Ejemplo n.º 3
0
        internal void WriteSvg(SvgWriter w)
        {
            w.WriteStartElement("inputNote");
            w.WriteAttributeString("notatedKey", _notatedMidiPitch.ToString());

            if (InputControls != null)
            {
                InputControls.WriteSvg(w);
            }

            if (NoteOnTrkOns != null || NoteOnTrkOffs != null)
            {
                w.WriteStartElement("noteOn");
                WriteNoteOnOff(w, NoteOnTrkOns, NoteOnTrkOffs);
                w.WriteEndElement();                 // noteOn
            }

            if (NotePressures != null)
            {
                NotePressures.WriteSvg(w);
            }

            if (NoteOffTrkOns != null || NoteOffTrkOffs != null)
            {
                w.WriteStartElement("noteOff");
                WriteNoteOnOff(w, NoteOffTrkOns, NoteOffTrkOffs);
                w.WriteEndElement();                 // noteOff
            }

            w.WriteEndElement();             // score:inputNote N.B. This element can be empty!
        }
Ejemplo n.º 4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="notatedMidiPitch">In range 0..127</param>
        /// <param name="noteOnTrkOns">Can be null or empty</param>
        /// <param name="noteOnTrkOffs">Can be null or empty</param>
        /// <param name="pressures">Can be null or empty</param>
        /// <param name="noteOffTrkOns">Can be null or empty</param>
        /// <param name="noteOffTrkOffs">Can be null or empty</param>
        /// <param name="inputControls">Can be null</param>
        public InputNoteDef(byte notatedMidiPitch,
                            TrkOns noteOnTrkOns, TrkOffs noteOnTrkOffs,
                            Pressures pressures,
                            TrkOns noteOffTrkOns, TrkOffs noteOffTrkOffs,
                            InputControls inputControls)
        {
            Debug.Assert(notatedMidiPitch >= 0 && notatedMidiPitch <= 127);
            // If inputControls is null, the higher level inputControls are used.

            NotatedMidiPitch = notatedMidiPitch;
            NoteOnTrkOns     = noteOnTrkOns;
            NoteOnTrkOffs    = noteOnTrkOffs;
            NotePressures    = pressures;
            NoteOffTrkOns    = noteOffTrkOns;
            NoteOffTrkOffs   = noteOffTrkOffs;
            InputControls    = inputControls;
        }
Ejemplo n.º 5
0
 /// <param name="trkOffs"></param>
 /// <param name="inputControls">Can be null</param>
 public TrkOffs(List <TrkOff> trkOffs, InputControls inputControls)
 {
     Debug.Assert(trkOffs != null && trkOffs.Count > 0);
     _inputControls = inputControls;
     _trkOffs       = trkOffs;
 }
Ejemplo n.º 6
0
 /// <param name="midiChannel">The midi channel of the Track to be sent a pressure message</param>
 /// <param name="inputControls">Can be null</param>
 public Pressure(byte midiChannel, InputControls inputControls)
 {
     _midiChannel   = midiChannel;
     _inputControls = inputControls;
 }
Ejemplo n.º 7
0
 /// <param name="pressures"></param>
 /// <param name="inputControls">Can be null</param>
 public Pressures(List <Pressure> pressures, InputControls inputControls)
 {
     Debug.Assert(pressures != null && pressures.Count > 0);
     _inputControls = inputControls;
     _pressures     = pressures;
 }
Ejemplo n.º 8
0
 /// <param name="trkOns"></param>
 /// <param name="inputControls">Can be null</param>
 public TrkOns(List <TrkOn> trkOns, InputControls inputControls)
 {
     Debug.Assert(trkOns != null && trkOns.Count > 0);
     _inputControls = inputControls;
     _trkOns        = trkOns;
 }
Ejemplo n.º 9
0
        /// <summary>
        /// This constructs an InputNoteDef that, when the noteOff arrives, turns off all the trks it has turned on.
        /// </summary>
        /// <param name="notatedMidiPitch">In range 0..127</param>
        /// <param name="noteOnSeqDefs">Must contain at least one SeqDef</param>
        /// <param name="pressures">Can be null or empty</param>
        /// <param name="inputControls">Can be null</param>
        public InputNoteDef(byte notatedMidiPitch, TrkOns noteOnSeqDef, Pressures pressures, InputControls inputControls)
            : this(notatedMidiPitch, noteOnSeqDef, null, pressures, null, null, inputControls)
        {
            Debug.Assert(noteOnSeqDef != null);
            List <TrkOff> trkOffs = new List <TrkOff>();

            foreach (TrkOn trkOn in NoteOnTrkOns)
            {
                TrkOff trkOff = new TrkOff(trkOn.TrkMidiChannel, trkOn.TrkMsPosition, inputControls);
                trkOffs.Add(trkOff);
            }
            NoteOffTrkOffs = new TrkOffs(trkOffs, null);
        }
Ejemplo n.º 10
0
 /// <param name="trkMidiChannel">The midi channel of the Trk to be sent a trkOff message</param>
 /// <param name="trkMsPosition">The msPosition (in the score) of the Trk to be sent a trkOff message</param>
 /// <param name="inputControls">Can be null</param>
 public TrkOff(byte trkMidiChannel, int trkMsPosition, InputControls inputControls)
 {
     _midiChannel   = trkMidiChannel;
     _trkMsPosition = trkMsPosition;
     _inputControls = inputControls;
 }