private bool TryToAddSingleBeatLevelElement(SingleBeat singleBeat, LevelElementType type) { LevelElementPlacement placement = LevelElementPlacement.CreateSingleSynchro( type, singleBeat.Time); return(TryToAddLevelElement(placement)); }
private void TryToAddSingleBeat(SingleBeat singleBeat) { List <LevelElementType> types = distributionManager.GetOrderedSingleBeatLevelElementTypes(); foreach (LevelElementType type in types) { if (TryToAddSingleBeatLevelElement(singleBeat, type)) { break; } } }
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); }
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); }
public void AddParallelBeat(SingleBeat singleBeat) { ParallelBeats.Add(singleBeat); }