Browse Source

MSVC compat for internal engine details

Signed-off-by: falkTX <falktx@falktx.com>
pull/1775/head
falkTX 1 year ago
parent
commit
08d9645747
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
4 changed files with 36 additions and 50 deletions
  1. +15
    -7
      source/backend/engine/CarlaEngineInternal.cpp
  2. +19
    -19
      source/backend/plugin/CarlaPluginCLAP.cpp
  3. +0
    -22
      source/includes/dssi/seq_event-compat.h
  4. +2
    -2
      source/utils/CarlaClapUtils.hpp

+ 15
- 7
source/backend/engine/CarlaEngineInternal.cpp View File

@@ -22,7 +22,13 @@
#include "jackbridge/JackBridge.hpp"

#include <ctime>
#include <sys/time.h>

#ifdef _MSC_VER
# include <sys/timeb.h>
# include <sys/types.h>
#else
# include <sys/time.h>
#endif

CARLA_BACKEND_START_NAMESPACE

@@ -696,19 +702,21 @@ void CarlaEngine::ProtectedData::doNextPluginAction() noexcept

static int64_t getTimeInMicroseconds() noexcept
{
#if defined(CARLA_OS_MAC) || defined(CARLA_OS_WIN)
#if defined(_MSC_VER)
struct _timeb tb;
_ftime_s (&tb);
return ((int64) tb.time) * 1000 + tb.millitm;
#elif defined(CARLA_OS_MAC) || defined(CARLA_OS_WIN)
struct timeval tv;
gettimeofday(&tv, nullptr);

return (tv.tv_sec * 1000000) + tv.tv_usec;
#else
struct timespec ts;
# ifdef CLOCK_MONOTONIC_RAW
#ifdef CLOCK_MONOTONIC_RAW
clock_gettime(CLOCK_MONOTONIC_RAW, &ts);
# else
#else
clock_gettime(CLOCK_MONOTONIC, &ts);
# endif

#endif
return (ts.tv_sec * 1000000) + (ts.tv_nsec / 1000);
#endif
}


+ 19
- 19
source/backend/plugin/CarlaPluginCLAP.cpp View File

@@ -226,7 +226,7 @@ struct carla_clap_host : clap_host_t {
#endif
}

static CLAP_ABI const void* carla_get_extension(const clap_host_t* const host, const char* const extension_id)
static const void* CLAP_ABI carla_get_extension(const clap_host_t* const host, const char* const extension_id)
{
carla_clap_host* const self = static_cast<carla_clap_host*>(host->host_data);

@@ -249,80 +249,80 @@ struct carla_clap_host : clap_host_t {
return nullptr;
}

static CLAP_ABI void carla_request_restart(const clap_host_t* const host)
static void CLAP_ABI carla_request_restart(const clap_host_t* const host)
{
static_cast<const carla_clap_host*>(host->host_data)->hostCallbacks->clapRequestRestart();
}

static CLAP_ABI void carla_request_process(const clap_host_t* const host)
static void CLAP_ABI carla_request_process(const clap_host_t* const host)
{
static_cast<const carla_clap_host*>(host->host_data)->hostCallbacks->clapRequestProcess();
}

static CLAP_ABI void carla_request_callback(const clap_host_t* const host)
static void CLAP_ABI carla_request_callback(const clap_host_t* const host)
{
static_cast<const carla_clap_host*>(host->host_data)->hostCallbacks->clapRequestCallback();
}

static CLAP_ABI void carla_latency_changed(const clap_host_t* const host)
static void CLAP_ABI carla_latency_changed(const clap_host_t* const host)
{
static_cast<const carla_clap_host*>(host->host_data)->hostCallbacks->clapLatencyChanged();
}

static CLAP_ABI void carla_mark_dirty(const clap_host_t* const host)
static void CLAP_ABI carla_mark_dirty(const clap_host_t* const host)
{
static_cast<const carla_clap_host*>(host->host_data)->hostCallbacks->clapMarkDirty();
}

#ifdef CLAP_WINDOW_API_NATIVE
static CLAP_ABI void carla_resize_hints_changed(const clap_host_t* const host)
static void CLAP_ABI carla_resize_hints_changed(const clap_host_t* const host)
{
static_cast<const carla_clap_host*>(host->host_data)->hostCallbacks->clapGuiResizeHintsChanged();
}

static CLAP_ABI bool carla_request_resize(const clap_host_t* const host, const uint32_t width, const uint32_t height)
static bool CLAP_ABI carla_request_resize(const clap_host_t* const host, const uint32_t width, const uint32_t height)
{
return static_cast<const carla_clap_host*>(host->host_data)->hostCallbacks->clapGuiRequestResize(width, height);
}

static CLAP_ABI bool carla_request_show(const clap_host_t* const host)
static bool CLAP_ABI carla_request_show(const clap_host_t* const host)
{
return static_cast<const carla_clap_host*>(host->host_data)->hostCallbacks->clapGuiRequestShow();
}

static CLAP_ABI bool carla_request_hide(const clap_host_t* const host)
static bool CLAP_ABI carla_request_hide(const clap_host_t* const host)
{
return static_cast<const carla_clap_host*>(host->host_data)->hostCallbacks->clapGuiRequestHide();
}

static CLAP_ABI void carla_closed(const clap_host_t* const host, bool was_destroyed)
static void CLAP_ABI carla_closed(const clap_host_t* const host, bool was_destroyed)
{
static_cast<const carla_clap_host*>(host->host_data)->hostCallbacks->clapGuiClosed(was_destroyed);
}

#ifdef _POSIX_VERSION
static CLAP_ABI bool carla_register_fd(const clap_host_t* const host, const int fd, const clap_posix_fd_flags_t flags)
static bool CLAP_ABI carla_register_fd(const clap_host_t* const host, const int fd, const clap_posix_fd_flags_t flags)
{
return static_cast<const carla_clap_host*>(host->host_data)->hostCallbacks->clapRegisterPosixFD(fd, flags);
}

static CLAP_ABI bool carla_modify_fd(const clap_host_t* const host, const int fd, const clap_posix_fd_flags_t flags)
static bool CLAP_ABI carla_modify_fd(const clap_host_t* const host, const int fd, const clap_posix_fd_flags_t flags)
{
return static_cast<const carla_clap_host*>(host->host_data)->hostCallbacks->clapModifyPosixFD(fd, flags);
}

static CLAP_ABI bool carla_unregister_fd(const clap_host_t* const host, const int fd)
static bool CLAP_ABI carla_unregister_fd(const clap_host_t* const host, const int fd)
{
return static_cast<const carla_clap_host*>(host->host_data)->hostCallbacks->clapUnregisterPosixFD(fd);
}
#endif

static CLAP_ABI bool carla_register_timer(const clap_host_t* const host, const uint32_t period_ms, clap_id* const timer_id)
static bool CLAP_ABI carla_register_timer(const clap_host_t* const host, const uint32_t period_ms, clap_id* const timer_id)
{
return static_cast<const carla_clap_host*>(host->host_data)->hostCallbacks->clapRegisterTimer(period_ms, timer_id);
}

static CLAP_ABI bool carla_unregister_timer(const clap_host_t* const host, const clap_id timer_id)
static bool CLAP_ABI carla_unregister_timer(const clap_host_t* const host, const clap_id timer_id)
{
return static_cast<const carla_clap_host*>(host->host_data)->hostCallbacks->clapUnregisterTimer(timer_id);
}
@@ -605,12 +605,12 @@ struct carla_clap_input_events : clap_input_events_t, CarlaPluginClapEventData {
};
}

static CLAP_ABI uint32_t carla_size(const clap_input_events_t* const list) noexcept
static uint32_t CLAP_ABI carla_size(const clap_input_events_t* const list) noexcept
{
return static_cast<const carla_clap_input_events*>(list->ctx)->numEventsUsed;
}

static CLAP_ABI const clap_event_header_t* carla_get(const clap_input_events_t* const list, const uint32_t index) noexcept
static const clap_event_header_t* CLAP_ABI carla_get(const clap_input_events_t* const list, const uint32_t index) noexcept
{
return &static_cast<const carla_clap_input_events*>(list->ctx)->events[index].header;
}
@@ -693,7 +693,7 @@ struct carla_clap_output_events : clap_output_events_t, CarlaPluginClapEventData
return true;
}

static CLAP_ABI bool carla_try_push(const clap_output_events_t* const list, const clap_event_header_t* const event)
static bool CLAP_ABI carla_try_push(const clap_output_events_t* const list, const clap_event_header_t* const event)
{
return static_cast<carla_clap_output_events*>(list->ctx)->tryPush(event);
}


+ 0
- 22
source/includes/dssi/seq_event-compat.h View File

@@ -137,21 +137,6 @@ enum snd_seq_event_type {
/** user-defined event; event data type = any (fixed size) */
SND_SEQ_EVENT_USR9,

/** system exclusive data (variable length); event data type = #snd_seq_ev_ext_t */
SND_SEQ_EVENT_SYSEX = 130,
/** error event; event data type = #snd_seq_ev_ext_t */
SND_SEQ_EVENT_BOUNCE,
/** reserved for user apps; event data type = #snd_seq_ev_ext_t */
SND_SEQ_EVENT_USR_VAR0 = 135,
/** reserved for user apps; event data type = #snd_seq_ev_ext_t */
SND_SEQ_EVENT_USR_VAR1,
/** reserved for user apps; event data type = #snd_seq_ev_ext_t */
SND_SEQ_EVENT_USR_VAR2,
/** reserved for user apps; event data type = #snd_seq_ev_ext_t */
SND_SEQ_EVENT_USR_VAR3,
/** reserved for user apps; event data type = #snd_seq_ev_ext_t */
SND_SEQ_EVENT_USR_VAR4,

/** NOP; ignored in any case */
SND_SEQ_EVENT_NONE = 255
};
@@ -210,12 +195,6 @@ typedef struct snd_seq_ev_raw32 {
unsigned int d[3]; /**< 32 bit value */
} snd_seq_ev_raw32_t;

/** external stored data */
typedef struct snd_seq_ev_ext {
unsigned int len; /**< length of data */
void *ptr; /**< pointer to data (note: can be 64-bit) */
} __attribute__((packed)) snd_seq_ev_ext_t;

/** Result events */
typedef struct snd_seq_result {
int event; /**< processed event type */
@@ -259,7 +238,6 @@ typedef struct snd_seq_event {
snd_seq_ev_ctrl_t control; /**< MIDI control information */
snd_seq_ev_raw8_t raw8; /**< raw8 data */
snd_seq_ev_raw32_t raw32; /**< raw32 data */
snd_seq_ev_ext_t ext; /**< external data */
snd_seq_ev_queue_control_t queue; /**< queue control */
snd_seq_timestamp_t time; /**< timestamp */
snd_seq_addr_t addr; /**< address */


+ 2
- 2
source/utils/CarlaClapUtils.hpp View File

@@ -167,7 +167,7 @@ struct clap_istream_impl : clap_istream_t {
read = read_impl;
}

static CLAP_ABI int64_t read_impl(const clap_istream_t* const stream, void* const buffer, const uint64_t size) noexcept
static int64_t CLAP_ABI read_impl(const clap_istream_t* const stream, void* const buffer, const uint64_t size) noexcept
{
clap_istream_impl* const self = static_cast<clap_istream_impl*>(stream->ctx);

@@ -196,7 +196,7 @@ struct clap_ostream_impl : clap_ostream_t {
write = write_impl;
}

static CLAP_ABI int64_t write_impl(const clap_ostream* const stream, const void* const buffer, const uint64_t size) noexcept
static int64_t CLAP_ABI write_impl(const clap_ostream* const stream, const void* const buffer, const uint64_t size) noexcept
{
CARLA_SAFE_ASSERT_RETURN(size != 0, 0);



Loading…
Cancel
Save