public static FrameOptions GetIntervallTime(int optionNumber) { double timeDuration = MusicalStorage.SongDurationInMS(); double physDuration = MusicalStorage.CalculateSongDuration(); double delta = physDuration / timeDuration; if (optionNumber == 0) { double interval = 1.0 / delta; var options = new FrameOptions(); options.frameInterval = interval; options.numberOfPixels = 1; return(options); } else if (optionNumber == 1) { var options = new FrameOptions(); options.frameInterval = 1; options.numberOfPixels = delta; return(options); } else { throw new Exception("invalid optionNumber"); } }
private static Song GetSongModel() { var song = new Song(); song.SongTitle = SongTitle; song.BPM = BpmValue; song.SongDuration = MusicalStorage.SongDurationInMS(); song.Notation = new List <INote>(); int beatCounter = -1; //2 strokes in the beginning, but we want to start with value 1 double strokeCounter = 0; foreach (var musicalNote in MusicalStorage.Melodie) { if (musicalNote is MusicalNote_Stroke) { beatCounter++; if (strokeCounter >= 4) { strokeCounter -= 4; } } else if (musicalNote is MusicalNote_Chord) { var chord = musicalNote as MusicalNote_Chord; var notationChord = new Chord(); notationChord.ID = chord.NoteID; notationChord.Duration = chord.GetMusicalDuration(); notationChord.BeatNumber = beatCounter; notationChord.StrokeNumber = strokeCounter; notationChord.Name = chord.ChordName; song.Notation.Add(new INote(notationChord)); strokeCounter += notationChord.Duration; } else { var notationNote = new Note(); notationNote.ID = musicalNote.NoteID; notationNote.Name = MusicalCalculator.GetNameFromPosition(ClassicalGuitar.ObjToEnum(musicalNote.StringOfNote), musicalNote.NoteValue); notationNote.Duration = musicalNote.GetMusicalDuration(); notationNote.BeatNumber = beatCounter; notationNote.StrokeNumber = strokeCounter; song.Notation.Add(new INote(notationNote)); strokeCounter += notationNote.Duration; } } return(song); }