diff options
Diffstat (limited to 'lib/level.dart')
-rw-r--r-- | lib/level.dart | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/lib/level.dart b/lib/level.dart index 548a752..a6d4967 100644 --- a/lib/level.dart +++ b/lib/level.dart @@ -125,24 +125,13 @@ class _LevelState extends State<Level> { simfile = Simfile(simfilePath); simfile!.load(); - double bpm = simfile!.bpms.entries.first.value; - - for (final (measureIndex, measure) - in simfile!.chartSimplest!.measures!.indexed) { - for (final (noteIndex, noteData) in measure.indexed) { - int arrowIndex = noteData.indexOf('1'); - if (arrowIndex < 0 || arrowIndex > 3) { - continue; - } - double beat = - measureIndex * 4.0 + (noteIndex.toDouble() / measure.length) * 4.0; - double minutesPerBeat = 1.0 / bpm; - double offsetMinutes = simfile!.offset / 60.0; - notes.add(Note( - time: beat * minutesPerBeat + offsetMinutes, - direction: ArrowDirection.values[arrowIndex])); + simfile!.chartSimplest!.beats.forEach((time, noteData) { + int arrowIndex = noteData.indexOf('1'); + if (arrowIndex < 0 || arrowIndex > 3) { + return; } - } + notes.add(Note(time: time, direction: ArrowDirection.values[arrowIndex])); + }); print(audioPath); |