Пример #1
0
 public IGang GetHatSequence(int bars)
 {
     IGang[] result = new IGang[bars * timeSig.BeatsPerBar * 4];
     for (int i = 0; i < result.Length; i++)
     {
         result [i] = GetHat(i);
     }
     return(new ChainGang(result));
 }
Пример #2
0
 public IGang GetBassSequence(int bars)
 {
     IGang[] result = new IGang[bars * timeSig.BeatsPerBar + 1];
     result [0] = new InstrumentChange(Instrument.ElectricBassFinger);
     for (int i = 1; i < result.Length; i++)
     {
         result [i] = new Note(p [rand.Next(3)], .25, 100);
     }
     return(new ChainGang(result));
 }
Пример #3
0
        void doit()
        {
            TimeSignature timeSig = new TimeSignature(4, 4, 120);
            TockTicker    t       = new TockTicker(timeSig);

            KickSequencer ks = new KickSequencer(timeSig);

            BassSequencer bs = new BassSequencer(timeSig);

            Scuttler b = new Scuttler(timeSig.GetNoteForBars(8),
                                      Enumerable.Range(0, 4).Select(_ => new League(
                                                                        ks.GetKickSequence(1),
                                                                        ks.GetSnareSequence(1),
                                                                        ks.GetHatSequence(1),
                                                                        bs.GetBassSequence(1)
                                                                        )).ToArray());

            Scuttler c = new Scuttler(timeSig.GetNoteForBars(4),
                                      Enumerable.Range(0, 2).Select(_ => new League(
                                                                        ks.GetKickSequence(1),
                                                                        ks.GetSnareSequence(1),
                                                                        ks.GetHatSequence(1),
                                                                        bs.GetBassSequence(1)
                                                                        )).ToArray());


            ChainGang cg5 = new ChainGang(b, c, b, c);


            IGang             playThis      = cg5;
            MidiMinionGrinder minionGrinder = new MidiMinionGrinder();

            t.Start();
            while (!playThis.FizzledOut)
            {
                t.SleepUntil(playThis.TimeToKill);
                do
                {
                    IMinion m = playThis.GetSacrificialMinion();
                    if (!(m is NoOp))
                    {
                        minionGrinder.Grind(m);
                    }
                } while (!playThis.FizzledOut && playThis.TimeToKill == 0);
                byte[] juices = minionGrinder.ExtractJuices();
                output.SendAsync(juices, 0, juices.Length, 0);
            }

            //Console.ReadLine ();
        }
Пример #4
0
        private IGang GetSoonestMinion()
        {
            IGang soonest     = null;
            long  soonestTime = long.MaxValue;

            foreach (IGang minion in this.minionsEtc)
            {
                if (!minion.FizzledOut && minion.TimeToKill < soonestTime)
                {
                    soonest     = minion;
                    soonestTime = minion.TimeToKill;
                }
            }
            return(soonest);
            //return this.minionsEtc.Aggregate ((curMin, minion) => !minion.FizzledOut && (curMin == null || (minion.TimeToKill < curMin.TimeToKill)) ? minion : curMin);
        }