public static IncipitViewerWPF BuildClef(uint beats, uint beatType) { var result = new IncipitViewerWPF(); result.AddMusicalSymbol(new Clef(ClefType.GClef, 2)); result.AddMusicalSymbol(new TimeSignature(TimeSignatureType.Numbers, beats, beatType)); return(result); }
private static (IncipitViewerWPF Viewer, int Width) BuildVisualMeasure(MusicMeasure measure) { var result = new IncipitViewerWPF(); var symbols = MeasureToPsamSymbolConvertor.Convert(measure); foreach (var symbol in symbols) { result.AddMusicalSymbol(symbol); } result.AddMusicalSymbol(new Barline()); return(result, CalculateWidth(symbols)); }
public void updateView(D_Staff staff) { if (staff == null) { return; } StaffViewers.Clear(); IncipitViewerWPF temp_staff = IncipitViewerWPFWrapper.getWPFstaff(staff.clef); int bar_count = 0; D_Measure previous_bar_measure = null; foreach (D_Bar bar in staff.bars) { bar_count++; if (bar.measure != previous_bar_measure) { temp_staff.AddMusicalSymbol(PSAMAdapter.fromMeasure(bar.measure)); } foreach (D_Note note in bar.notes) { temp_staff.AddMusicalSymbol(PSAMAdapter.fromNote(note)); } if (bar_count == 4) { StaffViewers.Add(temp_staff); temp_staff = IncipitViewerWPFWrapper.getWPFstaff(staff.clef); bar_count = 0; } temp_staff.AddMusicalSymbol(new Barline()); previous_bar_measure = bar.measure; } if (bar_count < 4) { StaffViewers.Add(temp_staff); } this.view.ItemsSource = StaffViewers; }
public static IncipitViewerWPF getWPFstaff(clef clef_type) { IncipitViewerWPF to_return = new IncipitViewerWPF(); to_return.AddMusicalSymbol(new Clef(clef_types[clef_type], 2)); to_return.Width = 525; return(to_return); }
private IncipitViewerWPF createNewBarline() //Creats a new barline in the MainWindow { IncipitViewerWPF barLine = new IncipitViewerWPF(); barLine.Width = 525; barLine.AddMusicalSymbol(new Clef(ClefType.GClef, 2)); return(barLine); }
public void draw(ScrollViewer scrollViewer, TrackObject track) { createStaff(); staff.ClearMusicalIncipit(); staff.Width = 500; staff.AddMusicalSymbol(new Clef(ClefType.GClef, 2)); double maatvol = 0; int a = 0; if (track.notes.Count > 2) { foreach (ISymbol symbol in track.notes) { if (symbol is NoteSymbol) { NoteSymbol note = (NoteSymbol)symbol; a = note.absoluteTicks >= 16128 && track.timeSignature.Count > 1 ? 1 : 0; if (track.timeSignature.Count > 0) { if (maatvol >= track.timeSignature[a][1]) { staff.AddMusicalSymbol(new Barline()); maatvol = 0; } } maatvol += note.nootduur; } MusicalSymbol musicalSymbol = getSymbol(symbol); if (musicalSymbol != null) { staff.AddMusicalSymbol(musicalSymbol); } staff.Width += 30; } } scrollViewer.Content = staff; }
public StackPanel GetSheetVisualisation(ADPTrack _adpTrack) //updates the barlines in the mainwindow to look like the ADPsheet that is given as the parameter { StackPanel resultStackPanel = new StackPanel(); int barCount = 0; bool barlineHasTimeSignature = false; int[] currentTimeSignature = new int[2]; IncipitViewerWPF barLine = createNewBarline(); foreach (ADPBar tempBar in _adpTrack.Bars) { if (!barlineHasTimeSignature) { currentTimeSignature[0] = tempBar.TimeSignature[0]; currentTimeSignature[1] = tempBar.TimeSignature[1]; barLine.AddMusicalSymbol(new TimeSignature(TimeSignatureType.Numbers, (uint)tempBar.TimeSignature[0], (uint)tempBar.TimeSignature[1])); barLine.AddMusicalSymbol(new Barline()); barlineHasTimeSignature = true; } else if (currentTimeSignature[0] != tempBar.TimeSignature[0] && currentTimeSignature[1] != tempBar.TimeSignature[1]) { currentTimeSignature[0] = tempBar.TimeSignature[0]; currentTimeSignature[1] = tempBar.TimeSignature[1]; barLine.AddMusicalSymbol(new TimeSignature(TimeSignatureType.Numbers, (uint)tempBar.TimeSignature[0], (uint)tempBar.TimeSignature[1])); } // add symbols foreach (ADPMusicalSymbol tempSymbol in tempBar.MusicalSymbols) { if (tempSymbol != null) { if (tempSymbol.GetType() == typeof(ADPRest)) { //rest barLine.AddMusicalSymbol(new Rest(convertDuration(tempSymbol.Duration))); } else { ADPNote tempNote = (ADPNote)tempSymbol; //note if (tempNote.AmountOfDots > 0) { barLine.AddMusicalSymbol(new Note(tempNote.Key, tempNote.Alter, tempNote.Octave, convertDuration(tempNote.Duration), NoteStemDirection.Down, NoteTieType.None, new List <NoteBeamType>() { NoteBeamType.Single }) { NumberOfDots = tempNote.AmountOfDots }); } else { barLine.AddMusicalSymbol(new Note(tempNote.Key, tempNote.Alter, tempNote.Octave, convertDuration(tempNote.Duration), NoteStemDirection.Down, NoteTieType.None, new List <NoteBeamType>() { NoteBeamType.Single })); } } } } // add endOfBarLine barCount++; barLine.AddMusicalSymbol(new Barline()); if (barCount == 3) { resultStackPanel.Children.Add(barLine); barLine = createNewBarline(); barCount = 0; barlineHasTimeSignature = false; } } if (barCount > 0) { resultStackPanel.Children.Add(barLine); } return(resultStackPanel); }
public StackPanel GetSampleVisualisation() //Adds the sample to the barline in the MainWindow. To show how a barline looks like { StackPanel resultStackPanel = new StackPanel(); IncipitViewerWPF barline = new IncipitViewerWPF(); barline.Width = 500; barline.AddMusicalSymbol(new Clef(ClefType.GClef, 2)); barline.AddMusicalSymbol(new TimeSignature(TimeSignatureType.Numbers, 4, 4)); barline.AddMusicalSymbol(new Note("A", 1, 4, MusicalSymbolDuration.Sixteenth, NoteStemDirection.Down, NoteTieType.Start, new List <NoteBeamType>() { NoteBeamType.Start, NoteBeamType.Start })); barline.AddMusicalSymbol(new Note("A", 0, 4, MusicalSymbolDuration.Sixteenth, NoteStemDirection.Down, NoteTieType.Stop, new List <NoteBeamType>() { NoteBeamType.Start, NoteBeamType.Start })); barline.AddMusicalSymbol(new Note("C", 1, 5, MusicalSymbolDuration.Sixteenth, NoteStemDirection.Down, NoteTieType.None, new List <NoteBeamType>() { NoteBeamType.Continue, NoteBeamType.End })); barline.AddMusicalSymbol(new Note("D", 0, 5, MusicalSymbolDuration.Eighth, NoteStemDirection.Down, NoteTieType.Start, new List <NoteBeamType>() { NoteBeamType.End })); barline.AddMusicalSymbol(new Barline()); barline.AddMusicalSymbol(new Note("D", 0, 5, MusicalSymbolDuration.Whole, NoteStemDirection.Down, NoteTieType.Stop, new List <NoteBeamType>() { NoteBeamType.Single })); barline.AddMusicalSymbol(new Note("E", 0, 4, MusicalSymbolDuration.Quarter, NoteStemDirection.Up, NoteTieType.Start, new List <NoteBeamType>() { NoteBeamType.Single }) { NumberOfDots = 1 }); barline.AddMusicalSymbol(new Barline()); //staff.AddMusicalSymbol(new Rest barline.AddMusicalSymbol(new Note("C", 0, 4, MusicalSymbolDuration.Half, NoteStemDirection.Up, NoteTieType.None, new List <NoteBeamType>() { NoteBeamType.Single })); barline.AddMusicalSymbol( new Note("E", 0, 4, MusicalSymbolDuration.Half, NoteStemDirection.Up, NoteTieType.None, new List <NoteBeamType>() { NoteBeamType.Single }) { IsChordElement = true }); barline.AddMusicalSymbol( new Note("G", 0, 4, MusicalSymbolDuration.Half, NoteStemDirection.Up, NoteTieType.None, new List <NoteBeamType>() { NoteBeamType.Single }) { IsChordElement = true }); barline.AddMusicalSymbol(new Barline()); resultStackPanel.Children.Add(barline); return(resultStackPanel); }
public void Visit(Barline barline) { incipitViewer.AddMusicalSymbol(new PSAMControlLibrary.Barline()); amountEights += 3; }