当前位置: 首页>>代码示例>>C#>>正文


C# Sng2014HSL.Sng2014File类代码示例

本文整理汇总了C#中RocksmithToolkitLib.Sng2014HSL.Sng2014File的典型用法代码示例。如果您正苦于以下问题:C# Sng2014File类的具体用法?C# Sng2014File怎么用?C# Sng2014File使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Sng2014File类属于RocksmithToolkitLib.Sng2014HSL命名空间,在下文中一共展示了Sng2014File类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateNddArrangement

        private static void CreateNddArrangement(Sng2014File inp, int threshold)
        {
            var inputArrangements = inp.Arrangements.Arrangements;
            var maxDifficulty = inp.Arrangements.Arrangements.Max(a => a.Difficulty);
            inp.Arrangements.Arrangements = inp.Arrangements.Arrangements.Where(a => a.Difficulty == maxDifficulty).ToArray();
            var outputArrangement = inp.Arrangements.Arrangements[0];
            inp.Arrangements.Count = 1;
            foreach (var phrase in inp.Phrases.Phrases)
            {
                phrase.MaxDifficulty = 0;
            }

            outputArrangement.Notes.Notes =
                (from ia in inputArrangements
                from notes in ia.Notes.Notes
                select new {ia.Difficulty, notes} into dn
                group dn by dn.notes.Time into duplicateNotes

                let hardest = duplicateNotes.Max(x => x.Difficulty)
                select duplicateNotes.First(x => x.Difficulty == hardest) into hardestNotes
                orderby hardestNotes.notes.Time
                select hardestNotes.notes
                ).ToArray();

                //inputArrangements.SelectMany(ia => ia.Notes.Notes.Select(notes => new {ia.Difficulty, notes}).GroupBy(ian => ian.notes.Time).Select(nn => nn.Max(n => n.Difficulty)).OrderBy(x => x.Time).ToArray();
            outputArrangement.Notes.Count = outputArrangement.Notes.Notes.Length;
            outputArrangement.Anchors.Anchors = inputArrangements.SelectMany(ia => ia.Anchors.Anchors).Distinct(ANCHOR_COMPARER).OrderBy(x => x.StartBeatTime).ToArray();
            outputArrangement.Anchors.Count = outputArrangement.Anchors.Anchors.Length;
            outputArrangement.AnchorExtensions.AnchorExtensions = inputArrangements.SelectMany(ia => ia.AnchorExtensions.AnchorExtensions).Distinct(ANCHOR_EXTENSION_COMPARER).ToArray();
            outputArrangement.AnchorExtensions.Count = outputArrangement.AnchorExtensions.AnchorExtensions.Length;
            outputArrangement.Fingerprints1.Fingerprints = inputArrangements.SelectMany(ia => ia.Fingerprints1.Fingerprints).Distinct(FINGERPRINT_COMPARER).OrderBy(x => x.StartTime).ToArray();
            outputArrangement.Fingerprints1.Count = outputArrangement.Fingerprints1.Fingerprints.Length;
            outputArrangement.Fingerprints2.Fingerprints = inputArrangements.SelectMany(ia => ia.Fingerprints2.Fingerprints).Distinct(FINGERPRINT_COMPARER).OrderBy(x => x.StartTime).ToArray();
            outputArrangement.Fingerprints2.Count = outputArrangement.Fingerprints2.Fingerprints.Length;
        }
开发者ID:jokester01au,项目名称:rocksmith-custom-song-toolkit,代码行数:35,代码来源:DifficultyRemover.cs

示例2: ReadSong

        public void ReadSong(Song2014 songXml, Sng2014File sngFile)
        {
            Int16[] tuning = {
                songXml.Tuning.String0,
                songXml.Tuning.String1,
                songXml.Tuning.String2,
                songXml.Tuning.String3,
                songXml.Tuning.String4,
                songXml.Tuning.String5,
            };
            parseEbeats(songXml, sngFile);
            parsePhrases(songXml, sngFile);
            parseChords(songXml, sngFile, tuning, songXml.Arrangement == "Bass");
            // vocals use different parse function
            sngFile.Vocals = new VocalSection { Vocals = new Vocal[0] };
            parsePhraseIterations(songXml, sngFile);
            parsePhraseExtraInfo(songXml, sngFile);
            parseNLD(songXml, sngFile);
            parseActions(songXml, sngFile);
            parseEvents(songXml, sngFile);
            parseTones(songXml, sngFile);
            parseDNAs(songXml, sngFile);
            parseSections(songXml, sngFile);
            parseArrangements(songXml, sngFile);
            parseMetadata(songXml, sngFile, tuning);

            // this needs to be initialized after arrangements
            parseChordNotes(songXml, sngFile);
        }
开发者ID:aequitas,项目名称:rocksmith-custom-song-toolkit,代码行数:29,代码来源:Sng2014FileWriter.cs

示例3: ConvertSong

 // this is platform independent SNG object
 public static Sng2014File ConvertSong(string xmlFile) {
     var song = Song2014.LoadFromFile(xmlFile);
     var parser = new Sng2014FileWriter();
     var sng = new Sng2014File();
     parser.ReadSong(song, sng);
     sng.NoteCount = parser.NoteCount;
     sng.DNACount = parser.DNACount;
     return sng;
 }
开发者ID:aequitas,项目名称:rocksmith-custom-song-toolkit,代码行数:10,代码来源:Sng2014File.cs

示例4: RemoveDifficulty

 public static void RemoveDifficulty(Sng2014File sng, int overlap = -1)
 {
     if (sng.Vocals.Count <= 0)
     {
         //if (overlap < 0)
         //     DifficultyRemover.CreateNddArrangement(sng);
         //else
          DifficultyRemover.CreateNddArrangement(sng, overlap);
     }
 }
开发者ID:jokester01au,项目名称:rocksmith-custom-song-toolkit,代码行数:10,代码来源:DifficultyRemover.cs

示例5: Vocals

 public Vocals(Sng2014File sngData) {
     Vocal = new Vocal[sngData.Vocals.Count];
     for (var i = 0; i < sngData.Vocals.Count; i++) {
         var v = new Vocal();
         v.Time = sngData.Vocals.Vocals[i].Time;
         v.Note = sngData.Vocals.Vocals[i].Note;
         v.Length = sngData.Vocals.Vocals[i].Length;
         v.Lyric = sngData.Vocals.Vocals[i].Lyric.ToNullTerminatedUTF8();
         Vocal[i] = v;
     }
     Count = Vocal.Length;
 }
开发者ID:aequitas,项目名称:rocksmith-custom-song-toolkit,代码行数:12,代码来源:Vocals.cs

示例6: ReadVocals

        public static Sng2014File ReadVocals(string xmlFile, string cdata = null)
        {
            Sng2014File sng;
            if (!String.IsNullOrEmpty(cdata))
                sng = new Sng2014File(new FileStream(cdata, FileMode.Open));
            else sng = new Sng2014File(new MemoryStream(Resources.VOCALS_RS2));

            var xml = Vocals.LoadFromFile(xmlFile);
            parseVocals(xml, sng);

            return sng;
        }
开发者ID:aequitas,项目名称:rocksmith-custom-song-toolkit,代码行数:12,代码来源:Sng2014FileWriter.cs

示例7: ReadSng

        public static Sng2014File ReadSng(Stream input, Platform platform) 
        {
            var sng = new Sng2014File();

            using (var ms = new MemoryStream())
            using (var r = new EndianBinaryReader(platform.GetBitConverter, ms))
            {
                UnpackSng(input, ms, platform);
                ms.Flush();
                ms.Seek(0, SeekOrigin.Begin);
                sng.Read(r);
            }

            return sng;
        }
开发者ID:aequitas,项目名称:rocksmith-custom-song-toolkit,代码行数:15,代码来源:Sng2014File.cs

示例8: Arrangement

        private Arrangement(Attributes2014 attr, Sng2014File song, Guid id)
        {
            this.ArrangementSort = attr.ArrangementSort;
            this.Sng2014 = song;
            this.Name = (ArrangementName)Enum.Parse(typeof(ArrangementName), attr.ArrangementName);
            this.ScrollSpeed = 20;
            this.Id = id;
            this.MasterId = ArrangementType == Sng.ArrangementType.Vocal ? 1 : RandomGenerator.NextInt();

            if (this.ArrangementType == ArrangementType.Vocal)
            {
                this.Tones = new List<Tone2014>();
            } else
            {
                ParseTuning(this, attr);
                ParseTones(this, attr);
            }
        }
开发者ID:jokester01au,项目名称:rocksmith-custom-song-toolkit,代码行数:18,代码来源:Arrangement.cs

示例9: parseMetadata

        private void parseMetadata(Song2014 xml, Sng2014File sng, Int16[] tuning)
        {
            // Easy, Medium, Hard
            NoteCount = new int[3];
            NoteCount[0] = getNoteCount(sng, 0);
            NoteCount[1] = getNoteCount(sng, 1);
            NoteCount[2] = getNoteCount(sng, 2);

            sng.Metadata = new Metadata();
            sng.Metadata.MaxScore = 100000;

            sng.Metadata.MaxDifficulty = getMaxDifficulty(xml);
            sng.Metadata.MaxNotesAndChords = NoteCount[2];
            sng.Metadata.MaxNotesAndChords_Real = sng.Metadata.MaxNotesAndChords;//num unique notes+not ignored
            sng.Metadata.PointsPerNote = sng.Metadata.MaxScore / sng.Metadata.MaxNotesAndChords;

            sng.Metadata.FirstBeatLength = xml.Ebeats[1].Time - xml.Ebeats[0].Time;
            sng.Metadata.StartTime = xml.Offset * -1;
            sng.Metadata.CapoFretId = (xml.Capo == 0) ? unchecked((Byte)(-1)) : xml.Capo;
            readString(xml.LastConversionDateTime, sng.Metadata.LastConversionDateTime);
            sng.Metadata.Part = xml.Part;
            sng.Metadata.SongLength = xml.SongLength;
            sng.Metadata.StringCount = 6;
            sng.Metadata.Tuning = tuning ?? new Int16[sng.Metadata.StringCount];
            // calculated when parsing arrangements
            sng.Metadata.Unk11_FirstNoteTime = first_note_time;
            sng.Metadata.Unk12_FirstNoteTime = first_note_time;
        }
开发者ID:vicyork,项目名称:rocksmith-custom-song-toolkit,代码行数:28,代码来源:Sng2014FileWriter.cs

示例10: parseEbeats

 private void parseEbeats(Song2014 xml, Sng2014File sng)
 {
     sng.BPMs = new BpmSection();
     sng.BPMs.Count = xml.Ebeats.Length;
     sng.BPMs.BPMs = new Bpm[sng.BPMs.Count];
     Int16 measure = 0;
     Int16 beat = 0;
     for (int i = 0; i < sng.BPMs.Count; i++)
     {
         var ebeat = xml.Ebeats[i];
         var bpm = new Bpm();
         bpm.Time = ebeat.Time;
         if (ebeat.Measure >= 0)
         {
             measure = ebeat.Measure;
             beat = 0;
         }
         else
         {
             beat++;
         }
         bpm.Measure = measure;
         bpm.Beat = beat;
         bpm.PhraseIteration = getPhraseIterationId(xml, bpm.Time, true);
         if (beat == 0)
         {
             bpm.Mask |= 1;
             if (measure % 2 == 0)
                 bpm.Mask |= 2;
         }
         sng.BPMs.BPMs[i] = bpm;
     }
 }
开发者ID:vicyork,项目名称:rocksmith-custom-song-toolkit,代码行数:33,代码来源:Sng2014FileWriter.cs

示例11: parseChords

        private void parseChords(Song2014 xml, Sng2014File sng, Int16[] tuning, bool bass)
        {
            sng.Chords = new ChordSection();
            sng.Chords.Count = xml.ChordTemplates.Length;
            sng.Chords.Chords = new Chord[sng.Chords.Count];

            for (int i = 0; i < sng.Chords.Count; i++)
            {
                var chord = xml.ChordTemplates[i];
                var c = new Chord();
                // TODO: skip if DisplayName == null
                if (chord.DisplayName.EndsWith("arp"))
                    c.Mask |= CON.CHORD_MASK_ARPEGGIO;
                else if (chord.DisplayName.EndsWith("nop"))
                    c.Mask |= CON.CHORD_MASK_NOP;

                c.Frets[0] = (Byte)chord.Fret0;
                c.Frets[1] = (Byte)chord.Fret1;
                c.Frets[2] = (Byte)chord.Fret2;
                c.Frets[3] = (Byte)chord.Fret3;
                c.Frets[4] = (Byte)chord.Fret4;
                c.Frets[5] = (Byte)chord.Fret5;
                c.Fingers[0] = (Byte)chord.Finger0;
                c.Fingers[1] = (Byte)chord.Finger1;
                c.Fingers[2] = (Byte)chord.Finger2;
                c.Fingers[3] = (Byte)chord.Finger3;
                c.Fingers[4] = (Byte)chord.Finger4;
                c.Fingers[5] = (Byte)chord.Finger5;
                for (Byte s = 0; s < 6; s++)
                    c.Notes[s] = GetMidiNote(tuning, s, c.Frets[s], bass, xml.Capo, template: true);
                readString(chord.ChordName, c.Name);
                sng.Chords.Chords[i] = c;
            }
        }
开发者ID:vicyork,项目名称:rocksmith-custom-song-toolkit,代码行数:34,代码来源:Sng2014FileWriter.cs

示例12: parseChord

        private void parseChord(Song2014 xml, Sng2014File sng, SongChord2014 chord, Notes n, Int32 chordNotesId)
        {
            n.NoteMask |= CON.NOTE_MASK_CHORD;
            if (chordNotesId != -1)
            {
                // there should always be a STRUM too => handshape at chord time
                // probably even for chordNotes which are not exported to SNG
                n.NoteMask |= CON.NOTE_MASK_CHORDNOTES;
            }

            if (chord.LinkNext != 0)
                n.NoteMask |= CON.NOTE_MASK_PARENT;

            if (chord.Accent != 0)
                n.NoteMask |= CON.NOTE_MASK_ACCENT;
            if (chord.FretHandMute != 0)
                n.NoteMask |= CON.NOTE_MASK_FRETHANDMUTE;
            if (chord.HighDensity != 0)
                n.NoteMask |= CON.NOTE_MASK_HIGHDENSITY;
            if (chord.Ignore != 0)
                n.NoteMask |= CON.NOTE_MASK_IGNORE;
            if (chord.PalmMute != 0)
                n.NoteMask |= CON.NOTE_MASK_PALMMUTE;
            // TODO: does not seem to have a mask or any effect
            // if (chord.Hopo != 0)
            //     n.NoteMask |= ;

            // numbering will be set later
            //n.NoteFlags = CON.NOTE_FLAGS_NUMBERED;

            n.Time = chord.Time;
            n.StringIndex = unchecked((Byte)(-1));
            // always -1
            n.FretId = unchecked((Byte)(-1));
            // anchor fret will be set later
            n.AnchorFretId = unchecked((Byte)(-1));
            // will be overwritten
            n.AnchorWidth = unchecked((Byte)(-1));
            n.ChordId = chord.ChordId;
            n.ChordNotesId = chordNotesId;
            n.PhraseIterationId = getPhraseIterationId(xml, n.Time, false);
            n.PhraseId = xml.PhraseIterations[n.PhraseIterationId].PhraseId;
            // these will be overwritten
            n.FingerPrintId[0] = -1;
            n.FingerPrintId[1] = -1;
            // these will be overwritten
            n.NextIterNote = -1;
            n.PrevIterNote = -1;
            // seems to be unused for chords
            n.ParentPrevNote = -1;
            n.SlideTo = unchecked((Byte)(-1));
            n.SlideUnpitchTo = unchecked((Byte)(-1));
            n.LeftHand = unchecked((Byte)(-1));
            n.Tap = unchecked((Byte)(-1));
            n.PickDirection = unchecked((Byte)(-1));
            n.Slap = unchecked((Byte)(-1));
            n.Pluck = unchecked((Byte)(-1));
            if (chord.ChordNotes != null)
            {
                foreach (var cn in chord.ChordNotes)
                    if (cn.Sustain > n.Sustain)
                        n.Sustain = cn.Sustain;
            }

            if (n.Sustain > 0)
                n.NoteMask |= CON.NOTE_MASK_SUSTAIN;

            int cnt = 0;
            for (int str = 0; str < 6; str++)
                if (sng.Chords.Chords[chord.ChordId].Frets[str] != 255)
                    ++cnt;
            if (cnt == 2)
                n.NoteMask |= CON.NOTE_MASK_DOUBLESTOP;

            // there are only zeros for all chords in lessons
            //n.Vibrato = 0;
            //n.MaxBend = 0;
            n.BendData = new BendDataSection();
            n.BendData.Count = 0;
            n.BendData.BendData = new BendData32[n.BendData.Count];
        }
开发者ID:vicyork,项目名称:rocksmith-custom-song-toolkit,代码行数:81,代码来源:Sng2014FileWriter.cs

示例13: parseActions

        private void parseActions(Song2014 xml, Sng2014File sng)
        {
            // there is no XML example, EOF does not support it either
            sng.Actions = new ActionSection();
            sng.Actions.Count = 0;
            sng.Actions.Actions = new Action[sng.Actions.Count];

            // no RS2 SNG is using this
            // for (int i = 0; i < sng.Actions.Count; i++) {
            //     //var action = xml.?[i];
            //     var a = new Action();
            //     //a.Time = action.Time;
            //     //read_string(action.ActionName, a.ActionName);
            //     sng.Actions.Actions[i] = a;
            // }
        }
开发者ID:vicyork,项目名称:rocksmith-custom-song-toolkit,代码行数:16,代码来源:Sng2014FileWriter.cs

示例14: getNoteCount

        private int getNoteCount(Sng2014File sng, int Level)
        {
            // time => note count
            var notes = new Dictionary<float, int>();
            var level = new Dictionary<float, int>();

            for (int i = sng.Arrangements.Count - 1; i >= 0; i--)
            {
                var a = sng.Arrangements.Arrangements[i];
                foreach (var n in a.Notes.Notes)
                {
                    if (i > sng.PhraseIterations.PhraseIterations[n.PhraseIterationId].Difficulty[Level])
                        // this note is above requested level
                        continue;

                    if (!notes.ContainsKey(n.Time))
                    {
                        // 1 note at difficulty i
                        notes[n.Time] = 1;
                        level[n.Time] = i;
                    }
                    else if (i == level[n.Time])
                    {
                        // we can add notes while still in the same difficulty
                        notes[n.Time] += 1;
                    }
                }
            }

            int count = 0;
            foreach (var time_count in notes.Values)
                count += time_count;
            return count;
        }
开发者ID:vicyork,项目名称:rocksmith-custom-song-toolkit,代码行数:34,代码来源:Sng2014FileWriter.cs

示例15: ReadVocals

 public static Sng2014File ReadVocals(string xmlFile)
 {
     var data = new MemoryStream(Resources.VOCALS_RS2);
     var sng = new Sng2014File(data);
     var xml = Vocals.LoadFromFile(xmlFile);
     Sng2014FileWriter.parseVocals(xml, sng);
     return sng;
 }
开发者ID:kenzousim84,项目名称:rocksmith-custom-song-toolkit,代码行数:8,代码来源:Sng2014FileWriter.cs


注:本文中的RocksmithToolkitLib.Sng2014HSL.Sng2014File类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。