Browse Source

Run MacOS event loop in plugin bridges

tags/1.9.8
falkTX 7 years ago
parent
commit
a5fcdedbe4
2 changed files with 47 additions and 21 deletions
  1. +22
    -19
      source/bridges-plugin/Makefile
  2. +25
    -2
      source/utils/CarlaMainLoop.hpp

+ 22
- 19
source/bridges-plugin/Makefile View File

@@ -206,44 +206,47 @@ $(BINDIR)/$(MODULENAME)-win64.exe: $(OBJS_win64) $(LIBS_win64)
# ----------------------------------------------------------------------------------------------------------------------
# native

$(OBJDIR)/CarlaBridgeLV2.cpp.o: CarlaBridgeLV2.cpp
ifeq ($(MACOS),true)
$(OBJDIR)/CarlaPluginVST2.cpp.o: $(CWD)/backend/plugin/CarlaPluginVST2.cpp
-@mkdir -p $(OBJDIR)
@echo "Compiling $<"
@$(CXX) $< $(BUILD_CXX_FLAGS) $(NATIVE_BUILD_FLAGS) -c -o $@
@echo "Compiling CarlaPluginVST2.cpp (bridge)"
@$(CXX) $< $(BUILD_CXX_FLAGS) $(NATIVE_BUILD_FLAGS) -ObjC++ -c -o $@

$(OBJDIR)/CarlaStandalone.cpp.o: $(CWD)/backend/CarlaStandalone.cpp
-@mkdir -p $(OBJDIR)
@echo "Compiling CarlaStandalone.cpp (bridge)"
@$(CXX) $< $(BUILD_CXX_FLAGS) $(NATIVE_BUILD_FLAGS) -ObjC++ -c -o $@

$(OBJDIR)/CarlaBridgePlugin.cpp.o: CarlaBridgePlugin.cpp
-@mkdir -p $(OBJDIR)
@echo "Compiling $<"
@$(CXX) $< $(BUILD_CXX_FLAGS) $(NATIVE_BUILD_FLAGS) -ObjC++ -c -o $@
else
$(OBJDIR)/CarlaStandalone.cpp.o: $(CWD)/backend/CarlaStandalone.cpp
-@mkdir -p $(OBJDIR)
@echo "Compiling CarlaStandalone.cpp (bridge)"
@$(CXX) $< $(BUILD_CXX_FLAGS) $(NATIVE_BUILD_FLAGS) -c -o $@

$(OBJDIR)/CarlaEng%.cpp.o: $(CWD)/backend/engine/CarlaEng%.cpp
$(OBJDIR)/CarlaBridgePlugin.cpp.o: CarlaBridgePlugin.cpp
-@mkdir -p $(OBJDIR)
@echo "Compiling CarlaEng$*.cpp (bridge)"
@echo "Compiling $<"
@$(CXX) $< $(BUILD_CXX_FLAGS) $(NATIVE_BUILD_FLAGS) -c -o $@
endif

ifeq ($(MACOS),true)
$(OBJDIR)/CarlaPluginVST2.cpp.o: $(CWD)/backend/plugin/CarlaPluginVST2.cpp
$(OBJDIR)/CarlaBridgeLV2.cpp.o: CarlaBridgeLV2.cpp
-@mkdir -p $(OBJDIR)
@echo "Compiling CarlaPluginVST2.cpp (bridge)"
@$(CXX) $< $(BUILD_CXX_FLAGS) $(NATIVE_BUILD_FLAGS) -ObjC++ -c -o $@
endif
@echo "Compiling $<"
@$(CXX) $< $(BUILD_CXX_FLAGS) $(NATIVE_BUILD_FLAGS) -c -o $@

$(OBJDIR)/CarlaPlug%.cpp.o: $(CWD)/backend/plugin/CarlaPlug%.cpp
-@mkdir -p $(OBJDIR)
@echo "Compiling CarlaPlug$*.cpp (bridge)"
@$(CXX) $< $(BUILD_CXX_FLAGS) $(NATIVE_BUILD_FLAGS) -c -o $@

ifeq ($(MACOS),true)
$(OBJDIR)/CarlaStandalone.cpp.o: $(CWD)/backend/CarlaStandalone.cpp
-@mkdir -p $(OBJDIR)
@echo "Compiling CarlaStandalone.cpp (bridge)"
@$(CXX) $< $(BUILD_CXX_FLAGS) $(NATIVE_BUILD_FLAGS) -ObjC++ -c -o $@
else
$(OBJDIR)/CarlaStandalone.cpp.o: $(CWD)/backend/CarlaStandalone.cpp
$(OBJDIR)/CarlaEng%.cpp.o: $(CWD)/backend/engine/CarlaEng%.cpp
-@mkdir -p $(OBJDIR)
@echo "Compiling CarlaStandalone.cpp (bridge)"
@echo "Compiling CarlaEng$*.cpp (bridge)"
@$(CXX) $< $(BUILD_CXX_FLAGS) $(NATIVE_BUILD_FLAGS) -c -o $@
endif

# ----------------------------------------------------------------------------------------------------------------------
# posix32


+ 25
- 2
source/utils/CarlaMainLoop.hpp View File

@@ -1,5 +1,5 @@
/*
* Carla DSSI utils
* Carla Main-Loop utils
* Copyright (C) 2017 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
@@ -21,6 +21,10 @@
#include "CarlaBackend.h"
#include "CarlaUtils.hpp"

#ifdef CARLA_OS_MAC
# import <Cocoa/Cocoa.h>
#endif

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

CARLA_BACKEND_START_NAMESPACE
@@ -28,7 +32,26 @@ CARLA_BACKEND_START_NAMESPACE
static inline
bool runMainLoopOnce()
{
#if defined(CARLA_OS_WIN)
#if defined(CARLA_OS_MAC)
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
NSEvent* event;

for (;;)
{
event = [NSApp
nextEventMatchingMask:NSAnyEventMask
untilDate:[NSDate distantPast]
inMode:NSDefaultRunLoopMode
dequeue:YES];

if (event == nil)
break;

[NSApp sendEvent: event];
}

[pool release];
#elif defined(CARLA_OS_WIN)
MSG msg;
if (! ::PeekMessage(&msg, nullptr, 0, 0, PM_NOREMOVE))
return true;


Loading…
Cancel
Save