public static void __hx_ctor_alphatab_model_Chord(global::alphatab.model.Chord __temp_me78) { unchecked { __temp_me78.strings = new global::haxe.root.Array <int>(); } }
public virtual void parseDiagramItem(global::alphatab.model.Track track, global::haxe.root.Xml node) { unchecked { global::alphatab.model.Chord chord = new global::alphatab.model.Chord(); string chordId = node.@get("id"); chord.name = node.@get("name"); track.chords.@set(chordId, chord); } }
public virtual void readChord(global::alphatab.model.Beat beat) { unchecked { global::alphatab.model.Chord chord = new global::alphatab.model.Chord(); string chordId = global::alphatab.util.Guid.generate(); if (( this._versionNumber >= 500 )) { this._data.read(17); chord.name = this.readStringByteLength(21); this._data.read(4); chord.firstFret = this.readInt32(); { int _g = 0; while (( _g < 7 )) { int i = _g++; int fret = this.readInt32(); if (( i < chord.strings.length )) { chord.strings.push(fret); } } } this._data.read(32); } else { if (( this._data.readByte() != 0 )) { if (( this._versionNumber >= 400 )) { this._data.read(16); chord.name = this.readStringByteLength(21); this._data.read(4); chord.firstFret = this.readInt32(); { int _g1 = 0; while (( _g1 < 7 )) { int i1 = _g1++; int fret1 = this.readInt32(); if (( i1 < chord.strings.length )) { chord.strings.push(fret1); } } } this._data.read(32); } else { this._data.read(25); chord.name = this.readStringByteLength(34); chord.firstFret = this.readInt32(); { int _g2 = 0; while (( _g2 < 6 )) { int i2 = _g2++; int fret2 = this.readInt32(); chord.strings.push(fret2); } } this._data.read(36); } } else { int strings = default(int); if (( this._versionNumber >= 406 )) { strings = 7; } else { strings = 6; } chord.name = this.readStringIntByte(); chord.firstFret = this.readInt32(); if (( chord.firstFret > 0 )) { int _g3 = 0; while (( _g3 < strings )) { int i3 = _g3++; int fret3 = this.readInt32(); if (( i3 < chord.strings.length )) { chord.strings.push(fret3); } } } } } if (( chord.name.Length > 0 )) { beat.voice.bar.track.chords.@set(chordId, chord); beat.chordId = chordId; } } }
private static Score CreateSong(Song2014 song, IEnumerable<SongNoteChordWrapper> allSounds) { var score = new Score(); score.album = song.AlbumName; score.artist = song.ArtistName; //score.copyright //score.instructions //score.music score.notices = "Created by RockSmith Tab Explorer"; //_score.subTitle //_score.tab score.tempo = (int)song.AverageTempo; score.tempoLabel = "avg. bpm"; score.title = song.Title + " (" + song.Arrangement + ")"; //_score.words bool isBass = song.Arrangement.ToLower() == "bass"; var track = new Track(); track.name = song.Arrangement; track.index = 1; track.tuningName = GetTuningName(song.Tuning, isBass); track.shortName = song.Arrangement; for (Byte s = 0; s < (isBass ? 4 : 6); s++) track.tuning[(isBass ? 3 : 5) - s] = Sng2014FileWriter.GetMidiNote(song.Tuning.ToShortArray(), s, 0, isBass); score.addTrack(track); int chordId = 0; foreach (var chordTemplate in song.ChordTemplates) { var chord = new global::alphatab.model.Chord(); track.chords.set(chordId.ToString(), chord); chord.name = chordTemplate.ChordName; chord.strings[0] = chordTemplate.Fret0; chord.strings[1] = chordTemplate.Fret1; chord.strings[2] = chordTemplate.Fret2; chord.strings[3] = chordTemplate.Fret3; chord.strings[4] = chordTemplate.Fret4; chord.strings[5] = chordTemplate.Fret5; chordId++; } var ebeatMeasures = song.Ebeats.Where(x => x.Measure > 0).OrderBy(x => x.Measure).ToList(); var notesStack = new Stack<SongNoteChordWrapper>(allSounds.OrderByDescending(x => x.Time)); var currentNote = notesStack.Pop(); var nextNote = notesStack.Pop(); int prevMeasureId = 0; int i = 1; float prevMeasureDuration=0; foreach (var measure in ebeatMeasures) { var nextmeasure = i < ebeatMeasures.Count ? ebeatMeasures[i] : null; if (measure.Measure > prevMeasureId) { var measureDuration = nextmeasure !=null ? nextmeasure.Time - measure.Time : prevMeasureDuration; AddMasterBarToScore(score, measure.Time.ToString("n2")); var voice = AddBarAndVoiceToTrack(track, isBass ? Clef.F4 : Clef.G2); bool firstNoteInBar = true; while (currentNote != null && (nextmeasure == null || currentNote.Time < nextmeasure.Time)) { Duration duration = Duration.Quarter; if (firstNoteInBar && currentNote.Time > measure.Time) { var leadingSilenceTicks = Get64thsFromDuration(measure.Time, currentNote.Time, measureDuration); while (leadingSilenceTicks >= 1) { if (leadingSilenceTicks >= 32) { AddBeatAndNoteToVoice(voice, null, Duration.Half); leadingSilenceTicks -= 32; } else if (leadingSilenceTicks >= 16) { AddBeatAndNoteToVoice(voice, null, Duration.Quarter); leadingSilenceTicks -= 16; } else if (leadingSilenceTicks >= 8) { AddBeatAndNoteToVoice(voice, null, Duration.Eighth); leadingSilenceTicks -= 8; } else if (leadingSilenceTicks >= 4) { AddBeatAndNoteToVoice(voice, null, Duration.Sixteenth); leadingSilenceTicks -= 4; } else if (leadingSilenceTicks >= 2) { AddBeatAndNoteToVoice(voice, null, Duration.ThirtySecond); leadingSilenceTicks -= 2; } else if (leadingSilenceTicks >= 1) { AddBeatAndNoteToVoice(voice, null, Duration.SixtyFourth); leadingSilenceTicks -= 1; } } } if (nextNote != null) { duration = GetBeatDuration(currentNote.Time,nextNote.Time,measureDuration); } if (currentNote.IsNote()) AddBeatAndNoteToVoice(voice, currentNote.AsNote(), duration); else AddBeatWithChordToVoice(voice, currentNote.AsChord(), duration); currentNote = nextNote; if (notesStack.Any()) nextNote = notesStack.Pop(); else nextNote = null; firstNoteInBar = false; } prevMeasureId = measure.Measure; prevMeasureDuration = measureDuration; } i++; } return score; }
private static Score CreateSong(Song2014 song, IEnumerable <SongNoteChordWrapper> allSounds) { var score = new Score(); score.album = song.AlbumName; score.artist = song.ArtistName; //score.copyright //score.instructions //score.music score.notices = "Created by RockSmith Tab Explorer"; //_score.subTitle //_score.tab score.tempo = (int)song.AverageTempo; score.tempoLabel = "avg. bpm"; score.title = song.Title + " (" + song.Arrangement + ")"; //_score.words bool isBass = song.Arrangement.ToLower() == "bass"; var track = new Track(); track.name = song.Arrangement; track.index = 1; track.tuningName = GetTuningName(song.Tuning, isBass); track.shortName = song.Arrangement; for (Byte s = 0; s < (isBass ? 4 : 6); s++) { track.tuning[(isBass ? 3 : 5) - s] = Sng2014FileWriter.GetMidiNote(song.Tuning.ToShortArray(), s, 0, isBass); } score.addTrack(track); int chordId = 0; foreach (var chordTemplate in song.ChordTemplates) { var chord = new global::alphatab.model.Chord(); track.chords.set(chordId.ToString(), chord); chord.name = chordTemplate.ChordName; chord.strings[0] = chordTemplate.Fret0; chord.strings[1] = chordTemplate.Fret1; chord.strings[2] = chordTemplate.Fret2; chord.strings[3] = chordTemplate.Fret3; chord.strings[4] = chordTemplate.Fret4; chord.strings[5] = chordTemplate.Fret5; chordId++; } var ebeatMeasures = song.Ebeats.Where(x => x.Measure > 0).OrderBy(x => x.Measure).ToList(); var notesStack = new Stack <SongNoteChordWrapper>(allSounds.OrderByDescending(x => x.Time)); var currentNote = notesStack.Pop(); var nextNote = notesStack.Pop(); int prevMeasureId = 0; int i = 1; float prevMeasureDuration = 0; foreach (var measure in ebeatMeasures) { var nextmeasure = i < ebeatMeasures.Count ? ebeatMeasures[i] : null; if (measure.Measure > prevMeasureId) { var measureDuration = nextmeasure != null ? nextmeasure.Time - measure.Time : prevMeasureDuration; AddMasterBarToScore(score, measure.Time.ToString("n2")); var voice = AddBarAndVoiceToTrack(track, isBass ? Clef.F4 : Clef.G2); bool firstNoteInBar = true; while (currentNote != null && (nextmeasure == null || currentNote.Time < nextmeasure.Time)) { Duration duration = Duration.Quarter; if (firstNoteInBar && currentNote.Time > measure.Time) { var leadingSilenceTicks = Get64thsFromDuration(measure.Time, currentNote.Time, measureDuration); while (leadingSilenceTicks >= 1) { if (leadingSilenceTicks >= 32) { AddBeatAndNoteToVoice(voice, null, Duration.Half); leadingSilenceTicks -= 32; } else if (leadingSilenceTicks >= 16) { AddBeatAndNoteToVoice(voice, null, Duration.Quarter); leadingSilenceTicks -= 16; } else if (leadingSilenceTicks >= 8) { AddBeatAndNoteToVoice(voice, null, Duration.Eighth); leadingSilenceTicks -= 8; } else if (leadingSilenceTicks >= 4) { AddBeatAndNoteToVoice(voice, null, Duration.Sixteenth); leadingSilenceTicks -= 4; } else if (leadingSilenceTicks >= 2) { AddBeatAndNoteToVoice(voice, null, Duration.ThirtySecond); leadingSilenceTicks -= 2; } else if (leadingSilenceTicks >= 1) { AddBeatAndNoteToVoice(voice, null, Duration.SixtyFourth); leadingSilenceTicks -= 1; } } } if (nextNote != null) { duration = GetBeatDuration(currentNote.Time, nextNote.Time, measureDuration); } if (currentNote.IsNote()) { AddBeatAndNoteToVoice(voice, currentNote.AsNote(), duration); } else { AddBeatWithChordToVoice(voice, currentNote.AsChord(), duration); } currentNote = nextNote; if (notesStack.Any()) { nextNote = notesStack.Pop(); } else { nextNote = null; } firstNoteInBar = false; } prevMeasureId = measure.Measure; prevMeasureDuration = measureDuration; } i++; } return(score); }