From ebcaffd19f73e9ad2051e1a62c7a0aa49041a347 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sun, 18 Jun 2023 23:00:42 +0200 Subject: [PATCH] VST3, Lua: fix barPositionMusic "last bar start position, in quarter notes", starts at zero to match projectTimeMusic. --- libs/ardour/luaproc.cc | 2 +- libs/ardour/vst3_plugin.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/ardour/luaproc.cc b/libs/ardour/luaproc.cc index 0b84686ffe..4fc0af6964 100644 --- a/libs/ardour/luaproc.cc +++ b/libs/ardour/luaproc.cc @@ -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 (); diff --git a/libs/ardour/vst3_plugin.cc b/libs/ardour/vst3_plugin.cc index cc47c3324e..3dca859f9b 100644 --- a/libs/ardour/vst3_plugin.cc +++ b/libs/ardour/vst3_plugin.cc @@ -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 ();