Browse Source

Add projectM as submodule; Auto-detect system datadir

master
falkTX 3 years ago
parent
commit
dd985236d5
7 changed files with 148 additions and 28 deletions
  1. +1
    -0
      .gitignore
  2. +3
    -0
      .gitmodules
  3. +1
    -1
      dpf
  4. +13
    -26
      plugins/ProM/DistrhoUIProM.cpp
  5. +129
    -1
      plugins/ProM/Makefile
  6. +0
    -0
      plugins/ProM/config.h
  7. +1
    -0
      plugins/ProM/projectM

+ 1
- 0
.gitignore View File

@@ -1,6 +1,7 @@
*.a
*.d
*.o
.DS_Store

*.exe
*.dll


+ 3
- 0
.gitmodules View File

@@ -1,3 +1,6 @@
[submodule "dpf"]
path = dpf
url = https://github.com/DISTRHO/DPF
[submodule "plugins/ProM/projectM"]
path = plugins/ProM/projectM
url = https://github.com/projectM-visualizer/projectm.git

+ 1
- 1
dpf

@@ -1 +1 @@
Subproject commit 66aa0ee878ba4ca6feb85c29d3fcdad09e595f26
Subproject commit 3c37d4c096dd4decac225c62ca78a0d7526a18ed

+ 13
- 26
plugins/ProM/DistrhoUIProM.cpp View File

@@ -1,6 +1,6 @@
/*
* DISTRHO ProM Plugin
* Copyright (C) 2015 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2015-2021 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -23,29 +23,6 @@ START_NAMESPACE_DISTRHO

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

#if 0
static const projectM::Settings kSettings = {
/* meshX */ 32,
/* meshY */ 24,
/* fps */ 35,
/* textureSize */ 1024,
/* windowWidth */ 512,
/* windowHeight */ 512,
/* presetURL */ "/usr/share/projectM/presets",
/* titleFontURL */ "/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf",
/* menuFontURL */ "/usr/share/fonts/truetype/ttf-dejavu/DejaVuSansMono.ttf",
/* smoothPresetDuration */ 5,
/* presetDuration */ 30,
/* beatSensitivity */ 10.0f,
/* aspectCorrection */ true,
/* easterEgg */ 1.0f,
/* shuffleEnabled */ true,
/* softCutRatingsEnabled */ false
};
#endif

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

DistrhoUIProM::DistrhoUIProM()
: UI(512, 512)
{
@@ -114,8 +91,18 @@ void DistrhoUIProM::uiReshape(uint width, uint height)
glLineStipple(2, 0xAAAA);

if (fPM == nullptr)
//fPM = new projectM(kSettings);
fPM = new projectM("/usr/share/projectM/config.inp");
{
#ifdef PROJECTM_PREFIX
fPM = new projectM(PROJECTM_DATA_DIR "/config.inp");
#else
projectM::Settings settings;
settings.presetURL = "./plugins/ProM/projectM/presets";
settings.titleFontURL = "./plugins/ProM/projectM/fonts/Vera.ttf";
settings.menuFontURL = "./plugins/ProM/projectM/fonts/VeraMono.ttf";
settings.datadir = "./plugins/ProM/projectM/";
fPM = new projectM(settings);
#endif
}

fPM->projectM_resetGL(width, height);
}


+ 129
- 1
plugins/ProM/Makefile View File

@@ -18,6 +18,80 @@ FILES_DSP = \
FILES_UI = \
DistrhoUIProM.cpp

# --------------------------------------------------------------
# Check for system-wide projectM

HAVE_PROJECTM = $(shell pkg-config --exists libprojectM && echo true)

# --------------------------------------------------------------
# Use local copy if needed

ifneq ($(HAVE_PROJECTM),true)
FILES_UI += \
projectM/src/libprojectM/ConfigFile.cpp \
projectM/src/libprojectM/FileScanner.cpp \
projectM/src/libprojectM/KeyHandler.cpp \
projectM/src/libprojectM/PCM.cpp \
projectM/src/libprojectM/PipelineMerger.cpp \
projectM/src/libprojectM/Preset.cpp \
projectM/src/libprojectM/PresetChooser.cpp \
projectM/src/libprojectM/PresetFactory.cpp \
projectM/src/libprojectM/PresetFactoryManager.cpp \
projectM/src/libprojectM/PresetLoader.cpp \
projectM/src/libprojectM/TimeKeeper.cpp \
projectM/src/libprojectM/fftsg.cpp \
projectM/src/libprojectM/projectM.cpp \
projectM/src/libprojectM/timer.cpp \
projectM/src/libprojectM/wipemalloc.cpp \
projectM/src/libprojectM/MilkdropPresetFactory/BuiltinFuncs.cpp \
projectM/src/libprojectM/MilkdropPresetFactory/BuiltinParams.cpp \
projectM/src/libprojectM/MilkdropPresetFactory/CustomShape.cpp \
projectM/src/libprojectM/MilkdropPresetFactory/CustomWave.cpp \
projectM/src/libprojectM/MilkdropPresetFactory/Eval.cpp \
projectM/src/libprojectM/MilkdropPresetFactory/Expr.cpp \
projectM/src/libprojectM/MilkdropPresetFactory/Func.cpp \
projectM/src/libprojectM/MilkdropPresetFactory/IdlePreset.cpp \
projectM/src/libprojectM/MilkdropPresetFactory/InitCond.cpp \
projectM/src/libprojectM/MilkdropPresetFactory/MilkdropPreset.cpp \
projectM/src/libprojectM/MilkdropPresetFactory/MilkdropPresetFactory.cpp \
projectM/src/libprojectM/MilkdropPresetFactory/Param.cpp \
projectM/src/libprojectM/MilkdropPresetFactory/Parser.cpp \
projectM/src/libprojectM/MilkdropPresetFactory/PerFrameEqn.cpp \
projectM/src/libprojectM/MilkdropPresetFactory/PerPixelEqn.cpp \
projectM/src/libprojectM/MilkdropPresetFactory/PerPointEqn.cpp \
projectM/src/libprojectM/MilkdropPresetFactory/PresetFrameIO.cpp \
projectM/src/libprojectM/NativePresetFactory/NativePresetFactory.cpp \
projectM/src/libprojectM/Renderer/BeatDetect.cpp \
projectM/src/libprojectM/Renderer/Renderable.cpp \
projectM/src/libprojectM/Renderer/Filters.cpp \
projectM/src/libprojectM/Renderer/Renderer.cpp \
projectM/src/libprojectM/Renderer/MilkdropWaveform.cpp \
projectM/src/libprojectM/Renderer/Shader.cpp \
projectM/src/libprojectM/Renderer/PerPixelMesh.cpp \
projectM/src/libprojectM/Renderer/ShaderEngine.cpp \
projectM/src/libprojectM/Renderer/PerlinNoise.cpp \
projectM/src/libprojectM/Renderer/StaticGlShaders.cpp \
projectM/src/libprojectM/Renderer/PerlinNoiseWithAlpha.cpp \
projectM/src/libprojectM/Renderer/Texture.cpp \
projectM/src/libprojectM/Renderer/Pipeline.cpp \
projectM/src/libprojectM/Renderer/TextureManager.cpp \
projectM/src/libprojectM/Renderer/PipelineContext.cpp \
projectM/src/libprojectM/Renderer/VideoEcho.cpp \
projectM/src/libprojectM/Renderer/RenderItemDistanceMetric.cpp \
projectM/src/libprojectM/Renderer/Waveform.cpp \
projectM/src/libprojectM/Renderer/RenderItemMatcher.cpp \
projectM/src/libprojectM/Renderer/hlslparser/src/CodeWriter.cpp \
projectM/src/libprojectM/Renderer/hlslparser/src/HLSLParser.cpp \
projectM/src/libprojectM/Renderer/hlslparser/src/Engine.cpp \
projectM/src/libprojectM/Renderer/hlslparser/src/HLSLTokenizer.cpp \
projectM/src/libprojectM/Renderer/hlslparser/src/GLSLGenerator.cpp \
projectM/src/libprojectM/Renderer/hlslparser/src/HLSLTree.cpp \
projectM/src/libprojectM/Renderer/SOIL2/SOIL2.c \
projectM/src/libprojectM/Renderer/SOIL2/image_DXT.c \
projectM/src/libprojectM/Renderer/SOIL2/etc1_utils.c \
projectM/src/libprojectM/Renderer/SOIL2/image_helper.c
endif

# --------------------------------------------------------------
# Do some magic

@@ -26,8 +100,62 @@ include ../../dpf/Makefile.plugins.mk
# --------------------------------------------------------------
# Extra flags

ifeq ($(HAVE_PROJECTM),true)
BASE_FLAGS += -DPROJECTM_DATA_DIR='"$(shell pkg-config --variable=pkgdatadir libprojectM)"'
BASE_FLAGS += $(shell pkg-config --cflags libprojectM)
LINK_FLAGS += $(shell pkg-config --libs libprojectM) -lpthread
LINK_FLAGS += $(shell pkg-config --libs libprojectM)
else
# include dirs
BASE_FLAGS += -IprojectM/src
BASE_FLAGS += -IprojectM/src/libprojectM
BASE_FLAGS += -IprojectM/src/libprojectM/Renderer
BASE_FLAGS += -IprojectM/src/libprojectM/Renderer/hlslparser/src
BASE_FLAGS += -IprojectM/src/libprojectM/MilkdropPresetFactory
BASE_FLAGS += -IprojectM/src/libprojectM/NativePresetFactory
BASE_FLAGS += -IprojectM/vendor
# compiler macros
BASE_FLAGS += -Dprojectm_mac=1
BASE_FLAGS += -DHAVE_ALIGNED_ALLOC=1
BASE_FLAGS += -DHAVE_DLFCN_H=1
BASE_FLAGS += -DHAVE_FTS_H=1
BASE_FLAGS += -DHAVE_GL=1
# BASE_FLAGS += -DHAVE_GLES_GL_H=1
BASE_FLAGS += -DHAVE_GL_GL_H=1
BASE_FLAGS += -DHAVE_INTTYPES_H=1
# BASE_FLAGS += -DHAVE_LLVM=1
BASE_FLAGS += -DHAVE_MEMORY_H=1
BASE_FLAGS += -DHAVE_OPENGL_GL_H=1
BASE_FLAGS += -DHAVE_POSIX_MEMALIGN=1
BASE_FLAGS += -DHAVE_PTHREAD_PRIO_INHERIT=1
BASE_FLAGS += -DHAVE_STDINT_H=1
BASE_FLAGS += -DHAVE_STDLIB_H=1
BASE_FLAGS += -DHAVE_STRINGS_H=1
BASE_FLAGS += -DHAVE_STRING_H=1
BASE_FLAGS += -DHAVE_SYS_STAT_H=1
BASE_FLAGS += -DHAVE_SYS_TYPES_H=1
BASE_FLAGS += -DHAVE_UNISTD_H=1
BASE_FLAGS += -DHAVE_WINDOWS_H=1
BASE_FLAGS += -DSTDC_HEADERS=1
# BASE_FLAGS += -DUSE_GLES=1
BASE_FLAGS += -DUSE_THREADS=1
# self-contained build
# FIXME
BASE_FLAGS += -DDATADIR_PATH='"./plugins/ProM/projectM/"'
# silence projectM warnings
BASE_FLAGS += -Wno-constant-conversion
BASE_FLAGS += -Wno-delete-non-abstract-non-virtual-dtor
BASE_FLAGS += -Wno-ignored-qualifiers
BASE_FLAGS += -Wno-mismatched-tags
BASE_FLAGS += -Wno-sign-compare
BASE_FLAGS += -Wno-unused-parameter
BASE_FLAGS += -Wno-unused-variable
# maybe maybe
# projectm_mac
# -fopenmp
# -DPROJECTM_STATIC_DEFINE
endif

LINK_FLAGS += -lpthread

# --------------------------------------------------------------
# Enable all possible plugin types


+ 0
- 0
plugins/ProM/config.h View File


+ 1
- 0
plugins/ProM/projectM

@@ -0,0 +1 @@
Subproject commit a9be845e2dc901a56c6583cce8adf154f676405c

Loading…
Cancel
Save