Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make it compile and work under Linux #151

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,9 @@ Source/Misc/boost/**
!Source/Misc/boost/boost.zip
Builds/VisualStudio2017/**
!Builds/VisualStudio2017/Ctrlr.sln
!Builds/VisualStudio2017/resources.rc
!Builds/VisualStudio2017/resources.rc
Builds/**
Packaging/**
.vscode/**
Source/Core/stdafx_luabind.h.gch
Source/Core/stdafx.h.gch
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be ok to ignore generated files

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is only Windows related and should be removed from the patch

23 changes: 5 additions & 18 deletions Builds/LinuxMakefile/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ ifeq ($(CONFIG),Debug)

JUCE_CFLAGS += $(JUCE_CPPFLAGS) $(TARGET_ARCH) -fPIC -g -ggdb -O0 -w $(CFLAGS)
JUCE_CXXFLAGS += $(JUCE_CFLAGS) -std=gnu++14 $(CXXFLAGS)
JUCE_LDFLAGS += $(TARGET_ARCH) -L$(JUCE_BINDIR) -L$(JUCE_LIBDIR) $(shell pkg-config --libs alsa freetype2 libcurl) -fvisibility=hidden -lrt -ldl -lpthread -lz -ludev -lbfd $(LDFLAGS)
JUCE_LDFLAGS += $(TARGET_ARCH) -L$(JUCE_BINDIR) -L$(JUCE_LIBDIR) $(shell pkg-config --libs alsa x11 freetype2 libcurl) -fvisibility=hidden -lrt -ldl -lpthread -lz -ludev -lbfd $(LDFLAGS)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

x11 is still needed


CLEANCMD = rm -rf $(JUCE_OUTDIR)/$(TARGET) $(JUCE_OBJDIR)
endif
Expand Down Expand Up @@ -104,7 +104,7 @@ ifeq ($(CONFIG),Release)

JUCE_CFLAGS += $(JUCE_CPPFLAGS) $(TARGET_ARCH) -fPIC -O3 -w $(CFLAGS)
JUCE_CXXFLAGS += $(JUCE_CFLAGS) -std=gnu++14 $(CXXFLAGS)
JUCE_LDFLAGS += $(TARGET_ARCH) -L$(JUCE_BINDIR) -L$(JUCE_LIBDIR) $(shell pkg-config --libs alsa freetype2 libcurl) -fvisibility=hidden -lrt -ldl -lpthread -lz -ludev -lbfd $(LDFLAGS)
JUCE_LDFLAGS += $(TARGET_ARCH) -L$(JUCE_BINDIR) -L$(JUCE_LIBDIR) $(shell pkg-config --libs alsa x11 freetype2 libcurl) -fvisibility=hidden -lrt -ldl -lpthread -lz -ludev -lbfd $(LDFLAGS)

CLEANCMD = rm -rf $(JUCE_OUTDIR)/$(TARGET) $(JUCE_OBJDIR)
endif
Expand Down Expand Up @@ -333,13 +333,12 @@ OBJECTS_SHARED_CODE := \
all : VST VST3 Standalone

VST : $(JUCE_OUTDIR)/$(JUCE_TARGET_VST)
VST3 : $(JUCE_OUTDIR)/$(JUCE_TARGET_VST3)
Standalone : $(JUCE_OUTDIR)/$(JUCE_TARGET_STANDALONE_PLUGIN)


$(JUCE_OUTDIR)/$(JUCE_TARGET_VST) : $(OBJECTS_VST) $(RESOURCES) $(JUCE_OUTDIR)/$(JUCE_TARGET_SHARED_CODE)
@command -v pkg-config >/dev/null 2>&1 || { echo >&2 "pkg-config not installed. Please, install it."; exit 1; }
@pkg-config --print-errors alsa freetype2 libcurl
@pkg-config --print-errors alsa x11 freetype2 libcurl
@echo Linking "Ctrlr - VST"
-$(V_AT)mkdir -p $(JUCE_BINDIR)
-$(V_AT)mkdir -p $(JUCE_LIBDIR)
Expand All @@ -348,21 +347,9 @@ $(JUCE_OUTDIR)/$(JUCE_TARGET_VST) : $(OBJECTS_VST) $(RESOURCES) $(JUCE_OUTDIR)/$
-$(V_AT)mkdir -p $(JUCE_VSTDESTDIR)
-$(V_AT)cp -R $(JUCE_COPYCMD_VST)

$(JUCE_OUTDIR)/$(JUCE_TARGET_VST3) : $(OBJECTS_VST3) $(RESOURCES) $(JUCE_OUTDIR)/$(JUCE_TARGET_SHARED_CODE)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these parts in the Makefile gives errors, Is VST3 Relevant for Linux at all?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

But I'd think this is a bug in Projucer

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these parts in the Makefile gives errors, Is VST3 Relevant for Linux at all?

Why would VST3 not be "relevant" for Linux?

@command -v pkg-config >/dev/null 2>&1 || { echo >&2 "pkg-config not installed. Please, install it."; exit 1; }
@pkg-config --print-errors alsa freetype2 libcurl
@echo Linking "Ctrlr - VST3"
-$(V_AT)mkdir -p $(JUCE_BINDIR)
-$(V_AT)mkdir -p $(JUCE_LIBDIR)
-$(V_AT)mkdir -p $(JUCE_OUTDIR)
-$(V_AT)mkdir -p $(JUCE_OUTDIR)/$(JUCE_VST3DIR)/$(JUCE_VST3SUBDIR)
$(V_AT)$(CXX) -o $(JUCE_OUTDIR)/$(JUCE_TARGET_VST3) $(OBJECTS_VST3) $(JUCE_OUTDIR)/$(JUCE_TARGET_SHARED_CODE) $(JUCE_LDFLAGS) $(JUCE_LDFLAGS_VST3) $(RESOURCES) $(TARGET_ARCH)
-$(V_AT)mkdir -p $(JUCE_VST3DESTDIR)
-$(V_AT)cp -R $(JUCE_COPYCMD_VST3)

$(JUCE_OUTDIR)/$(JUCE_TARGET_STANDALONE_PLUGIN) : $(OBJECTS_STANDALONE_PLUGIN) $(RESOURCES) $(JUCE_OUTDIR)/$(JUCE_TARGET_SHARED_CODE)
@command -v pkg-config >/dev/null 2>&1 || { echo >&2 "pkg-config not installed. Please, install it."; exit 1; }
@pkg-config --print-errors alsa freetype2 libcurl
@pkg-config --print-errors alsa x11 freetype2 libcurl
@echo Linking "Ctrlr - Standalone Plugin"
-$(V_AT)mkdir -p $(JUCE_BINDIR)
-$(V_AT)mkdir -p $(JUCE_LIBDIR)
Expand All @@ -371,7 +358,7 @@ $(JUCE_OUTDIR)/$(JUCE_TARGET_STANDALONE_PLUGIN) : $(OBJECTS_STANDALONE_PLUGIN) $

$(JUCE_OUTDIR)/$(JUCE_TARGET_SHARED_CODE) : $(OBJECTS_SHARED_CODE) $(RESOURCES)
@command -v pkg-config >/dev/null 2>&1 || { echo >&2 "pkg-config not installed. Please, install it."; exit 1; }
@pkg-config --print-errors alsa freetype2 libcurl
@pkg-config --print-errors alsa x11 freetype2 libcurl
@echo Linking "Ctrlr - Shared Code"
-$(V_AT)mkdir -p $(JUCE_BINDIR)
-$(V_AT)mkdir -p $(JUCE_LIBDIR)
Expand Down
10 changes: 5 additions & 5 deletions Builds/LinuxMakefile/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ echo "CTRLR[linux]: Building for $HOSTTYPE, JOBS $MAXJOBS"
if [ "$1" == "-f" ]; then
echo "CTRLR[linux]: Compile PCH"
echo "stadfx.h"
g++ -w -std=c++14 -D "LINUX=1" -D "NDEBUG=1" \
-D "JUCE_FORCE_DEBUG=0" -D "CTRLR_NIGHTLY=1" \
g++ -w -std=c++14 -D "LINUX=1" -D "NDEBUG=0" \
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

application does nut run in release mode.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Debug settings should not be changed in this patch.

-D "JUCE_FORCE_DEBUG=1" -D "CTRLR_NIGHTLY=1" \
-D "JucePlugin_Build_Standalone" -D "LUA_USE_LINUX" \
-D "_LINUX=1" -D "JUCER_LINUX_MAKE_CC96CACF=1" \
-I /usr/include -I /usr/include/freetype2 \
Expand All @@ -22,8 +22,8 @@ if [ "$1" == "-f" ]; then
-march=native -Os -fpermissive \
-o "../../Source/Core/stdafx.h.gch" -c "../../Source/Core/stdafx.h"
echo "stdafx_luabind.h"
g++ -w -std=c++14 -D "LINUX=1" -D "NDEBUG=1" \
-D "JUCE_FORCE_DEBUG=0" -D "CTRLR_NIGHTLY=1" \
g++ -w -std=c++14 -D "LINUX=1" -D "NDEBUG=0" \
-D "JUCE_FORCE_DEBUG=1" -D "CTRLR_NIGHTLY=1" \
-D "JucePlugin_Build_Standalone" -D "LUA_USE_LINUX" \
-D "_LINUX=1" -D "JUCER_LINUX_MAKE_CC96CACF=1" \
-I /usr/include -I /usr/include/freetype2 \
Expand All @@ -46,7 +46,7 @@ fi
echo "CTRLR[linux]: Build now"
echo
#make -j$JOBS CONFIG=Release ARCH=$HOSTTYPE BINDIR=$BUILDDIR LIBDIR=$BUILDDIR OBJDIR=$BUILDDIR
make CONFIG=Release -j$MAXJOBS
make CONFIG=Debug -j$MAXJOBS
if [ $? -ne 0 ]; then
echo -e "CTRLR[linux]: build failed\n"
exit 1

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A patch that fixes a particular issue should not contain anything else, especitally debug or non-debug.

Expand Down
1 change: 1 addition & 0 deletions Source/Core/CtrlrIDs.h
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,7 @@ namespace Ids
DECLARE_ID (midiOutChannel);

DECLARE_ID (midiDev);
DECLARE_ID (midiDevId);
DECLARE_ID (midiDevType);
DECLARE_ID (midiDevState);
DECLARE_ID (midiDevIndex);
Expand Down
14 changes: 7 additions & 7 deletions Source/Core/CtrlrRevision.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef __CTRLR_REVISION__
#define __CTRLR_REVISION__

static const char *ctrlrRevision = "5.6.0";
static const char *ctrlrRevisionDate = "Wed, Jan 27, 2021 3:40:04 PM";

#endif

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the version change necessary? Are you shure, that you want to step by two ?

#ifndef __CTRLR_REVISION__
#define __CTRLR_REVISION__
static const char *ctrlrRevision = "5.6.2";
static const char *ctrlrRevisionDate = "Di 2. Feb 16:43:27 CET 2021";
#endif
7 changes: 4 additions & 3 deletions Source/MIDI/CtrlrMIDIDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "CtrlrProcessor.h"
#include "CtrlrLog.h"

CtrlrMIDIDevice::CtrlrMIDIDevice(CtrlrMIDIDeviceManager &_owner, const int idx, const String name, const bool type)
CtrlrMIDIDevice::CtrlrMIDIDevice(CtrlrMIDIDeviceManager &_owner, const int idx, const String name, const String identifier, const bool type)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The identifier is needed to open the port

: deviceTree(Ids::midiDev),
owner(_owner),
outJucePtr(nullptr),
Expand All @@ -19,6 +19,7 @@ CtrlrMIDIDevice::CtrlrMIDIDevice(CtrlrMIDIDeviceManager &_owner, const int idx,

setProperty (Ids::midiDevState, STP);
setProperty (Ids::name, name);
setProperty (Ids::midiDevId, identifier );
setProperty (Ids::midiDevIndex, idx);
setProperty (Ids::midiDevType, type);

Expand Down Expand Up @@ -51,7 +52,7 @@ bool CtrlrMIDIDevice::openDevice()

const ScopedLock sl(deviceLock);

outJucePtr = MidiOutput::openDevice (getProperty(Ids::midiDevIndex).toString()).release();
outJucePtr = MidiOutput::openDevice (getProperty(Ids::midiDevId).toString()).release();
if (outJucePtr == NULL)
{
_ERR("CtrlrMIDIDevice::openDevice failed to open device \""+getName()+"\"");
Expand All @@ -72,7 +73,7 @@ bool CtrlrMIDIDevice::openDevice()
return (true);
}

inJucePtr = MidiInput::openDevice (getProperty(Ids::midiDevIndex).toString(), this).release();
inJucePtr = MidiInput::openDevice (getProperty(Ids::midiDevId).toString(), this).release();

if (inJucePtr == NULL)
{
Expand Down
2 changes: 1 addition & 1 deletion Source/MIDI/CtrlrMIDIDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class CtrlrManager;
class CtrlrMIDIDevice : public ValueTree::Listener, public MidiInputCallback
{
public:
CtrlrMIDIDevice(CtrlrMIDIDeviceManager &_owner, const int idx, const String name, const bool type);
CtrlrMIDIDevice(CtrlrMIDIDeviceManager &_owner, const int idx, const String name, const String identifier, const bool type);
virtual ~CtrlrMIDIDevice();

class Listener
Expand Down
20 changes: 10 additions & 10 deletions Source/MIDI/CtrlrMIDIDeviceManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -272,32 +272,32 @@ const StringArray CtrlrMIDIDeviceManager::getManagedDevices(const CtrlrMIDIDevic

void CtrlrMIDIDeviceManager::refreshDevices()
{
// inDevs.clear();
// outDevs.clear();
inDevs.clear();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not clearing this way?

outDevs.clear();

StringArray in = MidiInput::getDevices();
StringArray out = MidiOutput::getDevices();
juce::Array<juce::MidiDeviceInfo> in = MidiInput::getAvailableDevices();
juce::Array<juce::MidiDeviceInfo> out = MidiOutput::getAvailableDevices();

for (int i=0; i<inDevs.size(); i++)
/*for (int i=0; i<inDevs.size(); i++)
{
while ( (i != inDevs.size()) && !in.contains( inDevs[i]->getName() ) )
inDevs.remove(i);
in.removeString( inDevs[i]->getName() );
}
}*/
for (int i=0; i<in.size(); i++)
{
inDevs.add (new CtrlrMIDIDevice (*this, i, in[i], inputDevice));
inDevs.add (new CtrlrMIDIDevice (*this, i, in[i].name, in[i].identifier, inputDevice));
}

for (int i=0; i<outDevs.size(); i++)
/*for (int i=0; i<outDevs.size(); i++)
{
while ( (i != outDevs.size()) && !out.contains( outDevs[i]->getName() ) )
outDevs.remove(i);
out.removeString ( outDevs[i]->getName() );
}
}*/
for (int i=0; i<out.size(); i++)
{
outDevs.add (new CtrlrMIDIDevice (*this, i, out[i], outputDevice));
outDevs.add (new CtrlrMIDIDevice (*this, i, out[i].name, out[i].identifier, outputDevice));
}
}

Expand Down