示例#1
0
        private IEnumerable <ShowLight> GenerateFogNotes(ArrangementData arrangement)
        {
            var fogFunctions = new FogGenerationFunctions(arrangement.MidiNotes, fogOptions.RandomizeColors);

            switch (fogOptions.GenerationMethod)
            {
            case SingleColor:
                return(Enumerable.Repeat(new ShowLight(arrangement.FirstBeatTime, fogOptions.SelectedSingleFogColor), 1));

            case ChangeEveryNthBar:
                return(fogFunctions.FromBarNumbers(arrangement.Ebeats, fogOptions.ChangeFogColorEveryNthBar));

            case MinTimeBetweenChanges:
                return(fogFunctions.FromMinTime(fogOptions.MinTimeBetweenNotes));

            case FromSectionNames:
                return(fogFunctions.FromSections(arrangement.Sections));

            case FromLowestOctaveNotes:
                int min = arrangement.LowOctaveMinMidiNote;
                int max = arrangement.LowOctaveMaxMidiNote;

                return(fogFunctions.ConditionalGenerate(mn => mn.Note >= min && mn.Note <= max));

            case FromChords:
                return(fogFunctions.ConditionalGenerate(mn => mn.WasChord));

            default:
                Debug.Print("ERROR: Unknown fog generation method.");
                return(Enumerable.Empty <ShowLight>());
            }
        }
        internal static bool TryGetArrangementData(string filename, out ArrangementData arrData, DateTime timeModified)
        {
            if (cache.ContainsKey(filename))
            {
                var data = cache[filename];
                if (data.TimeModified == timeModified)
                {
                    arrData = data;
                    return(true);
                }
            }

            arrData = null;
            return(false);
        }
示例#3
0
        private ArrangementData GetArrangementData(string filename)
        {
            var fileInfo     = new FileInfo(filename);
            var timeModified = fileInfo.LastWriteTime;

            if (!ArrangementCache.TryGetArrangementData(filename, out ArrangementData arrData, timeModified))
            {
                var Song = InstrumentalArrangement.Load(filename);

                arrData = new ArrangementData
                {
                    Sections      = Song.Sections,
                    Ebeats        = Song.Ebeats,
                    FirstBeatTime = Song.StartBeat,
                    SongLength    = Song.MetaData.SongLength,
                    TimeModified  = timeModified
                };

                // Try to find a solo section in the latter half of the song. If not found, use the first one
                var soloSections = Song.Sections.Where(s => s.Name == "solo");
                var soloSection  = soloSections.FirstOrDefault(s => s.Time >= arrData.SongLength / 2) ?? soloSections.FirstOrDefault();
                arrData.SoloSectionTime = soloSection?.Time;

                // Get notes and chords
                var(notes, chords) = GetNotesAndChordsFromSong(Song);

                // Get MIDI notes
                arrData.MidiNotes            = GetMidiNotes(Song, notes, chords, out int minMidiNote);
                arrData.LowOctaveMinMidiNote = minMidiNote;

                ArrangementCache.AddArrangementData(filename, arrData);
            }

            FirstBeatTime = arrData.FirstBeatTime;
            SongLength    = arrData.SongLength;
            if (arrData.SoloSectionTime.HasValue)
            {
                SoloSectionTime = arrData.SoloSectionTime.Value;
            }

            return(arrData);
        }
示例#4
0
        private IEnumerable <ShowLight> GenerateBeamNotes(ArrangementData arrangement, List <ShowLight> currentShowlights)
        {
            var beamFunctions = new BeamGenerationFunctions(arrangement.MidiNotes, beamOptions.RandomizeColors);

            switch (beamOptions.GenerationMethod)
            {
            case BeamGenerationMethod.MinTimeBetweenChanges:
                return(beamFunctions.FromMinTime(
                           currentShowlights,
                           arrangement.Sections,
                           beamOptions.MinTimeBetweenNotes,
                           beamOptions.UseCompatibleColors));

            case BeamGenerationMethod.FollowFogNotes:
                return(BeamGenerationFunctions.FromFogNotes(currentShowlights));

            default:
                Debug.Print("ERROR: Unknown beam generation method.");
                return(Enumerable.Empty <ShowLight>());
            }
        }
 internal static void AddArrangementData(string filename, ArrangementData arrData)
 => cache[filename] = arrData;