예제 #1
0
        // Meant to be called after a tote is assigned of course
        public void SetStartTimerForNote(SMNote note)
        { // These will have to be the same note and everything...which is handled by being the same tote
            // This will basically never have anything in it except in very rare cases
            var     availableTimers = startTimers.Where(t => t.Totehead.InternalId == note.totehead.InternalId && t.DurationTicks + t.DurationSeconds * 40 == note.startTicks && t.AttachedNotes.All(an => an.durationTicks == note.durationTicks));
            SMTimer timer;

            if (availableTimers.Count() == 0)
            {
                timer = new SMTimer()
                {
                    DurationTicks = note.startTicks, Totehead = note.totehead, InternalId = startTimers.Count
                };
                startTimers.Add(timer);
            }
            else
            {
                timer = availableTimers.First();
            }
            note.startTimer = timer;
            timer.AttachedNotes.Add(note);
            SetExtensionTimers(timer);
        }
예제 #2
0
        public void SetToteHeadForNote(SMNote note)
        {
            var availableTotes = toteHeads.Where(t => t.Instrument == note.instrument && t.Note == note.noteNum && t.Flavor == note.flavor && (t.PlayingNotes.Count == 0 || t.PlayingNotes.All(pn => pn.startTicks + pn.durationTicks < note.startTicks - 1 || note.startTicks + note.durationTicks < pn.startTicks - 1)));
            //var availableTotes = new List<ToteHead>();
            ToteHead tote;

            if (availableTotes.Count() == 0)
            {
                // Make a new Tote and return it
                tote = new ToteHead()
                {
                    Flavor = note.flavor, Instrument = note.instrument, Note = note.noteNum, Id = -1, InternalId = toteHeads.Count
                };                                                                                                                                        // We mark ID as unset yet
                toteHeads.Add(tote);
            }
            else
            {
                tote = availableTotes.First();
            }
            tote.PlayingNotes.Add(note);
            note.totehead = tote;
        }
예제 #3
0
        // Meant to be called after a tote is assigned of course
        public void SetDurationTimerForNote(SMNote note)
        {
            //var availableTimers = durationTimers.Where(t => t.Totehead.InternalId == note.totehead.InternalId && t.DurationTicks + t.DurationSeconds*40 == note.durationTicks && t.AttachedNotes.All(an => an.startTicks + an.durationTicks < note.startTicks - 3 || note.startTicks + note.durationTicks < an.startTicks - 3));
            var     availableTimers = new List <SMTimer>(); // Always make a new timer, we can't re-use circuits
            SMTimer timer;

            if (availableTimers.Count() == 0)
            {
                timer = new SMTimer()
                {
                    DurationTicks = note.durationTicks, Totehead = note.totehead, InternalId = durationTimers.Count
                };
                durationTimers.Add(timer);
            }
            else
            {
                timer = availableTimers.First();
            }

            note.durationTimer = timer;
            timer.AttachedNotes.Add(note);
            SetExtensionTimers(timer);
        }