Browse Source

Use double-precision for time tick; Force bridge build without osc

tags/v1.9.11
falkTX 6 years ago
parent
commit
bf60778ad9
16 changed files with 62 additions and 60 deletions
  1. +2
    -2
      source/backend/CarlaEngine.hpp
  2. +2
    -2
      source/backend/CarlaStandalone.cpp
  3. +17
    -6
      source/backend/engine/CarlaEngine.cpp
  4. +0
    -6
      source/backend/engine/CarlaEngineBridge.cpp
  5. +1
    -1
      source/backend/engine/CarlaEngineData.cpp
  6. +6
    -6
      source/backend/engine/CarlaEngineInternal.cpp
  7. +5
    -3
      source/backend/engine/CarlaEngineInternal.hpp
  8. +2
    -1
      source/backend/engine/CarlaEngineNative.cpp
  9. +3
    -3
      source/backend/engine/CarlaEngineThread.cpp
  10. +14
    -14
      source/backend/plugin/CarlaPluginDSSI.cpp
  11. +1
    -2
      source/backend/plugin/CarlaPluginLV2.cpp
  12. +1
    -1
      source/backend/plugin/CarlaPluginVST2.cpp
  13. +2
    -7
      source/bridges-plugin/Makefile
  14. +2
    -2
      source/includes/CarlaNative.h
  15. +1
    -1
      source/libjack/libjack.cpp
  16. +3
    -3
      source/utils/CarlaBridgeDefines.hpp

+ 2
- 2
source/backend/CarlaEngine.hpp View File

@@ -280,8 +280,8 @@ struct CARLA_API EngineTimeInfoBBT {

int32_t bar; //!< current bar
int32_t beat; //!< current beat-within-bar
int32_t tick; //!< current tick-within-beat
double barStartTick;
double tick; //!< current tick-within-beat
double barStartTick;

float beatsPerBar; //!< time signature "numerator"
float beatType; //!< time signature "denominator"


+ 2
- 2
source/backend/CarlaStandalone.cpp View File

@@ -1797,7 +1797,7 @@ const char* carla_get_host_osc_url_tcp()
{
carla_debug("carla_get_host_osc_url_tcp()");

#ifdef HAVE_LIBLO
#if defined(HAVE_LIBLO) && !defined(BUILD_BRIDGE_ALTERNATIVE_ARCH)
if (gStandalone.engine == nullptr)
{
carla_stderr2("carla_get_host_osc_url_tcp() failed, engine is not running");
@@ -1815,7 +1815,7 @@ const char* carla_get_host_osc_url_udp()
{
carla_debug("carla_get_host_osc_url_udp()");

#ifdef HAVE_LIBLO
#if defined(HAVE_LIBLO) && !defined(BUILD_BRIDGE_ALTERNATIVE_ARCH)
if (gStandalone.engine == nullptr)
{
carla_stderr2("carla_get_host_osc_url_udp() failed, engine is not running");


+ 17
- 6
source/backend/engine/CarlaEngine.cpp View File

@@ -282,7 +282,7 @@ void CarlaEngine::idle() noexcept
}
}

#ifdef HAVE_LIBLO
#if defined(HAVE_LIBLO) && !defined(BUILD_BRIDGE_ALTERNATIVE_ARCH)
pData->osc.idle();
#endif
}
@@ -490,7 +490,9 @@ bool CarlaEngine::addPlugin(const BinaryType btype, const PluginType ptype,
}
else
{
#ifndef BUILD_BRIDGE
bool use16Outs;
#endif
setLastError("Invalid or unsupported plugin type");

switch (ptype)
@@ -498,10 +500,6 @@ bool CarlaEngine::addPlugin(const BinaryType btype, const PluginType ptype,
case PLUGIN_NONE:
break;

case PLUGIN_INTERNAL:
plugin = CarlaPlugin::newNative(initializer);
break;

case PLUGIN_LADSPA:
plugin = CarlaPlugin::newLADSPA(initializer, (const LADSPA_RDF_Descriptor*)extra);
break;
@@ -518,6 +516,11 @@ bool CarlaEngine::addPlugin(const BinaryType btype, const PluginType ptype,
plugin = CarlaPlugin::newVST2(initializer);
break;

#ifndef BUILD_BRIDGE
case PLUGIN_INTERNAL:
plugin = CarlaPlugin::newNative(initializer);
break;

case PLUGIN_SF2:
use16Outs = (extra != nullptr && std::strcmp((const char*)extra, "true") == 0);
plugin = CarlaPlugin::newFluidSynth(initializer, use16Outs);
@@ -530,6 +533,14 @@ bool CarlaEngine::addPlugin(const BinaryType btype, const PluginType ptype,
case PLUGIN_JACK:
plugin = CarlaPlugin::newJackApp(initializer);
break;
#else
case PLUGIN_INTERNAL:
case PLUGIN_SF2:
case PLUGIN_SFZ:
case PLUGIN_JACK:
setLastError("Plugin bridges cannot handle this binary");
break;
#endif
}
}

@@ -1620,7 +1631,7 @@ void CarlaEngine::setOption(const EngineOption option, const int value, const ch
}
}

#ifdef HAVE_LIBLO
#if defined(HAVE_LIBLO) && !defined(BUILD_BRIDGE_ALTERNATIVE_ARCH)
// -----------------------------------------------------------------------
// OSC Stuff



+ 0
- 6
source/backend/engine/CarlaEngineBridge.cpp View File

@@ -1405,12 +1405,6 @@ CarlaEngine* CarlaEngine::newBridge(const char* const audioPoolBaseName, const c

// -----------------------------------------------------------------------

#ifdef BUILD_BRIDGE_ALTERNATIVE_ARCH
CarlaPlugin* CarlaPlugin::newNative(const CarlaPlugin::Initializer&) { return nullptr; }
CarlaPlugin* CarlaPlugin::newFileSF2(const CarlaPlugin::Initializer&, const bool) { return nullptr; }
CarlaPlugin* CarlaPlugin::newFileSFZ(const CarlaPlugin::Initializer&) { return nullptr; }
#endif

CARLA_BACKEND_END_NAMESPACE

// -----------------------------------------------------------------------


+ 1
- 1
source/backend/engine/CarlaEngineData.cpp View File

@@ -297,7 +297,7 @@ EngineTimeInfoBBT::EngineTimeInfoBBT() noexcept
: valid(false),
bar(0),
beat(0),
tick(0),
tick(0.0),
barStartTick(0.0),
beatsPerBar(0.0f),
beatType(0.0f),


+ 6
- 6
source/backend/engine/CarlaEngineInternal.cpp View File

@@ -245,7 +245,7 @@ void EngineInternalTime::fillEngineTimeInfo(const uint32_t newFrames) noexcept

timeInfo.bbt.beatsPerBar = static_cast<float>(beatsPerBar);
timeInfo.bbt.beatsPerMinute = beatsPerMinute;
timeInfo.bbt.tick = static_cast<int32_t>(ticktmp);
timeInfo.bbt.tick = ticktmp;
tick = ticktmp;

if (transportMode == ENGINE_TRANSPORT_MODE_INTERNAL && timeInfo.playing)
@@ -322,7 +322,7 @@ void EngineInternalTime::fillJackTimeInfo(jack_position_t* const pos, const uint

pos->beats_per_bar = static_cast<float>(beatsPerBar);
pos->beats_per_minute = beatsPerMinute;
pos->tick = static_cast<int32_t>(ticktmp);
pos->tick = ticktmp;
tick = ticktmp;
}

@@ -418,7 +418,7 @@ void EngineNextAction::clearAndReset() noexcept

CarlaEngine::ProtectedData::ProtectedData(CarlaEngine* const engine) noexcept
: thread(engine),
#ifdef HAVE_LIBLO
#if defined(HAVE_LIBLO) && !defined(BUILD_BRIDGE_ALTERNATIVE_ARCH)
osc(engine),
oscData(nullptr),
#endif
@@ -473,7 +473,7 @@ CarlaEngine::ProtectedData::~ProtectedData() noexcept
bool CarlaEngine::ProtectedData::init(const char* const clientName)
{
CARLA_SAFE_ASSERT_RETURN_INTERNAL_ERR(name.isEmpty(), "Invalid engine internal data (err #1)");
#ifdef HAVE_LIBLO
#if defined(HAVE_LIBLO) && !defined(BUILD_BRIDGE_ALTERNATIVE_ARCH)
CARLA_SAFE_ASSERT_RETURN_INTERNAL_ERR(oscData == nullptr, "Invalid engine internal data (err #2)");
#endif
CARLA_SAFE_ASSERT_RETURN_INTERNAL_ERR(events.in == nullptr, "Invalid engine internal data (err #4)");
@@ -523,7 +523,7 @@ bool CarlaEngine::ProtectedData::init(const char* const clientName)

timeInfo.clear();

#ifdef HAVE_LIBLO
#if defined(HAVE_LIBLO) && !defined(BUILD_BRIDGE_ALTERNATIVE_ARCH)
osc.init(clientName);
# ifndef BUILD_BRIDGE
oscData = osc.getControlData();
@@ -554,7 +554,7 @@ void CarlaEngine::ProtectedData::close()
thread.stopThread(500);
nextAction.clearAndReset();

#ifdef HAVE_LIBLO
#if defined(HAVE_LIBLO) && !defined(BUILD_BRIDGE_ALTERNATIVE_ARCH)
osc.close();
oscData = nullptr;
#endif


+ 5
- 3
source/backend/engine/CarlaEngineInternal.hpp View File

@@ -18,11 +18,13 @@
#ifndef CARLA_ENGINE_INTERNAL_HPP_INCLUDED
#define CARLA_ENGINE_INTERNAL_HPP_INCLUDED

#include "CarlaEngineOsc.hpp"
#include "CarlaEngineThread.hpp"
#include "CarlaEngineUtils.hpp"

#include "hylia/hylia.h"
#ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH
# include "CarlaEngineOsc.hpp"
# include "hylia/hylia.h"
#endif

// FIXME only use CARLA_PREVENT_HEAP_ALLOCATION for structs
// maybe separate macro
@@ -207,7 +209,7 @@ struct EnginePluginData {
struct CarlaEngine::ProtectedData {
CarlaEngineThread thread;

#ifdef HAVE_LIBLO
#if defined(HAVE_LIBLO) && !defined(BUILD_BRIDGE_ALTERNATIVE_ARCH)
CarlaEngineOsc osc;
# ifdef BUILD_BRIDGE
CarlaOscData* oscData;


+ 2
- 1
source/backend/engine/CarlaEngineNative.cpp View File

@@ -1751,7 +1751,8 @@ protected:

if (timeInfo.bbt.valid)
{
std::sprintf(tmpBuf, P_UINT64 ":%i:%i:%i\n", timeInfo.frame, timeInfo.bbt.bar, timeInfo.bbt.beat, timeInfo.bbt.tick);
std::sprintf(tmpBuf, P_UINT64 ":%i:%i:%i\n",
timeInfo.frame, timeInfo.bbt.bar, timeInfo.bbt.beat, static_cast<int>(timeInfo.bbt.tick + 0.5));
if (! fUiServer.writeMessage(tmpBuf))
return;



+ 3
- 3
source/backend/engine/CarlaEngineThread.cpp View File

@@ -1,6 +1,6 @@
/*
* Carla Plugin Host
* Copyright (C) 2011-2014 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2011-2018 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -46,7 +46,7 @@ void CarlaEngineThread::run() noexcept
#endif
carla_debug("CarlaEngineThread::run()");

#ifdef HAVE_LIBLO
#if defined(HAVE_LIBLO) && !defined(BUILD_BRIDGE_ALTERNATIVE_ARCH)
const bool isPlugin(kEngine->getType() == kEngineTypePlugin);
#endif
float value;
@@ -63,7 +63,7 @@ void CarlaEngineThread::run() noexcept
const bool oscRegisted = false;
#endif

#ifdef HAVE_LIBLO
#if defined(HAVE_LIBLO) && !defined(BUILD_BRIDGE_ALTERNATIVE_ARCH)
if (isPlugin)
kEngine->idleOsc();
#endif


+ 14
- 14
source/backend/plugin/CarlaPluginDSSI.cpp View File

@@ -21,7 +21,7 @@
#include "CarlaDssiUtils.hpp"
#include "CarlaMathUtils.hpp"

#ifdef HAVE_LIBLO
#if defined(HAVE_LIBLO) && !defined(BUILD_BRIDGE_ALTERNATIVE_ARCH)
# include "CarlaOscUtils.hpp"
# include "CarlaPipeUtils.hpp"
# include "CarlaThread.hpp"
@@ -63,7 +63,7 @@ CARLA_BACKEND_START_NAMESPACE

static const CustomData kCustomDataFallback = { nullptr, nullptr, nullptr };

#ifdef HAVE_LIBLO
#if defined(HAVE_LIBLO) && !defined(BUILD_BRIDGE_ALTERNATIVE_ARCH)
// -------------------------------------------------------------------

class CarlaThreadDSSIUI : public CarlaThread
@@ -283,7 +283,7 @@ public:
fForcedStereoOut(false),
fNeedsFixedBuffers(false),
fUsesCustomData(false)
#ifdef HAVE_LIBLO
#if defined(HAVE_LIBLO) && !defined(BUILD_BRIDGE_ALTERNATIVE_ARCH)
, fOscData(),
fThreadUI(engine, this, fOscData),
fUiFilename(nullptr)
@@ -298,7 +298,7 @@ public:
{
carla_debug("CarlaPluginDSSI::~CarlaPluginDSSI()");

#ifdef HAVE_LIBLO
#if defined(HAVE_LIBLO) && !defined(BUILD_BRIDGE_ALTERNATIVE_ARCH)
// close UI
if (fUiFilename != nullptr)
{
@@ -594,7 +594,7 @@ public:
}
}

#ifdef HAVE_LIBLO
#if defined(HAVE_LIBLO) && !defined(BUILD_BRIDGE_ALTERNATIVE_ARCH)
if (sendGui && fOscData.target != nullptr)
osc_send_configure(fOscData, key, value);
#endif
@@ -632,7 +632,7 @@ public:
}
}

#if defined(HAVE_LIBLO) && ! defined(BUILD_BRIDGE)
#if defined(HAVE_LIBLO) && !defined(BUILD_BRIDGE)
const bool sendOsc(pData->engine->isOscControlRegistered());
#else
const bool sendOsc(false);
@@ -684,7 +684,7 @@ public:
}
}

#ifdef HAVE_LIBLO
#if defined(HAVE_LIBLO) && !defined(BUILD_BRIDGE_ALTERNATIVE_ARCH)
// -------------------------------------------------------------------
// Set ui stuff

@@ -1083,7 +1083,7 @@ public:
if (LADSPA_IS_HARD_RT_CAPABLE(fDescriptor->Properties))
pData->hints |= PLUGIN_IS_RTSAFE;

#ifdef HAVE_LIBLO
#if defined(HAVE_LIBLO) && !defined(BUILD_BRIDGE_ALTERNATIVE_ARCH)
if (fUiFilename != nullptr)
pData->hints |= PLUGIN_HAS_CUSTOM_UI;
#endif
@@ -1219,7 +1219,7 @@ public:
}
}

#if defined(HAVE_LIBLO) && ! defined(BUILD_BRIDGE)
#if defined(HAVE_LIBLO) && !defined(BUILD_BRIDGE)
// Update OSC Names
if (pData->engine->isOscControlRegistered() && pData->id < pData->engine->getCurrentPluginCount())
{
@@ -2185,7 +2185,7 @@ public:
carla_debug("CarlaPluginDSSI::clearBuffers() - end");
}

#ifdef HAVE_LIBLO
#if defined(HAVE_LIBLO) && !defined(BUILD_BRIDGE_ALTERNATIVE_ARCH)
// -------------------------------------------------------------------
// OSC stuff

@@ -2444,7 +2444,7 @@ public:
osc_send_midi(fOscData, midiData);
#endif
}
#endif // HAVE_LIBLO
#endif // HAVE_LIBLO && !BUILD_BRIDGE_ALTERNATIVE_ARCH

// -------------------------------------------------------------------

@@ -2453,7 +2453,7 @@ public:
return fDssiDescriptor;
}

#ifdef HAVE_LIBLO
#if defined(HAVE_LIBLO) && !defined(BUILD_BRIDGE_ALTERNATIVE_ARCH)
uintptr_t getUiBridgeProcessId() const noexcept override
{
return fThreadUI.getProcessId();
@@ -2653,7 +2653,7 @@ public:
}
}

#ifdef HAVE_LIBLO
#if defined(HAVE_LIBLO) && !defined(BUILD_BRIDGE_ALTERNATIVE_ARCH)
// ---------------------------------------------------------------
// check for gui

@@ -2719,7 +2719,7 @@ private:
bool fNeedsFixedBuffers;
bool fUsesCustomData;

#ifdef HAVE_LIBLO
#if defined(HAVE_LIBLO) && !defined(BUILD_BRIDGE_ALTERNATIVE_ARCH)
CarlaOscData fOscData;
CarlaThreadDSSIUI fThreadUI;
const char* fUiFilename;


+ 1
- 2
source/backend/plugin/CarlaPluginLV2.cpp View File

@@ -30,7 +30,6 @@
#include "CarlaPluginUI.hpp"
#include "Lv2AtomRingBuffer.hpp"

#include "../engine/CarlaEngineOsc.hpp"
#include "../modules/lilv/config/lilv_config.h"

extern "C" {
@@ -2804,7 +2803,7 @@ public:
int32_t rindex;

const double barBeat = static_cast<double>(timeInfo.bbt.beat - 1)
+ (static_cast<double>(timeInfo.bbt.tick) / timeInfo.bbt.ticksPerBeat);
+ (timeInfo.bbt.tick / timeInfo.bbt.ticksPerBeat);

// update input ports
for (uint32_t k=0; k < pData->param.count; ++k)


+ 1
- 1
source/backend/plugin/CarlaPluginVST2.cpp View File

@@ -1140,7 +1140,7 @@ public:

const double ppqBar = double(timeInfo.bbt.bar - 1) * timeInfo.bbt.beatsPerBar;
const double ppqBeat = double(timeInfo.bbt.beat - 1);
const double ppqTick = double(timeInfo.bbt.tick) / timeInfo.bbt.ticksPerBeat;
const double ppqTick = timeInfo.bbt.tick / timeInfo.bbt.ticksPerBeat;

// PPQ Pos
fTimeInfo.ppqPos = ppqBar + ppqBeat + ppqTick;


+ 2
- 7
source/bridges-plugin/Makefile View File

@@ -24,7 +24,6 @@ endif

BUILD_CXX_FLAGS += -DBUILD_BRIDGE -I. -I$(CWD) -I$(CWD)/backend -I$(CWD)/includes -I$(CWD)/modules -I$(CWD)/utils
BUILD_CXX_FLAGS += -I$(CWD)/backend/engine -I$(CWD)/backend/plugin
BUILD_CXX_FLAGS += $(LIBLO_FLAGS)

32BIT_FLAGS += -DBUILD_BRIDGE_ALTERNATIVE_ARCH
64BIT_FLAGS += -DBUILD_BRIDGE_ALTERNATIVE_ARCH
@@ -64,13 +63,12 @@ LIBS_win32 += $(MODULEDIR)/water.win32.a
LIBS_win64 += $(MODULEDIR)/water.win64.a
LINK_FLAGS += $(WATER_LIBS)

LINK_FLAGS += $(LIBLO_LIBS)
LINK_FLAGS += $(X11_LIBS)

# ----------------------------------------------------------------------------------------------------------------------

NATIVE_BUILD_FLAGS = $(NATIVE_PLUGINS_FLAGS)
NATIVE_LINK_FLAGS =
NATIVE_BUILD_FLAGS = $(NATIVE_PLUGINS_FLAGS) $(LIBLO_FLAGS)
NATIVE_LINK_FLAGS = $(LIBLO_LIBS)

NATIVE_BUILD_FLAGS += $(FLUIDSYNTH_FLAGS)
NATIVE_LINK_FLAGS += $(FLUIDSYNTH_LIBS)
@@ -126,8 +124,6 @@ OBJS_arch = \
$(OBJDIR)/CarlaEngineClient.cpp.arch.o \
$(OBJDIR)/CarlaEngineData.cpp.arch.o \
$(OBJDIR)/CarlaEngineInternal.cpp.arch.o \
$(OBJDIR)/CarlaEngineOsc.cpp.arch.o \
$(OBJDIR)/CarlaEngineOscSend.cpp.arch.o \
$(OBJDIR)/CarlaEnginePorts.cpp.arch.o \
$(OBJDIR)/CarlaEngineThread.cpp.arch.o \
$(OBJDIR)/CarlaEngineJack.cpp.arch.o \
@@ -135,7 +131,6 @@ OBJS_arch = \
$(OBJDIR)/CarlaPlugin.cpp.arch.o \
$(OBJDIR)/CarlaPluginBridge.cpp.arch.o \
$(OBJDIR)/CarlaPluginInternal.cpp.arch.o \
$(OBJDIR)/CarlaPluginJack.cpp.arch.o \
$(OBJDIR)/CarlaPluginLADSPA.cpp.arch.o \
$(OBJDIR)/CarlaPluginDSSI.cpp.arch.o \
$(OBJDIR)/CarlaPluginLV2.cpp.arch.o \


+ 2
- 2
source/includes/CarlaNative.h View File

@@ -157,8 +157,8 @@ typedef struct {

int32_t bar; /** current bar */
int32_t beat; /** current beat-within-bar */
int32_t tick; /** current tick-within-beat */
double barStartTick;
double tick; /** current tick-within-beat */
double barStartTick;

float beatsPerBar; /** time signature "numerator" */
float beatType; /** time signature "denominator" */


+ 1
- 1
source/libjack/libjack.cpp View File

@@ -602,7 +602,7 @@ bool CarlaJackAppClient::handleRtData()

fServer.position.bar = bridgeTimeInfo.bar;
fServer.position.beat = bridgeTimeInfo.beat;
fServer.position.tick = bridgeTimeInfo.tick;
fServer.position.tick = static_cast<int32_t>(bridgeTimeInfo.tick + 0.5);

fServer.position.beats_per_bar = bridgeTimeInfo.beatsPerBar;
fServer.position.beat_type = bridgeTimeInfo.beatType;


+ 3
- 3
source/utils/CarlaBridgeDefines.hpp View File

@@ -20,7 +20,7 @@

#include "CarlaRingBuffer.hpp"

#define CARLA_PLUGIN_BRIDGE_API_VERSION 3
#define CARLA_PLUGIN_BRIDGE_API_VERSION 4

// -------------------------------------------------------------------------------------------------------------------

@@ -141,9 +141,9 @@ struct BridgeTimeInfo {
uint64_t usecs;
uint32_t validFlags;
// bbt
int32_t bar, beat, tick;
int32_t bar, beat;
float beatsPerBar, beatType;
double barStartTick, ticksPerBeat, beatsPerMinute;
double tick, barStartTick, ticksPerBeat, beatsPerMinute;
};

// -------------------------------------------------------------------------------------------------------------------


Loading…
Cancel
Save