comparison ringtools/imy/durations.c @ 882:fd4c9bc7835d

fc-imy2pwt program written, compiles
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 03 Apr 2022 03:30:27 +0000
parents
children
comparison
equal deleted inserted replaced
881:bb8ad7c0cee8 882:fd4c9bc7835d
1 /*
2 * This module implements the step of precomputing various note durations
3 * in TDMA frames.
4 */
5
6 extern unsigned beats_per_min;
7 unsigned tdma_durations[6][4];
8
9 static float modifier_values[4] = {1.0f, 1.5f, 1.75f, 2.0f / 3.0f};
10
11 compute_note_durations()
12 {
13 float beat_ref, basic_ms[6], dur_ms;
14 unsigned dur_tdma;
15 int i, j;
16
17 beat_ref = 60000.0f / beats_per_min;
18 basic_ms[0] = beat_ref * 4.0f;
19 basic_ms[1] = beat_ref * 2.0f;
20 basic_ms[2] = beat_ref;
21 basic_ms[3] = beat_ref / 2.0f;
22 basic_ms[4] = beat_ref / 4.0f;
23 basic_ms[5] = beat_ref / 8.0f;
24 for (i = 0; i < 6; i++) {
25 for (j = 0; j < 4; j++) {
26 dur_ms = basic_ms[i] * modifier_values[j];
27 dur_tdma = dur_ms * 13.0f / 60.0f + 0.5f;
28 tdma_durations[i][j] = dur_tdma;
29 }
30 }
31 }