VST3, Lua: fix barPositionMusic

"last bar start position, in quarter notes", starts at zero
to match projectTimeMusic.
This commit is contained in:
Robin Gareus 2023-06-18 23:00:42 +02:00
parent 34789ff22f
commit ebcaffd19f
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
2 changed files with 2 additions and 2 deletions

View File

@ -718,7 +718,7 @@ LuaProc::connect_and_run (BufferSet& bufs,
lua_time["musicTime"] = DoubleableBeats (metric.tempo ().quarters_at_sample (start)).to_double ();
lua_time["musicTimeEnd"] = DoubleableBeats (metric_end.tempo ().quarters_at_sample (end)).to_double ();
lua_time["barPositionMusic"] = bbt.bars * 4;
lua_time["barPositionMusic"] = (bbt.bars - 1) * 4;
lua_time["timeSigNumerator"] = metric.meter ().divisions_per_bar ();
lua_time["timeSigDenominator"] = metric.meter ().note_value ();

View File

@ -725,7 +725,7 @@ VST3Plugin::connect_and_run (BufferSet& bufs,
context.timeSigNumerator = metric.meter ().divisions_per_bar ();
context.timeSigDenominator = metric.meter ().note_value ();
context.projectTimeMusic = DoubleableBeats (metric.tempo ().quarters_at_sample (start)).to_double ();
context.barPositionMusic = bbt.bars * 4; // PPQN, NOT tmap.metric_at(bbt).meter().divisions_per_bar()
context.barPositionMusic = (bbt.bars - 1) * 4; // PPQN, NOT tmap.metric_at(bbt).meter().divisions_per_bar()
}
const double tcfps = _session.timecode_frames_per_second ();