jcsteh/osara

OSARA incorrectly reports ticks if the time signature denominator isn't 4

jcsteh opened this issue · 1 comments

This confused the hell out of me until I figured out what was going on.

STR:

  1. Open a new project.
  2. In Project Settings, set the time signature to 6/8.
  3. Insert a MIDI item.
  4. Set the grid to 16th and insertion length to grid.
  5. Insert a note.
  6. Press left arrow then down arrow to get OSARA to report the note.
    • Expected: The length should be 240 ticks.
    • Actual: The length is 480 ticks.
  7. Press control+f2 to open properties.
  8. Check the length. Observe that it is 0.0.240.
  9. Press alt+shift+rightArrow to move right by grid.
    • Expected: OSARA should report 240 ticks.
    • Actual: OSARA reports 480 ticks.

I think the problem is that we assume that ppq is ticks per beat, but it's actually ticks per quarter. We need to take the time signature denominator into account. TimeMap2_timeToBeats does provide this info; we just don't use it. We'll probably need to pass this into various time reporting functions.

As a side note, strictly speaking, we're using the term "beats" incorrectly with respect to 6/8. In 6/8, there are two beats per bar, with a beat being a dotted quarter note. The 6 eighth notes per measure are called pulses. But I think REAPER also gets this wrong and goes a step further in that BPM seems to actually be quarter notes per minute, rather than beats per minute. I think most other DAWs have a similarly incorrect definition. Gotta love the fact that DAWs don't follow music theory.