diff --git a/c++/carla-backend/Makefile b/c++/carla-backend/Makefile index 6b4805e..34e5029 100644 --- a/c++/carla-backend/Makefile +++ b/c++/carla-backend/Makefile @@ -71,7 +71,6 @@ OBJS = \ carla_shared.o \ carla_threads.o \ ladspa.o dssi.o lv2.o vst.o fluidsynth.o linuxsampler.o \ - ../carla-jackbridge/carla_jackbridge.o \ ../carla-lilv/carla_lilv.a \ ../carla-rtmempool/carla_rtmempool.a diff --git a/c++/carla-backend/Makefile.dbg b/c++/carla-backend/Makefile.dbg index eb5ed94..d0052a2 100644 --- a/c++/carla-backend/Makefile.dbg +++ b/c++/carla-backend/Makefile.dbg @@ -71,7 +71,6 @@ OBJS = \ carla_shared.o \ carla_threads.o \ ladspa.o dssi.o lv2.o vst.o fluidsynth.o linuxsampler.o \ - ../carla-jackbridge/carla_jackbridge.o \ ../carla-lilv/carla_lilv.a \ ../carla-rtmempool/carla_rtmempool.a diff --git a/c++/carla-backend/lv2.cpp b/c++/carla-backend/lv2.cpp index e846fda..64e83bf 100644 --- a/c++/carla-backend/lv2.cpp +++ b/c++/carla-backend/lv2.cpp @@ -2374,10 +2374,10 @@ public: break; case LV2_PORT_DESIGNATION_TIME_BAR_BEAT: if (timeInfo->valid & CarlaEngineTimeBBT) - setParameterValue(k, timeInfo->bbt.beat - 1 + (timeInfo->bbt.tick / timeInfo->bbt.ticks_per_beat), false, false, false); + setParameterValue(k, float(timeInfo->bbt.beat - 1) + (float(timeInfo->bbt.tick) / timeInfo->bbt.ticks_per_beat), false, false, false); break; case LV2_PORT_DESIGNATION_TIME_BEAT: - if (timeInfo->valid & CarlaEngineTimeBBT) // FIXME: -1 ? + if (timeInfo->valid & CarlaEngineTimeBBT) setParameterValue(k, timeInfo->bbt.beat - 1, false, false, false); break; case LV2_PORT_DESIGNATION_TIME_BEAT_UNIT: diff --git a/c++/carla-backend/vst.cpp b/c++/carla-backend/vst.cpp index 230f370..3163984 100644 --- a/c++/carla-backend/vst.cpp +++ b/c++/carla-backend/vst.cpp @@ -66,6 +66,8 @@ public: isProcessing = false; needIdle = false; + vstTimeOffset = 0; + memset(midiEvents, 0, sizeof(VstMidiEvent)*MAX_MIDI_EVENTS*2); for (unsigned short i=0; i < MAX_MIDI_EVENTS*2; i++) @@ -842,6 +844,8 @@ public: uint32_t i, k; uint32_t midiEventCount = 0; + vstTimeOffset = framesOffset; + double aInsPeak[2] = { 0.0 }; double aOutsPeak[2] = { 0.0 }; @@ -1420,7 +1424,7 @@ public: void handleAudioMasterAutomate(const uint32_t index, const double value) { //CARLA_ASSERT(m_enabled); - CARLA_ASSERT(index < param.count); + //CARLA_ASSERT(index < param.count); if (index >= param.count /*|| ! m_enabled*/) return; @@ -1464,7 +1468,7 @@ public: if (timeInfo->playing) vstTimeInfo.flags |= kVstTransportPlaying; - //vstTimeInfo.samplePos = timeInfo->frame; // FIXME - currentSamplePosition ? + vstTimeInfo.samplePos = timeInfo->frame + vstTimeOffset; vstTimeInfo.sampleRate = x_engine->getSampleRate(); vstTimeInfo.nanoSeconds = timeInfo->time; @@ -1472,12 +1476,12 @@ public: if (timeInfo->valid & CarlaEngineTimeBBT) { - double ppqBar = double(timeInfo->bbt.bar) * timeInfo->bbt.beats_per_bar - timeInfo->bbt.beats_per_bar; - double ppqBeat = double(timeInfo->bbt.beat) - 1.0; + double ppqBar = double(timeInfo->bbt.bar - 1) * timeInfo->bbt.beats_per_bar; + double ppqBeat = double(timeInfo->bbt.beat - 1); double ppqTick = double(timeInfo->bbt.tick) / timeInfo->bbt.ticks_per_beat; // Bars - vstTimeInfo.barStartPos = ppqBar + ppqBeat; + vstTimeInfo.barStartPos = ppqBar; vstTimeInfo.flags |= kVstBarsValid; // PPQ Pos @@ -2265,7 +2269,9 @@ private: intptr_t reserved; VstEvent* data[MAX_MIDI_EVENTS*2]; } events; - VstMidiEvent midiEvents[MAX_MIDI_EVENTS*2]; + VstMidiEvent midiEvents[MAX_MIDI_EVENTS*2]; + + uint32_t vstTimeOffset; VstTimeInfo_R vstTimeInfo; struct { diff --git a/c++/carla-jackbridge/carla_jackbridge.cpp b/c++/carla-jackbridge/carla_jackbridge.cpp index 6ce8da2..9f1c475 100644 --- a/c++/carla-jackbridge/carla_jackbridge.cpp +++ b/c++/carla-jackbridge/carla_jackbridge.cpp @@ -15,11 +15,6 @@ * For a full copy of the GNU General Public License see the COPYING file */ -#ifndef JACKBRIDGE_DUMMY -# include -# include -#endif - #include "carla_jackbridge.h" jack_client_t* jackbridge_client_open(const char* client_name, jack_options_t options, jack_status_t* status) diff --git a/c++/carla-jackbridge/carla_jackbridge.h b/c++/carla-jackbridge/carla_jackbridge.h index 29f7a2f..613ab24 100644 --- a/c++/carla-jackbridge/carla_jackbridge.h +++ b/c++/carla-jackbridge/carla_jackbridge.h @@ -20,8 +20,9 @@ #include "carla_includes.h" -#include -#include // needed for JACK1 +#include +#include +#include #ifdef BUILD_BRIDGE