public override PatternActionResult Invoke(long time, PatternContext context)
        {
            if (State != PatternActionState.Enabled)
            {
                return(PatternActionResult.DoNothing);
            }

            context.SaveTime(time);
            return(new PatternActionResult(time + LengthConverter.ConvertFrom(Step, time, context.TempoMap)));
        }
Esempio n. 2
0
        public override PatternActionResult Invoke(long time, PatternContext context)
        {
            var tempoMap = context.TempoMap;

            context.SaveTime(time);

            var convertedTime = TimeConverter.ConvertFrom(((MidiTimeSpan)time).Subtract(Step, TimeSpanMode.TimeLength), tempoMap);

            return(new PatternActionResult(Math.Max(convertedTime, 0)));
        }
Esempio n. 3
0
        public PatternActionResult Invoke(long time, PatternContext context)
        {
            if (Time != null)
            {
                context.SaveTime(time);
            }

            return(new PatternActionResult(Time != null
                ? TimeConverter.ConvertFrom(Time, context.TempoMap)
                : context.RestoreTime()));
        }
Esempio n. 4
0
        public PatternActionResult Invoke(long time, PatternContext context)
        {
            context.SaveTime(time);

            var chordLength = LengthConverter.ConvertFrom(ChordDescriptor.Length, time, context.TempoMap);

            return(new PatternActionResult(time + chordLength,
                                           ChordDescriptor.Notes.Select(d => new Note(d.NoteNumber, chordLength, time)
            {
                Channel = context.Channel,
                Velocity = ChordDescriptor.Velocity
            })));
        }
Esempio n. 5
0
        public PatternActionResult Invoke(long time, PatternContext context)
        {
            context.SaveTime(time);

            var noteLength = LengthConverter.ConvertFrom(NoteDescriptor.Length, time, context.TempoMap);

            var note = new Note(NoteDescriptor.Note.NoteNumber, noteLength, time)
            {
                Channel  = context.Channel,
                Velocity = NoteDescriptor.Velocity
            };

            return(new PatternActionResult(time + noteLength, new[] { note }));
        }
        public override PatternActionResult Invoke(long time, PatternContext context)
        {
            if (State != PatternActionState.Enabled)
            {
                return(PatternActionResult.DoNothing);
            }

            if (Time != null)
            {
                context.SaveTime(time);
            }

            return(new PatternActionResult(Time != null
                ? TimeConverter.ConvertFrom(Time, context.TempoMap)
                : context.RestoreTime()));
        }
Esempio n. 7
0
        public override PatternActionResult Invoke(long time, PatternContext context)
        {
            if (State == PatternActionState.Excluded)
            {
                return(PatternActionResult.DoNothing);
            }

            context.SaveTime(time);

            var chordLength = LengthConverter.ConvertFrom(ChordDescriptor.Length, time, context.TempoMap);

            if (State == PatternActionState.Disabled)
            {
                return(new PatternActionResult(time + chordLength));
            }

            return(new PatternActionResult(time + chordLength,
                                           ChordDescriptor.Notes.Select(d => new Note(d.NoteNumber, chordLength, time)
            {
                Channel = context.Channel,
                Velocity = ChordDescriptor.Velocity
            })));
        }
Esempio n. 8
0
        public override PatternActionResult Invoke(long time, PatternContext context)
        {
            if (State == PatternActionState.Excluded)
            {
                return(PatternActionResult.DoNothing);
            }

            context.SaveTime(time);

            var noteLength = LengthConverter.ConvertFrom(NoteDescriptor.Length, time, context.TempoMap);

            if (State == PatternActionState.Disabled)
            {
                return(new PatternActionResult(time + noteLength));
            }

            var note = new Note(NoteDescriptor.Note.NoteNumber, noteLength, time)
            {
                Channel  = context.Channel,
                Velocity = NoteDescriptor.Velocity
            };

            return(new PatternActionResult(time + noteLength, new[] { note }));
        }
Esempio n. 9
0
 public override PatternActionResult Invoke(long time, PatternContext context)
 {
     context.SaveTime(time);
     return(new PatternActionResult(time + LengthConverter.ConvertFrom(Step, time, context.TempoMap)));
 }