private static void AddBeatWithChordToVoice(Voice voice, SongChord2014 sourceChord, Duration duration) { var beat = new Beat(); beat.duration = duration; voice.addBeat(beat); beat.chordId = sourceChord.ChordId.ToString(); var chord = beat.chord(); var chordString = chord == null ? "null" : "not null"; var sourceChordString = sourceChord.ChordNotes != null ? sourceChord.ChordNotes.Length.ToString() : "null"; Debug.WriteLine(beat.chordId + " - chord: " + chordString + ", sourceChord.ChordNotes: " + sourceChordString); //if (chord != null && sourceChord.ChordNotes.Any()) //{ // DbgAssert(false); //} //Will be non-null if predefined chord exist (and predefined chord should exist if ChordId is present in ChordTemplates) if (chord == null) { beat.chordId = null; //chord = new global::alphatab.model.Chord(); //voice.bar.track.chords.set(beat.chordId, chord); //Set notes in beat from this chord if (sourceChord.ChordNotes != null) { foreach (var sourceNote in sourceChord.ChordNotes) { var note1 = NoteFromNote(sourceNote); beat.addNote(note1); } } } else { //Set notes in beat from predefined chord for (int i = 0; i < chord.strings.length; i++) { var tmpstrFret = chord.strings[i]; if (tmpstrFret > -1) { var note1 = new Note(); note1.fret = tmpstrFret; note1.@string = i + 1; beat.addNote(note1); } } } }
private static Note NoteFromNote(SongNote2014 srcNote) { //DbgAssert(srcNote.LinkNext == 0); //DbgAssert(srcNote.Bend == 0); //DbgAssert(srcNote.HammerOn == 0); //DbgAssert(srcNote.Harmonic == 0); //DbgAssert(srcNote.Hopo == 0); //DbgAssert(srcNote.Ignore == 0); //DbgAssert(srcNote.Mute == 0); //DbgAssert(srcNote.PalmMute == 0); //DbgAssert(srcNote.Pluck == -1); //DbgAssert(srcNote.PullOff == 0); //DbgAssert(srcNote.Slap == -1); //DbgAssert(srcNote.Tremolo == 0); //DbgAssert(srcNote.HarmonicPinch == 0); //DbgAssert(srcNote.PickDirection == 0); //DbgAssert(srcNote.Tap == 0); //DbgAssert(srcNote.Vibrato == 0); var note1 = new Note(); note1.fret = srcNote.Fret; note1.@string = srcNote.String + 1; note1.accentuated = srcNote.Accent == 1 ? AccentuationType.Normal : AccentuationType.None; if (srcNote.SlideTo > -1) note1.slideType = SlideType.Shift; if (srcNote.SlideUnpitchTo > -1) { if (srcNote.SlideUnpitchTo > srcNote.Fret) note1.slideType = SlideType.OutUp; else note1.slideType = SlideType.OutDown; } //note1.bendPoints src.bend //note1.durationPercent //note1.hammerPullOrigin //note1.harmonicType=HarmonicType.Natural //note1.harmonicValue //note1.isDead //note1.isFingering //note1.isGhost //note1.isHammerPullDestination //note1.isHammerPullOrigin //note1.isLetRing //note1.isPalmMute //note1.isStaccato //note1.isTieDestination //note1.isTieOrigin //note1.leftHandFinger //note1.octave //note1.slideTarget //note1.slideType=SlideType.IntoFromAbove //note1.tieOrigin //note1.trillSpeed //note1.trillValue //note1.vibrato return note1; }
private static void AddBeatAndNoteToVoice(Voice voice, SongNote2014 note, Duration duration) { var beat = new Beat(); beat.duration = duration; voice.addBeat(beat); if (note != null) { var destNote = NoteFromNote(note); beat.addNote(destNote); if (note.HammerOn == 1 && _prevConvertedNote != null) { _prevConvertedNote.isHammerPullOrigin = true; //_prevConvertedNote.slideTarget = destNote; //_prevConvertedNote.slideType = SlideType.Shift; destNote.isHammerPullDestination = true; destNote.isGhost = true; //_prevConvertedNote.hammerPullOrigin = destNote;// _prevConvertedNote; destNote.hammerPullOrigin = _prevConvertedNote; } _prevConvertedNote = destNote; } }