Esempio n. 1
0
        private bool TryToAddSingleBeatLevelElement(SingleBeat singleBeat, LevelElementType type)
        {
            LevelElementPlacement placement = LevelElementPlacement.CreateSingleSynchro(
                type, singleBeat.Time);

            return(TryToAddLevelElement(placement));
        }
Esempio n. 2
0
        private void TryToAddSingleBeat(SingleBeat singleBeat)
        {
            List <LevelElementType> types = distributionManager.GetOrderedSingleBeatLevelElementTypes();

            foreach (LevelElementType type in types)
            {
                if (TryToAddSingleBeatLevelElement(singleBeat, type))
                {
                    break;
                }
            }
        }
Esempio n. 3
0
        public void GetChildrenTest(int octave, Tone tone, byte expectedPitch)
        {
            IOrchestra o = Substitute.For <IOrchestra>();
            Instrument i = new Instrument(o, InstrumentType.AcousticBass, new Scale(), octave);

            Keystroke n = new Keystroke(tone, 22, 33);

            SingleBeat actual   = n.GetChildren(i, 0).First();
            SingleBeat expected = new SingleBeat(i.InstrumentType, expectedPitch, n.Velocity, 0, n.Duration);

            Assert.AreEqual(actual, expected);
        }
Esempio n. 4
0
 public void AddBeat(SingleBeat beat)
 {
     Beats.Add(beat);
 }
        public List <MultipleBeats> GetMultipleBeats(List <SingleBeat> singleBeats)
        {
            List <List <SingleBeat> > chains = new List <List <SingleBeat> >();

            SingleBeat        lastBeat     = null;
            List <SingleBeat> tempBeatList = new List <SingleBeat>();

            foreach (SingleBeat beat in singleBeats)
            {
                if (lastBeat == null)
                {
                    lastBeat = beat;
                    tempBeatList.Add(beat);
                    continue;
                }

                float timeDelta = beat.Time - lastBeat.Time;

                if (timeDelta <= LevelGenerationValues.MaximumMultipleBeatsTimeDelta)
                {
                    tempBeatList.Add(beat);
                }
                else
                {
                    if (tempBeatList.Count > LevelGenerationValues.MininumBeatsForMultipleBeats)
                    {
                        chains.Add(new List <SingleBeat>(tempBeatList));
                    }

                    tempBeatList.Clear();
                }

                lastBeat = beat;
            }

            List <MultipleBeats> multipleBeats = new List <MultipleBeats>();

            foreach (List <SingleBeat> chain in chains)
            {
                for (int i = 0; i < chain.Count; i++)
                {
                    if (i + LevelGenerationValues.MininumBeatsForMultipleBeats > chain.Count)
                    {
                        continue;
                    }

                    MultipleBeats beatChain = new MultipleBeats();

                    SingleBeat firstBeat = chain[i];

                    beatChain.AddBeat(firstBeat);

                    for (int j = i + 1; j < chain.Count; j++)
                    {
                        SingleBeat nextBeat = chain[j];

                        if (nextBeat.Time - firstBeat.Time >
                            LevelGenerationValues.MaximumMultipleBeatsTotalTimeMargin)
                        {
                            break;
                        }

                        beatChain.AddBeat(nextBeat);
                    }

                    beatChain.CalculateApplicability();

                    multipleBeats.Add(beatChain);
                }
            }

            return(multipleBeats);
        }
Esempio n. 6
0
 public void AddParallelBeat(SingleBeat singleBeat)
 {
     ParallelBeats.Add(singleBeat);
 }