本文整理汇总了C#中AlphaTab.Model.Beat.AddNote方法的典型用法代码示例。如果您正苦于以下问题:C# Beat.AddNote方法的具体用法?C# Beat.AddNote怎么用?C# Beat.AddNote使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AlphaTab.Model.Beat
的用法示例。
在下文中一共展示了Beat.AddNote方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Clone
public Beat Clone()
{
var beat = new Beat();
for (int i = 0, j = WhammyBarPoints.Count; i < j; i++)
{
beat.WhammyBarPoints.Add(WhammyBarPoints[i].Clone());
}
for (int i = 0, j = Notes.Count; i < j; i++)
{
beat.AddNote(Notes[i].Clone());
}
CopyTo(this, beat);
for (int i = 0, j = Automations.Count; i < j; i++)
{
beat.Automations.Add(Automations[i].Clone());
}
return beat;
}
示例2: Note
private void Note(Beat beat)
{
// fret.string
var syData = _syData.ToString().ToLower();
if (_sy != AlphaTexSymbols.Number && !(_sy == AlphaTexSymbols.String
&& (syData == "x" || syData == "-")))
{
Error("note-fret", AlphaTexSymbols.Number);
}
var isDead = syData == "x";
var isTie = syData == "-";
int fret = (int)(isDead || isTie ? 0 : _syData);
NewSy(); // Fret done
if (_sy != AlphaTexSymbols.Dot)
{
Error("note", AlphaTexSymbols.Dot);
}
NewSy(); // dot done
if (_sy != AlphaTexSymbols.Number)
{
Error("note-string", AlphaTexSymbols.Number);
}
int @string = (int)_syData;
if (@string < 1 || @string > _track.Tuning.Length)
{
Error("note-string", AlphaTexSymbols.Number, false);
}
NewSy(); // string done
// read effects
var note = new Note();
beat.AddNote(note);
note.String = _track.Tuning.Length - (@string - 1);
note.IsDead = isDead;
note.IsTieDestination = isTie;
if (!isTie)
{
note.Fret = fret;
}
NoteEffects(note);
}
示例3: ReadNote
public void ReadNote(Track track, Bar bar, Voice voice, Beat beat, int stringIndex)
{
var newNote = new Note();
newNote.String = track.Tuning.Length - stringIndex;
var flags = Data.ReadByte();
if ((flags & 0x02) != 0)
{
newNote.Accentuated = AccentuationType.Heavy;
}
else if ((flags & 0x40) != 0)
{
newNote.Accentuated = AccentuationType.Normal;
}
newNote.IsGhost = ((flags & 0x04) != 0);
if ((flags & 0x20) != 0)
{
var noteType = Data.ReadByte();
if (noteType == 3)
{
newNote.IsDead = true;
}
else if (noteType == 2)
{
newNote.IsTieDestination = true;
}
}
if ((flags & 0x01) != 0 && _versionNumber < 500)
{
Data.ReadByte(); // duration
Data.ReadByte(); // tuplet
}
if ((flags & 0x10) != 0)
{
var dynamicNumber = Data.ReadSignedByte();
newNote.Dynamic = ToDynamicValue(dynamicNumber);
beat.Dynamic = newNote.Dynamic;
}
if ((flags & 0x20) != 0)
{
newNote.Fret = Data.ReadSignedByte();
}
if ((flags & 0x80) != 0)
{
newNote.LeftHandFinger = (Fingers)Data.ReadSignedByte();
newNote.RightHandFinger = (Fingers)Data.ReadSignedByte();
newNote.IsFingering = true;
}
if (_versionNumber >= 500)
{
if ((flags & 0x01) != 0)
{
newNote.DurationPercent = ReadDouble();
}
var flags2 = Data.ReadByte();
newNote.AccidentalMode = (flags2 & 0x02) != 0
? NoteAccidentalMode.SwapAccidentals
: NoteAccidentalMode.Default;
}
beat.AddNote(newNote);
if ((flags & 0x08) != 0)
{
ReadNoteEffects(track, voice, beat, newNote);
}
}
示例4: SetNotes
public void SetNotes(GeneticMIDI.Representation.Track track)
{
if (track.Length < 1)
return;
var mel = track.GetMelodySequence();
//return;
score = new Score();
Track t = new Track();
MasterBar mb = new MasterBar();
score.AddMasterBar(mb);
mb.KeySignature = 2;
Bar b = new Bar();
t.AddBar(b);
score.AddTrack(t);
Voice v = new Voice();
b.AddVoice(v);
t.Name = track.Instrument.ToString().Replace("_", " ");
//t.IsPercussion = true;
if(t.IsPercussion)
{
b.Clef = Clef.Neutral;
}
int i = 0;
int qn_per_bar = 4;
int durs = 0;
int avg_octave = mel.CalculateAverageOctave();
int dist4 = 4 - avg_octave;
foreach (var n in mel.Notes)
{
Beat be = new Beat();
be.Index = i++;
GeneticMIDI.Representation.Durations dur;
int remainder;
n.GetClosestLowerDurationAndRemainder(out dur, out remainder);
int dots = n.GetNumberOfDots();
durs += n.Duration;
/* if(durs >= qn_per_bar * (int)GeneticMIDI.Representation.Durations.qn)
{
durs = 0;
b = new Bar();
t.AddBar(b);
v.Bar = b;
b.Finish();
}*/
switch (((GeneticMIDI.Representation.Durations)n.Duration))
{
case GeneticMIDI.Representation.Durations.bn:
be.Duration = AlphaTab.Model.Duration.Whole;
dots = 2;
break;
case GeneticMIDI.Representation.Durations.en:
be.Duration = AlphaTab.Model.Duration.Eighth;
break;
case GeneticMIDI.Representation.Durations.hn:
be.Duration = AlphaTab.Model.Duration.Half;
break;
case GeneticMIDI.Representation.Durations.qn:
be.Duration = AlphaTab.Model.Duration.Quarter;
break;
case GeneticMIDI.Representation.Durations.sn:
be.Duration = AlphaTab.Model.Duration.Sixteenth;
break;
case GeneticMIDI.Representation.Durations.tn:
be.Duration = AlphaTab.Model.Duration.ThirtySecond;
break;
case GeneticMIDI.Representation.Durations.wn:
be.Duration = AlphaTab.Model.Duration.Whole;
break;
default:
break;
}
be.Dots = dots;
Note note = new Note();
if (!n.IsRest())
{
note.Tone = n.NotePitch;
note.Octave = n.Octave + dist4;
be.AddNote(note);
//.........这里部分代码省略.........
示例5: ReadGrace
public void ReadGrace(Voice voice, Note note)
{
var graceBeat = new Beat();
var graceNote = new Note();
graceNote.String = note.String;
graceNote.Fret = Data.ReadSignedByte();
graceBeat.Duration = Duration.ThirtySecond;
graceBeat.Dynamic = ToDynamicValue(Data.ReadSignedByte());
var transition = Data.ReadSignedByte();
switch (transition)
{
case 0: // none
break;
case 1:
graceNote.SlideType = SlideType.Legato;
graceNote.SlideTarget = note;
break;
case 2: // bend
break;
case 3: // hammer
graceNote.IsHammerPullOrigin = true;
break;
}
graceNote.Dynamic = graceBeat.Dynamic;
Data.Skip(1); // duration
if (_versionNumber < 500)
{
graceBeat.GraceType = GraceType.BeforeBeat;
}
else
{
var flags = Data.ReadByte();
graceNote.IsDead = (flags & 0x01) != 0;
graceBeat.GraceType = (flags & 0x02) != 0 ? GraceType.OnBeat : GraceType.BeforeBeat;
}
graceBeat.AddNote(graceNote);
voice.AddGraceBeat(graceBeat);
}
示例6: JsObjectToScore
public Score JsObjectToScore(Score score)
{
var score2 = new Score();
Score.CopyTo(score, score2);
#region MasterBars
for (var i = 0;i < score.MasterBars.Count; i++)
{
var masterBar = score.MasterBars[i];
var masterBar2 = new MasterBar();
MasterBar.CopyTo(masterBar, masterBar2);
if (masterBar.TempoAutomation != null)
{
masterBar2.TempoAutomation = new Automation();
Automation.CopyTo(masterBar.TempoAutomation, masterBar2.TempoAutomation);
}
if (masterBar.VolumeAutomation != null)
{
masterBar2.VolumeAutomation = new Automation();
Automation.CopyTo(masterBar.VolumeAutomation, masterBar2.VolumeAutomation);
}
if (masterBar.Section != null)
{
masterBar2.Section = new Section();
Section.CopyTo(masterBar.Section, masterBar2.Section);
}
score2.AddMasterBar(masterBar2);
}
#endregion
#region Tracks
for (int t = 0; t < score.Tracks.Count; t++)
{
var track = score.Tracks[t];
var track2 = new Track();
Track.CopyTo(track, track2);
score2.AddTrack(track2);
PlaybackInformation.CopyTo(track.PlaybackInfo, track2.PlaybackInfo);
foreach (var key in track.Chords.Keys)
{
var chord = track.Chords[key];
var chord2 = new Chord();
Chord.CopyTo(chord, chord2);
track2.Chords[key] = chord2;
}
#region Bars
for (int b = 0; b < track.Bars.Count; b++)
{
var bar = track.Bars[b];
var bar2 = new Bar();
Bar.CopyTo(bar, bar2);
track2.AddBar(bar2);
#region Voices
for (int v = 0; v < bar.Voices.Count; v++)
{
var voice = bar.Voices[v];
var voice2 = new Voice();
Voice.CopyTo(voice, voice2);
bar2.AddVoice(voice2);
#region Beats
for (int bb = 0; bb < voice.Beats.Count; bb++)
{
var beat = voice.Beats[bb];
var beat2 = new Beat();
Beat.CopyTo(beat, beat2);
voice2.AddBeat(beat2);
for (int a = 0; a < beat.Automations.Count; a++)
{
var automation = new Automation();
Automation.CopyTo(beat.Automations[a], automation);
beat2.Automations.Add(automation);
}
for (int i = 0; i < beat.WhammyBarPoints.Count; i++)
{
var point = new BendPoint();
BendPoint.CopyTo(beat.WhammyBarPoints[i], point);
beat2.WhammyBarPoints.Add(point);
}
#region Notes
for (int n = 0; n < beat.Notes.Count; n++)
{
var note = beat.Notes[n];
var note2 = new Note();
Note.CopyTo(note, note2);
beat2.AddNote(note2);
//.........这里部分代码省略.........
示例7: AddBeatAndNoteToVoice
private static void AddBeatAndNoteToVoice(Voice voice, SongNote2014 note, Duration duration, Single durationTime)
{
var beat = new Beat();
beat.Duration = duration;
voice.AddBeat(beat);
if (note != null)
{
var destNote = NoteFromNote(note, durationTime);
beat.AddNote(destNote);
if (note.HammerOn == 1 && _prevConvertedNote != null)
{
_prevConvertedNote.IsHammerPullOrigin = true;
//_prevConvertedNote.slideTarget = destNote;
//_prevConvertedNote.slideType = SlideType.Shift;
destNote.IsHammerPullOrigin = false;
destNote.IsGhost = true;
//_prevConvertedNote.hammerPullOrigin = destNote;// _prevConvertedNote;
destNote.HammerPullOrigin = _prevConvertedNote;
}
_prevConvertedNote = destNote;
}
}
示例8: AddBeatWithChordToVoice
private static void AddBeatWithChordToVoice(Voice voice, SongChord2014 sourceChord, Duration duration, Single durationTime)
{
var beat = new Beat();
beat.Duration = duration;
voice.AddBeat(beat);
beat.ChordId = sourceChord.ChordId.ToString();
AlphaTab.Model.Chord chord = null;
try
{
chord = beat.Chord;
}
catch (KeyNotFoundException)
{
}
//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, durationTime);
beat.AddNote(note1);
}
}
}
else
{
//Set notes in beat from predefined chord
for (int i = 0; i < chord.Strings.Count; i++)
{
var tmpstrFret = chord.Strings[i];
if (tmpstrFret > -1)
{
var note1 = new Note();
note1.Fret = tmpstrFret;
note1.String = i + 1;
beat.AddNote(note1);
}
}
}
}
示例9: Button_Click
private void Button_Click(object sender, RoutedEventArgs e)
{
var comp = GeneticMIDI.Representation.Composition.LoadFromMIDI(@"C:\Users\1gn1t0r\Documents\git\GeneticMIDI\GeneticMIDI\bin\Debug\test\harry.mid");
var mel = comp.Tracks[0].GetMainSequence() as GeneticMIDI.Representation.MelodySequence;
Score score = new Score();
Track t = new Track();
var pc = t.IsPercussion;
MasterBar mb = new MasterBar();
score.AddMasterBar(mb);
mb.KeySignature = 2;
Bar b = new Bar();
t.AddBar(b);
score.AddTrack(t);
Voice v = new Voice();
b.AddVoice(v);
int i = 0;
int qn_per_bar = 4;
int durs = 0;
int avg_octave = mel.CalculateAverageOctave();
int dist4 = 4 - avg_octave;
foreach(var n in mel.Notes)
{
Beat be = new Beat();
be.Index = i++;
GeneticMIDI.Representation.Durations dur;
int remainder;
n.GetClosestLowerDurationAndRemainder(out dur, out remainder);
int dots = n.GetNumberOfDots();
durs += n.Duration;
/* if(durs >= qn_per_bar * (int)GeneticMIDI.Representation.Durations.qn)
{
durs = 0;
b = new Bar();
t.AddBar(b);
v.Bar = b;
b.Finish();
}*/
switch (((GeneticMIDI.Representation.Durations)n.Duration))
{
case GeneticMIDI.Representation.Durations.bn:
be.Duration = Model.Duration.Whole;
dots = 2;
break;
case GeneticMIDI.Representation.Durations.en:
be.Duration = Model.Duration.Eighth;
break;
case GeneticMIDI.Representation.Durations.hn:
be.Duration = Model.Duration.Half;
break;
case GeneticMIDI.Representation.Durations.qn:
be.Duration = Model.Duration.Quarter;
break;
case GeneticMIDI.Representation.Durations.sn:
be.Duration = Model.Duration.Sixteenth;
break;
case GeneticMIDI.Representation.Durations.tn:
be.Duration = Model.Duration.ThirtySecond;
break;
case GeneticMIDI.Representation.Durations.wn:
be.Duration = Model.Duration.Whole;
break;
default:
break;
}
be.Dots = dots;
Note note = new Note();
if (!n.IsRest())
{
note.Tone = n.NotePitch;
note.Octave = n.Octave + dist4;
be.AddNote(note);
be.IsEmpty = false;
}
if(n.IsRest() && n.Duration < 2)
{
}
else
v.AddBeat(be);
be.RefreshNotes();
}
//.........这里部分代码省略.........