Skip to content

Commit

Permalink
Audio countdown feedback (#1192)
Browse files Browse the repository at this point in the history
* Don't just skip 1 number when counting down

* Add more countdown feedback

Add a countdown feedback trigger at 2x time until we're past halfway
the original time.
i.e a 10min countdown will have triggers at 4m 2m, 1m, 30s, 15s, 10s 5s, 4s, 3s, 2s 1s
  • Loading branch information
Emilv2 authored Aug 31, 2024
1 parent fd88a6d commit 742b166
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion app/src/main/org/runnerup/workout/WorkoutBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ private static void createAudioCountdown(Step step) {
case TIME:
// seconds
Double[] tmp0 = {
60d, 30d, 10d, 5d, 3d, 2d, 1d
60d, 30d, 10d, 5d, 4d, 3d, 2d, 1d
};
list.addAll(Arrays.asList(tmp0));
break;
Expand All @@ -536,6 +536,11 @@ private static void createAudioCountdown(Step step) {
return;
}

// Extent the feedback list with more values for longer countdowns
while (step.getDurationValue() / 2 > list.get(0)) {
list.add(0, list.get(0) * 2d);
}

// Remove all values in list close to the step
while (list.size() > 0 && step.getDurationValue() < list.get(0) * 1.1d) {
list.remove(0);
Expand Down

0 comments on commit 742b166

Please sign in to comment.