diff --git a/Builds/Linux/Makefile b/Builds/Linux/Makefile index b5ecbffed88b8f7aeeca4aff25715102b9398489..29944655cc3a1871e3a0489ec27292d26a78258c 100644 --- a/Builds/Linux/Makefile +++ b/Builds/Linux/Makefile @@ -18,12 +18,12 @@ ifeq ($(CONFIG),Debug) TARGET_ARCH := -march=native endif - CPPFLAGS := $(DEPFLAGS) -D "LINUX=1" -D "DEBUG=1" -D "_DEBUG=1" -D "JUCER_LINUX_MAKE_7346DA2A=1" -D "JUCE_APP_VERSION=0.3.4" -D "JUCE_APP_VERSION_HEX=0x304" -I /usr/include -I /usr/include/freetype2 -I ../../JuceLibraryCode -I ../../JuceLibraryCode/modules + CPPFLAGS := $(DEPFLAGS) -D "LINUX=1" -D "DEBUG=1" -D "_DEBUG=1" -D "ZEROMQ" -D "JUCER_LINUX_MAKE_7346DA2A=1" -D "JUCE_APP_VERSION=0.3.4" -D "JUCE_APP_VERSION_HEX=0x304" -I /usr/include -I /usr/include/freetype2 -I ../../JuceLibraryCode -I ../../JuceLibraryCode/modules CFLAGS += $(CPPFLAGS) $(TARGET_ARCH) -g -ggdb -O3 -export-dynamic -g -pg -std=c++0x CXXFLAGS += $(CFLAGS) - LDFLAGS += $(TARGET_ARCH) -L$(BINDIR) -L$(LIBDIR) -L/usr/X11R6/lib/ -L/usr/local/include -lGL -lX11 -lXext -lXinerama -lasound -ldl -lfreetype -lpthread -lrt -pg -ldl -lXext -lGLU -lhdf5 -lhdf5_cpp + LDFLAGS += $(TARGET_ARCH) -L$(BINDIR) -L$(LIBDIR) -L/usr/X11R6/lib/ -L/usr/local/include -lGL -lX11 -lXext -lXinerama -lasound -ldl -lfreetype -lpthread -lrt -pg -ldl -lXext -lGLU -lhdf5 -lhdf5_cpp -lzmq LDDEPS := - RESFLAGS := -D "LINUX=1" -D "DEBUG=1" -D "_DEBUG=1" -D "JUCER_LINUX_MAKE_7346DA2A=1" -D "JUCE_APP_VERSION=0.3.4" -D "JUCE_APP_VERSION_HEX=0x304" -I /usr/include -I /usr/include/freetype2 -I ../../JuceLibraryCode -I ../../JuceLibraryCode/modules + RESFLAGS := -D "LINUX=1" -D "DEBUG=1" -D "_DEBUG=1" -D "ZEROMQ" -D "JUCER_LINUX_MAKE_7346DA2A=1" -D "JUCE_APP_VERSION=0.3.4" -D "JUCE_APP_VERSION_HEX=0x304" -I /usr/include -I /usr/include/freetype2 -I ../../JuceLibraryCode -I ../../JuceLibraryCode/modules TARGET := open-ephys BLDCMD = $(CXX) -o $(OUTDIR)/$(TARGET) $(OBJECTS) $(LDFLAGS) $(RESOURCES) $(TARGET_ARCH) CLEANCMD = rm -rf $(OUTDIR)/$(TARGET) $(OBJDIR) @@ -39,12 +39,12 @@ ifeq ($(CONFIG),Release) TARGET_ARCH := -march=native endif - CPPFLAGS := $(DEPFLAGS) -D "LINUX=1" -D "NDEBUG=1" -D "JUCER_LINUX_MAKE_7346DA2A=1" -D "JUCE_APP_VERSION=0.3.4" -D "JUCE_APP_VERSION_HEX=0x304" -I /usr/include -I /usr/include/freetype2 -I ../../JuceLibraryCode -I ../../JuceLibraryCode/modules + CPPFLAGS := $(DEPFLAGS) -D "LINUX=1" -D "NDEBUG=1" -D "ZEROMQ" -D "JUCER_LINUX_MAKE_7346DA2A=1" -D "JUCE_APP_VERSION=0.3.4" -D "JUCE_APP_VERSION_HEX=0x304" -I /usr/include -I /usr/include/freetype2 -I ../../JuceLibraryCode -I ../../JuceLibraryCode/modules CFLAGS += $(CPPFLAGS) $(TARGET_ARCH) -O3 -export-dynamic -g -pg -std=c++0x CXXFLAGS += $(CFLAGS) - LDFLAGS += $(TARGET_ARCH) -L$(BINDIR) -L$(LIBDIR) -fvisibility=hidden -L/usr/X11R6/lib/ -lGL -lX11 -lXext -lXinerama -lasound -ldl -lfreetype -lpthread -lrt -pg -ldl -lXext -lGLU -lhdf5 -lhdf5_cpp + LDFLAGS += $(TARGET_ARCH) -L$(BINDIR) -L$(LIBDIR) -fvisibility=hidden -L/usr/X11R6/lib/ -lGL -lX11 -lXext -lXinerama -lasound -ldl -lfreetype -lpthread -lrt -pg -ldl -lXext -lGLU -lhdf5 -lhdf5_cpp -lzmq LDDEPS := - RESFLAGS := -D "LINUX=1" -D "NDEBUG=1" -D "JUCER_LINUX_MAKE_7346DA2A=1" -D "JUCE_APP_VERSION=0.3.4" -D "JUCE_APP_VERSION_HEX=0x304" -I /usr/include -I /usr/include/freetype2 -I ../../JuceLibraryCode -I ../../JuceLibraryCode/modules + RESFLAGS := -D "LINUX=1" -D "NDEBUG=1" -D "ZEROMQ" -D "JUCER_LINUX_MAKE_7346DA2A=1" -D "JUCE_APP_VERSION=0.3.4" -D "JUCE_APP_VERSION_HEX=0x304" -I /usr/include -I /usr/include/freetype2 -I ../../JuceLibraryCode -I ../../JuceLibraryCode/modules TARGET := open-ephys-release BLDCMD = $(CXX) -o $(OUTDIR)/$(TARGET) $(OBJECTS) $(LDFLAGS) $(RESOURCES) $(TARGET_ARCH) CLEANCMD = rm -rf $(OUTDIR)/$(TARGET) $(OBJDIR) diff --git a/Source/Processors/NetworkEvents/NetworkEvents.cpp b/Source/Processors/NetworkEvents/NetworkEvents.cpp index 8214ed737748cf3b743fca49de3cc7c5c3208025..6364b442430b9c1587a66a58e419fbca997f242c 100644 --- a/Source/Processors/NetworkEvents/NetworkEvents.cpp +++ b/Source/Processors/NetworkEvents/NetworkEvents.cpp @@ -394,7 +394,7 @@ void NetworkEvents::process(AudioSampleBuffer& buffer, while (!networkMessagesQueue.empty()) { StringTS msg = networkMessagesQueue.front(); postTimestamppedStringToMidiBuffer(msg, events); - sendActionMessage("Network event received: " + msg); + sendActionMessage("Network event received: " + msg.getString()); // getUIComponent()->getLogWindow()->addLineToLog(msg); networkMessagesQueue.pop(); } @@ -417,6 +417,7 @@ void NetworkEvents::run() { if (rc != 0) { // failed to open socket? + std::cout << "Failed to open socket." << std::endl; return; } @@ -438,6 +439,8 @@ void NetworkEvents::run() { lock.enter(); networkMessagesQueue.push(Msg); lock.exit(); + + std::cout << "Received message!" << std::endl; // handle special messages String response = handleSpecialMessages(Msg); @@ -445,6 +448,8 @@ void NetworkEvents::run() { } else { String zeroMessageError = "Recieved Zero Message?!?!?"; + std::cout << "Received Zero Message!" << std::endl; + zmq_send (responder, zeroMessageError.getCharPointer(), zeroMessageError.length(), 0); } } diff --git a/Source/Processors/NetworkEvents/NetworkEvents.h b/Source/Processors/NetworkEvents/NetworkEvents.h index 0609d5d1bfaf93469d24b6933f10a297672e73b0..bfe4470800d6c236860bade07bb39a1782e4e657 100644 --- a/Source/Processors/NetworkEvents/NetworkEvents.h +++ b/Source/Processors/NetworkEvents/NetworkEvents.h @@ -26,9 +26,15 @@ //#define ZEROMQ #ifdef ZEROMQ + +#ifdef WIN32 #pragma comment( lib, "../../Resources/windows-libs/ZeroMQ/lib_x64/libzmq-v120-mt-4_0_4.lib" ) #include "../../Resources/windows-libs/ZeroMQ/include/zmq.h" #include "../../Resources/windows-libs/ZeroMQ/include/zmq_utils.h" +#else + #include <zmq.h> +#endif + #endif #include "../../JuceLibraryCode/JuceHeader.h" diff --git a/Source/Processors/ProcessorGraph/ProcessorGraph.cpp b/Source/Processors/ProcessorGraph/ProcessorGraph.cpp index ffef2749a216965a16f3cb12f766bdbf188e644a..bd173d37b7f58e63f81fac794177df28d60beae1 100644 --- a/Source/Processors/ProcessorGraph/ProcessorGraph.cpp +++ b/Source/Processors/ProcessorGraph/ProcessorGraph.cpp @@ -53,6 +53,18 @@ #include "../NetworkEvents/NetworkEvents.h" #include "../PSTH/PeriStimulusTimeHistogramNode.h" +#ifdef ZEROMQ + +#ifdef WIN32 + #pragma comment( lib, "../../Resources/windows-libs/ZeroMQ/lib_x64/libzmq-v120-mt-4_0_4.lib" ) + #include "../../Resources/windows-libs/ZeroMQ/include/zmq.h" + #include "../../Resources/windows-libs/ZeroMQ/include/zmq_utils.h" +#else + #include <zmq.h> +#endif + +#endif + ProcessorGraph::ProcessorGraph() : currentNodeId(100) { @@ -74,7 +86,7 @@ ProcessorGraph::~ProcessorGraph() void* ProcessorGraph::createZmqContext() { #ifdef ZEROMQ - zmqcontext = zmq_ctx_new (); + zmqcontext = zmq_ctx_new (); //<-- this is only available in version 3+ return zmqcontext; #endif return nullptr; diff --git a/open-ephys.jucer b/open-ephys.jucer index b432a75a756fb9126161eb3948a24a5a656c643e..4af53bfaeb3e4be48f58cf4b2451c9db7df98949 100644 --- a/open-ephys.jucer +++ b/open-ephys.jucer @@ -39,8 +39,8 @@ <MODULEPATH id="juce_audio_basics" path="JuceLibraryCode/modules"/> </MODULEPATHS> </XCODE_MAC> - <LINUX_MAKE targetFolder="Builds/Linux" vstFolder="~/SDKs/vstsdk2.4" extraLinkerFlags="-pg -ldl -lXext -lGLU -lhdf5 -lhdf5_cpp" - extraCompilerFlags="-export-dynamic -g -pg -std=c++0x"> + <LINUX_MAKE targetFolder="Builds/Linux" vstFolder="~/SDKs/vstsdk2.4" extraLinkerFlags="-pg -ldl -lXext -lGLU -lhdf5 -lhdf5_cpp -lzmq" + extraCompilerFlags="-export-dynamic -g -pg -std=c++0x" extraDefs="ZEROMQ"> <CONFIGURATIONS> <CONFIGURATION name="Debug" isDebug="1" optimisation="3" targetName="open-ephys" libraryPath="/usr/X11R6/lib/ /usr/local/include " headerPath=""/>