예제 #1
0
 public NoteOff(NoteOn noteOn, SeqRef seqRef, TrkOptions trkOptions)
     : base(seqRef, new List<int>(), trkOptions)
 {
     foreach(TrkRef tr in noteOn.SeqRef.TrkRefs)
     {
         _trkOffs.Add(tr.MidiChannel);
     }
 }
예제 #2
0
        public InputNoteDef(byte notatedMidiPitch, NoteOn noteOn, NoteOff noteOff, TrkOptions trkOptions)
        {
            Debug.Assert(notatedMidiPitch >= 0 && notatedMidiPitch <= 127);
            // If trkOptions is null, the higher level trkOptions are used.

            NotatedMidiPitch = notatedMidiPitch;
            NoteOn = noteOn;
            NoteOff = noteOff;
            TrkOptions = trkOptions;
        }
예제 #3
0
        private InputVoiceDef GetBar2InputVoiceDef(Seq bar2Seq)
        {
            InputVoiceDef ivd = new InputVoiceDef(0, 0, new List<IUniqueDef>());
            ivd.MsPositionReContainer = bar2Seq.AbsMsPosition;

            foreach(Trk trk in bar2Seq.Trks)
            {
                MidiChordDef firstMidiChordDef = null;
                foreach(IUniqueDef iud in trk.UniqueDefs)
                {
                    firstMidiChordDef = iud as MidiChordDef;
                    if(firstMidiChordDef != null)
                    {
                        List<TrkRef> trkRefs = new List<TrkRef>();
                        trkRefs.Add(new TrkRef((byte)trk.MidiChannel, bar2Seq.AbsMsPosition + firstMidiChordDef.MsPositionReFirstUD, 12, null));
                        SeqRef seqRef = new SeqRef(trkRefs, null);
                        NoteOn noteOn = new NoteOn(seqRef);
                        List<InputNoteDef> inputNoteDefs = new List<InputNoteDef>();
                        inputNoteDefs.Add(new InputNoteDef((byte)65, noteOn, null));
                        InputChordDef icd = new InputChordDef(firstMidiChordDef.MsPositionReFirstUD, 1500, inputNoteDefs, M.Dynamic.none, null);
                        ivd.Add(icd);
                        break;
                    }
                }
            }

            return ivd;
        }
예제 #4
0
        private InputVoiceDef GetBar1InputVoiceDef(Seq bar1Seq)
        {
            InputVoiceDef ivd = new InputVoiceDef(0, 0, new List<IUniqueDef>());
            ivd.MsPositionReContainer = bar1Seq.AbsMsPosition;

            Trk leadTrk = null;
            foreach(Trk trk in bar1Seq.Trks)
            {
                if(trk.MidiChannel == 0)
                {
                    leadTrk = trk;
                    break;
                }

            }
            Debug.Assert(leadTrk != null);
            foreach(IUniqueDef tIud in leadTrk)
            {
                RestDef tRestDef = tIud as RestDef;
                MidiChordDef tmcd = tIud as MidiChordDef;
                if(tRestDef != null)
                {
                    RestDef iRestDef = new RestDef(tRestDef.MsPositionReFirstUD, tRestDef.MsDuration);
                    ivd.Add(iRestDef);
                }
                else if(tmcd != null)
                {
                    List<TrkRef> trkRefs = new List<TrkRef>();

                    foreach(Trk trk in bar1Seq.Trks)
                    {
                        trkRefs.Add(new TrkRef((byte)trk.MidiChannel, bar1Seq.AbsMsPosition + tmcd.MsPositionReFirstUD, 1, null));
                    }
                    SeqRef seqRef = new SeqRef(trkRefs, null);
                    NoteOn noteOn = new NoteOn(seqRef);
                    List<InputNoteDef> inputNoteDefs = new List<InputNoteDef>();
                    foreach(byte notatedMidiPitch in tmcd.NotatedMidiPitches)
                    {
                        inputNoteDefs.Add(new InputNoteDef((byte)(notatedMidiPitch + 36), noteOn, null));
                    }
                    InputChordDef icd = new InputChordDef(tIud.MsPositionReFirstUD, tIud.MsDuration, inputNoteDefs, M.Dynamic.none, null);
                    ivd.Add(icd);
                }
            }

            return ivd;
        }
예제 #5
0
 /// <summary>
 /// This constructs an InputNoteDef that, when the noteOff arrives,
 /// turns off all the trks that were turned on by the noteOn.
 /// </summary>
 public InputNoteDef(byte notatedMidiPitch, NoteOn noteOn, TrkOptions trkOptions)
     : this(notatedMidiPitch, noteOn, null, trkOptions)
 {
     //public NoteOff(NoteOn noteOn, Seq seq, TrkOptions trkOptions)
     NoteOff = new NoteOff(noteOn, null, null);
 }
예제 #6
0
 /// <summary>
 /// A NoteOff that does nothing except turn off the trks that were turned on by the noteOn argument.
 /// </summary>
 public NoteOff(NoteOn noteOn)
     : this(noteOn, null, null)
 {
 }