@@ -0,0 +1,11 @@ | |||||
*.a | |||||
*.d | |||||
*.o | |||||
*.exe | |||||
*.dll | |||||
*.dylib | |||||
*.so | |||||
*.zip | |||||
bin/* |
@@ -0,0 +1,80 @@ | |||||
#!/usr/bin/make -f | |||||
# Makefile for DISTRHO Plugins # | |||||
# ---------------------------- # | |||||
# Created by falkTX | |||||
# | |||||
include Makefile.mk | |||||
all: libs plugins gen | |||||
# -------------------------------------------------------------- | |||||
libs: | |||||
ifeq ($(HAVE_DGL),true) | |||||
$(MAKE) -C dpf/dgl | |||||
endif | |||||
plugins: libs | |||||
# Mini-Series | |||||
$(MAKE) all -C plugins/3BandEQ | |||||
$(MAKE) all -C plugins/3BandSplitter | |||||
$(MAKE) all -C plugins/PingPongPan | |||||
# ndc-Plugs | |||||
$(MAKE) all -C plugins/AmplitudeImposer | |||||
$(MAKE) all -C plugins/CycleShifter | |||||
$(MAKE) all -C plugins/SoulForce | |||||
# MVerb | |||||
$(MAKE) all -C plugins/MVerb | |||||
# Nekobi | |||||
$(MAKE) all -C plugins/Nekobi | |||||
# ProM (needs DGL + ProjectM) | |||||
ifeq ($(HAVE_DGL),true) | |||||
ifeq ($(HAVE_PROJM),true) | |||||
# $(MAKE) all -C plugins/ProM | |||||
endif | |||||
endif | |||||
gen: plugins dpf/utils/lv2_ttl_generator | |||||
@$(CURDIR)/dpf/utils/generate-ttl.sh | |||||
ifeq ($(MACOS),true) | |||||
@$(CURDIR)/dpf/utils/generate-vst-bundles.sh | |||||
endif | |||||
dpf/utils/lv2_ttl_generator: | |||||
$(MAKE) -C dpf/utils/lv2-ttl-generator | |||||
# -------------------------------------------------------------- | |||||
clean: | |||||
ifeq ($(HAVE_DGL),true) | |||||
$(MAKE) clean -C dpf/dgl | |||||
endif | |||||
$(MAKE) clean -C dpf/utils/lv2-ttl-generator | |||||
# Mini-Series | |||||
$(MAKE) clean -C plugins/3BandEQ | |||||
$(MAKE) clean -C plugins/3BandSplitter | |||||
$(MAKE) clean -C plugins/PingPongPan | |||||
# ndc-Plugs | |||||
$(MAKE) clean -C plugins/AmplitudeImposer | |||||
$(MAKE) clean -C plugins/CycleShifter | |||||
$(MAKE) clean -C plugins/SoulForce | |||||
# MVerb | |||||
$(MAKE) clean -C plugins/MVerb | |||||
# Nekobi | |||||
$(MAKE) clean -C plugins/Nekobi | |||||
# ProM | |||||
$(MAKE) clean -C plugins/ProM | |||||
# -------------------------------------------------------------- | |||||
.PHONY: plugins |
@@ -0,0 +1,149 @@ | |||||
#!/usr/bin/make -f | |||||
# Makefile for DISTRHO Plugins # | |||||
# ---------------------------- # | |||||
# Created by falkTX | |||||
# | |||||
AR ?= ar | |||||
CC ?= gcc | |||||
CXX ?= g++ | |||||
# -------------------------------------------------------------- | |||||
# Fallback to Linux if no other OS defined | |||||
ifneq ($(HAIKU),true) | |||||
ifneq ($(MACOS),true) | |||||
ifneq ($(WIN32),true) | |||||
LINUX=true | |||||
endif | |||||
endif | |||||
endif | |||||
# -------------------------------------------------------------- | |||||
# Set build and link flags | |||||
BASE_FLAGS = -Wall -Wextra -pipe | |||||
BASE_OPTS = -O2 -ffast-math -mtune=generic -msse -msse2 -fdata-sections -ffunction-sections | |||||
ifneq ($(MACOS),true) | |||||
# MacOS doesn't support this | |||||
BASE_OPTS += -mfpmath=sse | |||||
endif | |||||
ifeq ($(MACOS),true) | |||||
# MacOS linker flags | |||||
LINK_OPTS = -fdata-sections -ffunction-sections -Wl,-dead_strip -Wl,-dead_strip_dylibs | |||||
else | |||||
# Common linker flags | |||||
LINK_OPTS = -fdata-sections -ffunction-sections -Wl,--gc-sections -Wl,-O1 -Wl,--as-needed -Wl,--strip-all | |||||
endif | |||||
ifeq ($(RASPPI),true) | |||||
# Raspberry-Pi optimization flags | |||||
BASE_OPTS = -O2 -ffast-math -march=armv6 -mfpu=vfp -mfloat-abi=hard | |||||
LINK_OPTS = -Wl,-O1 -Wl,--as-needed -Wl,--strip-all | |||||
endif | |||||
ifeq ($(PANDORA),true) | |||||
# OpenPandora optimization flags | |||||
BASE_OPTS = -O2 -ffast-math -march=armv7-a -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp | |||||
LINK_OPTS = -Wl,-O1 -Wl,--as-needed -Wl,--strip-all | |||||
endif | |||||
ifeq ($(NOOPT),true) | |||||
# No optimization flags | |||||
BASE_OPTS = -O2 -ffast-math -fdata-sections -ffunction-sections | |||||
endif | |||||
ifneq ($(WIN32),true) | |||||
# not needed for Windows | |||||
BASE_FLAGS += -fPIC -DPIC | |||||
endif | |||||
ifeq ($(DEBUG),true) | |||||
BASE_FLAGS += -DDEBUG -O0 -g | |||||
LINK_OPTS = | |||||
else | |||||
BASE_FLAGS += -DNDEBUG $(BASE_OPTS) -fvisibility=hidden | |||||
CXXFLAGS += -fvisibility-inlines-hidden | |||||
endif | |||||
BUILD_C_FLAGS = $(BASE_FLAGS) -std=c99 -std=gnu99 $(CFLAGS) | |||||
BUILD_CXX_FLAGS = $(BASE_FLAGS) -std=c++0x -std=gnu++0x $(CXXFLAGS) $(CPPFLAGS) | |||||
LINK_FLAGS = $(LINK_OPTS) -Wl,--no-undefined $(LDFLAGS) | |||||
ifeq ($(MACOS),true) | |||||
# No C++11 support | |||||
BUILD_CXX_FLAGS = $(BASE_FLAGS) $(CXXFLAGS) $(CPPFLAGS) | |||||
LINK_FLAGS = $(LINK_OPTS) $(LDFLAGS) | |||||
endif | |||||
# -------------------------------------------------------------- | |||||
# Check for optional & required libs | |||||
ifeq ($(LINUX),true) | |||||
HAVE_DGL = $(shell pkg-config --exists gl x11 && echo true) | |||||
HAVE_JACK = $(shell pkg-config --exists jack && echo true) | |||||
HAVE_LIBLO = $(shell pkg-config --exists liblo && echo true) | |||||
endif | |||||
ifeq ($(MACOS),true) | |||||
HAVE_DGL = true | |||||
endif | |||||
ifeq ($(WIN32),true) | |||||
HAVE_DGL = true | |||||
endif | |||||
HAVE_PROJM = $(shell pkg-config --exists libprojectM && echo true) | |||||
# -------------------------------------------------------------- | |||||
# Set libs stuff | |||||
ifeq ($(HAVE_DGL),true) | |||||
ifeq ($(LINUX),true) | |||||
DGL_FLAGS = $(shell pkg-config --cflags gl x11) | |||||
DGL_LIBS = $(shell pkg-config --libs gl x11) | |||||
endif | |||||
ifeq ($(MACOS),true) | |||||
DGL_LIBS = -framework OpenGL -framework Cocoa | |||||
endif | |||||
ifeq ($(WIN32),true) | |||||
DGL_LIBS = -lopengl32 -lgdi32 | |||||
endif | |||||
endif # HAVE_DGL | |||||
# -------------------------------------------------------------- | |||||
# Set app extension | |||||
ifeq ($(WIN32),true) | |||||
APP_EXT = .exe | |||||
endif | |||||
# -------------------------------------------------------------- | |||||
# Set shared lib extension | |||||
LIB_EXT = .so | |||||
ifeq ($(MACOS),true) | |||||
LIB_EXT = .dylib | |||||
endif | |||||
ifeq ($(WIN32),true) | |||||
LIB_EXT = .dll | |||||
endif | |||||
# -------------------------------------------------------------- | |||||
# Set shared library CLI arg | |||||
SHARED = -shared | |||||
ifeq ($(MACOS),true) | |||||
SHARED = -dynamiclib | |||||
endif | |||||
# -------------------------------------------------------------- |
@@ -0,0 +1,31 @@ | |||||
DPF-Plugins | |||||
=========== | |||||
Collection of DPF-based plugins ready for packaging. | |||||
This repository does not use submodules, | |||||
everything you need to build is included in a simple clone. | |||||
The list of plugins/packs are: | |||||
- Mini-Series (3BandEQ+Splitter, PingPongPan) | |||||
- ndc-Plugs (Amplitude Imposer, Cycle Shifter, Soul Force) | |||||
- MVerb | |||||
- Nekobi | |||||
- ProM | |||||
Install | |||||
------- | |||||
This repository is intended for distribution packagers, not end-users. | |||||
Screenshots | |||||
----------- | |||||
 | |||||
 | |||||
 | |||||
 | |||||
 | |||||
 | |||||
 | |||||
 |
@@ -0,0 +1,3 @@ | |||||
All final plugin builds will be placed in this folder. | |||||
There is no "make install" process, simply copy those files to their appropriate place. |
@@ -0,0 +1 @@ | |||||
Subproject commit a02cdf7ace1bb95d6b6e5ad34a5363f3c5ffd931 |
@@ -0,0 +1,41 @@ | |||||
#!/bin/bash | |||||
set -e | |||||
PLUGINS=("Mini-Series" "MVerb" "Nekobi" "ProM" "ndc-Plugs") | |||||
if [ ! -f Makefile ]; then | |||||
echo "Makefile not found, please run this script from DPF-Plugins root source dir" | |||||
exit | |||||
fi | |||||
rm -rf repos | |||||
mkdir repos | |||||
cd repos | |||||
git clone --depth 1 git://github.com/DISTRHO/DPF | |||||
for PLUGIN in ${PLUGINS[@]}; do | |||||
git clone --depth 1 git://github.com/DISTRHO/$PLUGIN | |||||
done | |||||
cd .. | |||||
rm -rf dpf | |||||
rm -rf modguis | |||||
rm -rf plugins | |||||
mkdir modguis | |||||
mkdir plugins | |||||
mv repos/DPF dpf | |||||
for PLUGIN in ${PLUGINS[@]}; do | |||||
if [ -d repos/$PLUGIN/modguis ]; then | |||||
mv repos/$PLUGIN/modguis/* modguis/ | |||||
fi | |||||
mv repos/$PLUGIN/plugins/* plugins/ | |||||
mv plugins/Makefile.mk plugins/Makefile.$PLUGIN.mk | |||||
sed -i "s/Makefile.mk/Makefile.$PLUGIN.mk/" plugins/*/Makefile | |||||
done | |||||
rm -rf repos |
@@ -0,0 +1,11 @@ | |||||
@prefix mod: <http://portalmod.com/ns/modgui#>. | |||||
<http://distrho.sf.net/plugins/MVerb> | |||||
mod:gui [ | |||||
a mod:Gui; | |||||
mod:resourcesDirectory <modgui>; | |||||
mod:iconTemplate <modgui/icon-mverb.html>; | |||||
mod:templateData <modgui/data-mverb.json>; | |||||
mod:screenshot <modgui/screenshot-mverb.png>; | |||||
mod:thumbnail <modgui/thumb-mverb.png>; | |||||
] . |
@@ -0,0 +1,42 @@ | |||||
{ | |||||
"author": "Martin Eastwood", | |||||
"controls": [ | |||||
{ | |||||
"name": "MIX", | |||||
"symbol": "mix" | |||||
}, | |||||
{ | |||||
"name": "PRE", | |||||
"symbol": "predelay" | |||||
}, | |||||
{ | |||||
"name": "EL/MIX", | |||||
"symbol": "earlymix" | |||||
}, | |||||
{ | |||||
"name": "SIZE", | |||||
"symbol": "size" | |||||
}, | |||||
{ | |||||
"name": "DENSITY", | |||||
"symbol": "density" | |||||
}, | |||||
{ | |||||
"name": "BAND", | |||||
"symbol": "bandwidth" | |||||
}, | |||||
{ | |||||
"name": "DECAY", | |||||
"symbol": "decay" | |||||
}, | |||||
{ | |||||
"name": "DAMP", | |||||
"symbol": "damping" | |||||
}, | |||||
{ | |||||
"name": "GAIN", | |||||
"symbol": "gain" | |||||
} | |||||
], | |||||
"label": "MVerb" | |||||
} |
@@ -0,0 +1,92 @@ | |||||
<div class="mod-pedal mod-combo-model-001 mod-combo-model-001-0930"> | |||||
<div mod-role="drag-handle" class="mod-drag-handle"></div> | |||||
<div class="mod-plugin-author"><h1>{{author}}</h1></div> | |||||
<div class="mod-plugin-name"><h1>{{label}}</h1></div> | |||||
<div class="mod-control-group clearfix"> | |||||
<div class="mod-switch" mod-role="bypass"> | |||||
<div class="mod-switch-image" mod-role="bypass-light"></div> | |||||
</div> | |||||
<div class="mod-separator"></div> | |||||
{{#controls.0}} | |||||
<div class="mod-chicken-head"> | |||||
<div class="mod-chicken-head-image" mod-role="input-control-port" mod-port-symbol="{{symbol}}"></div> | |||||
<span class="mod-chicken-head-title">{{name}}</span> | |||||
</div> | |||||
{{/controls.0}} | |||||
<div class="mod-separator"></div> | |||||
{{#controls.1}} | |||||
<div class="mod-chicken-head"> | |||||
<div class="mod-chicken-head-image" mod-role="input-control-port" mod-port-symbol="{{symbol}}"></div> | |||||
<span class="mod-chicken-head-title">{{name}}</span> | |||||
</div> | |||||
{{/controls.1}} | |||||
{{#controls.2}} | |||||
<div class="mod-chicken-head"> | |||||
<div class="mod-chicken-head-image" mod-role="input-control-port" mod-port-symbol="{{symbol}}"></div> | |||||
<span class="mod-chicken-head-title">{{name}}</span> | |||||
</div> | |||||
{{/controls.2}} | |||||
<div class="mod-separator"></div> | |||||
{{#controls.3}} | |||||
<div class="mod-chicken-head"> | |||||
<div class="mod-chicken-head-image" mod-role="input-control-port" mod-port-symbol="{{symbol}}"></div> | |||||
<span class="mod-chicken-head-title">{{name}}</span> | |||||
</div> | |||||
{{/controls.3}} | |||||
{{#controls.4}} | |||||
<div class="mod-chicken-head"> | |||||
<div class="mod-chicken-head-image" mod-role="input-control-port" mod-port-symbol="{{symbol}}"></div> | |||||
<span class="mod-chicken-head-title">{{name}}</span> | |||||
</div> | |||||
{{/controls.4}} | |||||
{{#controls.5}} | |||||
<div class="mod-chicken-head"> | |||||
<div class="mod-chicken-head-image" mod-role="input-control-port" mod-port-symbol="{{symbol}}"></div> | |||||
<span class="mod-chicken-head-title">{{name}}</span> | |||||
</div> | |||||
{{/controls.5}} | |||||
{{#controls.6}} | |||||
<div class="mod-chicken-head"> | |||||
<div class="mod-chicken-head-image" mod-role="input-control-port" mod-port-symbol="{{symbol}}"></div> | |||||
<span class="mod-chicken-head-title">{{name}}</span> | |||||
</div> | |||||
{{/controls.6}} | |||||
{{#controls.7}} | |||||
<div class="mod-chicken-head"> | |||||
<div class="mod-chicken-head-image" mod-role="input-control-port" mod-port-symbol="{{symbol}}"></div> | |||||
<span class="mod-chicken-head-title">{{name}}</span> | |||||
</div> | |||||
{{/controls.7}} | |||||
<div class="mod-separator"></div> | |||||
{{#controls.8}} | |||||
<div class="mod-chicken-head"> | |||||
<div class="mod-chicken-head-image" mod-role="input-control-port" mod-port-symbol="{{symbol}}"></div> | |||||
<span class="mod-chicken-head-title">{{name}}</span> | |||||
</div> | |||||
{{/controls.8}} | |||||
</div> | |||||
<div class="mod-pedal-input"> | |||||
{{#effect.ports.audio.input}} | |||||
<div class="mod-input mod-input-disconnected" title="{{name}}" mod-role="input-audio-port" mod-port-symbol="{{symbol}}"> | |||||
<div class="mod-pedal-input-image"></div> | |||||
</div> | |||||
{{/effect.ports.audio.input}} | |||||
{{#effect.ports.midi.input}} | |||||
<div class="mod-input mod-input-disconnected" title="{{name}}" mod-role="input-midi-port" mod-port-symbol="{{symbol}}"> | |||||
<div class="mod-pedal-input-image"></div> | |||||
</div> | |||||
{{/effect.ports.midi.input}} | |||||
</div> | |||||
<div class="mod-pedal-output"> | |||||
{{#effect.ports.audio.output}} | |||||
<div class="mod-output mod-output-disconnected" title="{{name}}" mod-role="output-audio-port" mod-port-symbol="{{symbol}}"> | |||||
<div class="mod-pedal-output-image"></div> | |||||
</div> | |||||
{{/effect.ports.audio.output}} | |||||
{{#effect.ports.midi.output}} | |||||
<div class="mod-output mod-output-disconnected" title="{{name}}" mod-role="output-midi-port" mod-port-symbol="{{symbol}}"> | |||||
<div class="mod-pedal-input-image"></div> | |||||
</div> | |||||
{{/effect.ports.midi.output}} | |||||
</div> | |||||
</div> |
@@ -0,0 +1,11 @@ | |||||
@prefix mod: <http://portalmod.com/ns/modgui#>. | |||||
<http://distrho.sf.net/plugins/PingPongPan> | |||||
mod:gui [ | |||||
a mod:Gui; | |||||
mod:resourcesDirectory <modgui>; | |||||
mod:iconTemplate <modgui/icon-ppp.html>; | |||||
mod:templateData <modgui/data-ppp.json>; | |||||
mod:screenshot <modgui/screenshot-ppp.png>; | |||||
mod:thumbnail <modgui/thumb-ppp.png>; | |||||
] . |
@@ -0,0 +1,15 @@ | |||||
{ | |||||
"author": "DISTRHO", | |||||
"color": "yellow", | |||||
"controls": [ | |||||
{ | |||||
"name": "Frequency", | |||||
"symbol": "freq" | |||||
}, | |||||
{ | |||||
"name": "Width", | |||||
"symbol": "with" | |||||
} | |||||
], | |||||
"label": "Ping Pong Pan" | |||||
} |
@@ -0,0 +1,108 @@ | |||||
<div class="pingpongpan mod-pedal mod-pedal-boxy "> | |||||
<div mod-role="drag-handle" class="mod-drag-handle"></div> | |||||
<div class="mod-light on" mod-role="bypass-light"></div> | |||||
<div class="mod-control-group clearfix"> | |||||
<div class="mod-knob pingpongpan-knob_freq"> | |||||
<div class="mod-knob-image" mod-role="input-control-port" mod-port-symbol="freq"></div> | |||||
</div> | |||||
<div class="mod-knob pingpongpan-knob_width"> | |||||
<div class="mod-knob-image" mod-role="input-control-port" mod-port-symbol="with"></div> | |||||
</div> | |||||
</div> | |||||
<div class="mod-footswitch" mod-role="bypass"></div> | |||||
<div class="mod-pedal-input"> | |||||
{{#effect.ports.audio.input}} | |||||
<div class="mod-input mod-input-disconnected" title="{{name}}" mod-role="input-audio-port" mod-port-symbol="{{symbol}}"> | |||||
<div class="mod-pedal-input-image"></div> | |||||
</div> | |||||
{{/effect.ports.audio.input}} | |||||
{{#effect.ports.midi.input}} | |||||
<div class="mod-input mod-input-disconnected" title="{{name}}" mod-role="input-midi-port" mod-port-symbol="{{symbol}}"> | |||||
<div class="mod-pedal-input-image"></div> | |||||
</div> | |||||
{{/effect.ports.midi.input}} | |||||
</div> | |||||
<div class="mod-pedal-output"> | |||||
{{#effect.ports.audio.output}} | |||||
<div class="mod-output mod-output-disconnected" title="{{name}}" mod-role="output-audio-port" mod-port-symbol="{{symbol}}"> | |||||
<div class="mod-pedal-output-image"></div> | |||||
</div> | |||||
{{/effect.ports.audio.output}} | |||||
{{#effect.ports.midi.output}} | |||||
<div class="mod-output mod-output-disconnected" title="{{name}}" mod-role="output-midi-port" mod-port-symbol="{{symbol}}"> | |||||
<div class="mod-pedal-input-image"></div> | |||||
</div> | |||||
{{/effect.ports.midi.output}} | |||||
</div> | |||||
</div> | |||||
<style> | |||||
.pingpongpan * { | |||||
color:black !important; | |||||
} | |||||
.pingpongpan { | |||||
background-image:url(/resources/background.png{{{ns}}}) !important; | |||||
background-size:615px 344px; | |||||
width:615px; | |||||
height:344px; | |||||
} | |||||
.pingpongpan .mod-control-group { | |||||
width:500px; | |||||
height:220px; | |||||
} | |||||
.pingpongpan .mod-control-group .mod-knob { | |||||
height:220px !important; | |||||
} | |||||
.pingpongpan .mod-control-group .mod-knob .mod-knob-image { | |||||
background-image:url(/resources/knob.png{{{ns}}}); | |||||
background-position:left center; | |||||
background-repeat:no-repeat; | |||||
background-size:auto 220px; | |||||
height:220px; | |||||
width:220px; | |||||
margin:0 auto; | |||||
cursor:pointer; | |||||
position:relative; | |||||
overflow:hidden; | |||||
} | |||||
.pingpongpan .mod-control-group .pingpongpan-knob_freq { | |||||
top:55px; | |||||
left:58px; | |||||
position:absolute; | |||||
} | |||||
.pingpongpan .mod-control-group .pingpongpan-knob_width { | |||||
top:55px; | |||||
left:302px; | |||||
position:absolute; | |||||
} | |||||
.pingpongpan .mod-light { | |||||
top:32px; | |||||
left:320px; | |||||
} | |||||
.pingpongpan .mod-footswitch { | |||||
background-image:url(/resources/footswitch.png{{{ns}}}); | |||||
background-position:top center; | |||||
background-repeat:no-repeat; | |||||
background-size:auto 132px; | |||||
top:15px; | |||||
left:430px !important; | |||||
cursor:pointer; | |||||
height:66px; | |||||
position:absolute; | |||||
} | |||||
.pingpongpan .mod-footswitch.on { | |||||
background-position:top center; | |||||
} | |||||
.pingpongpan .mod-footswitch.off { | |||||
background-position:bottom center; | |||||
} | |||||
.pingpongpan .mod-pedal-input , .pingpongpan .mod-pedal-output { | |||||
top: 60px; | |||||
} | |||||
.pingpongpan .mod-pedal-input .mod-input , .pingpongpan .mod-pedal-output .mod-output { | |||||
margin-bottom: 40px !important | |||||
} | |||||
</style> |
@@ -0,0 +1,40 @@ | |||||
/* (Auto-generated binary data file). */ | |||||
#ifndef BINARY_DISTRHOARTWORK3BANDEQ_HPP | |||||
#define BINARY_DISTRHOARTWORK3BANDEQ_HPP | |||||
namespace DistrhoArtwork3BandEQ | |||||
{ | |||||
extern const char* aboutData; | |||||
const unsigned int aboutDataSize = 172710; | |||||
const unsigned int aboutWidth = 303; | |||||
const unsigned int aboutHeight = 190; | |||||
extern const char* aboutButtonHoverData; | |||||
const unsigned int aboutButtonHoverDataSize = 5888; | |||||
const unsigned int aboutButtonHoverWidth = 92; | |||||
const unsigned int aboutButtonHoverHeight = 16; | |||||
extern const char* aboutButtonNormalData; | |||||
const unsigned int aboutButtonNormalDataSize = 5888; | |||||
const unsigned int aboutButtonNormalWidth = 92; | |||||
const unsigned int aboutButtonNormalHeight = 16; | |||||
extern const char* backgroundData; | |||||
const unsigned int backgroundDataSize = 437472; | |||||
const unsigned int backgroundWidth = 392; | |||||
const unsigned int backgroundHeight = 372; | |||||
extern const char* knobData; | |||||
const unsigned int knobDataSize = 15376; | |||||
const unsigned int knobWidth = 62; | |||||
const unsigned int knobHeight = 62; | |||||
extern const char* sliderData; | |||||
const unsigned int sliderDataSize = 6000; | |||||
const unsigned int sliderWidth = 50; | |||||
const unsigned int sliderHeight = 30; | |||||
} | |||||
#endif // BINARY_DISTRHOARTWORK3BANDEQ_HPP | |||||
@@ -0,0 +1,264 @@ | |||||
/* | |||||
* DISTRHO 3BandEQ Plugin, based on 3BandEQ by Michael Gruhn | |||||
* Copyright (C) 2007 Michael Gruhn <michael-gruhn@web.de> | |||||
* Copyright (C) 2012-2015 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 | |||||
* License as published by the Free Software Foundation. | |||||
* | |||||
* This program is distributed in the hope that it will be useful, | |||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
* GNU Lesser General Public License for more details. | |||||
* | |||||
* For a full copy of the license see the LICENSE file. | |||||
*/ | |||||
#include "DistrhoPlugin3BandEQ.hpp" | |||||
#include <cmath> | |||||
static const float kAMP_DB = 8.656170245f; | |||||
static const float kDC_ADD = 1e-30f; | |||||
static const float kPI = 3.141592654f; | |||||
START_NAMESPACE_DISTRHO | |||||
// ----------------------------------------------------------------------- | |||||
DistrhoPlugin3BandEQ::DistrhoPlugin3BandEQ() | |||||
: Plugin(paramCount, 1, 0) // 1 program, 0 states | |||||
{ | |||||
// set default values | |||||
loadProgram(0); | |||||
// reset | |||||
deactivate(); | |||||
} | |||||
// ----------------------------------------------------------------------- | |||||
// Init | |||||
void DistrhoPlugin3BandEQ::initParameter(uint32_t index, Parameter& parameter) | |||||
{ | |||||
switch (index) | |||||
{ | |||||
case paramLow: | |||||
parameter.hints = kParameterIsAutomable; | |||||
parameter.name = "Low"; | |||||
parameter.symbol = "low"; | |||||
parameter.unit = "dB"; | |||||
parameter.ranges.def = 0.0f; | |||||
parameter.ranges.min = -24.0f; | |||||
parameter.ranges.max = 24.0f; | |||||
break; | |||||
case paramMid: | |||||
parameter.hints = kParameterIsAutomable; | |||||
parameter.name = "Mid"; | |||||
parameter.symbol = "mid"; | |||||
parameter.unit = "dB"; | |||||
parameter.ranges.def = 0.0f; | |||||
parameter.ranges.min = -24.0f; | |||||
parameter.ranges.max = 24.0f; | |||||
break; | |||||
case paramHigh: | |||||
parameter.hints = kParameterIsAutomable; | |||||
parameter.name = "High"; | |||||
parameter.symbol = "high"; | |||||
parameter.unit = "dB"; | |||||
parameter.ranges.def = 0.0f; | |||||
parameter.ranges.min = -24.0f; | |||||
parameter.ranges.max = 24.0f; | |||||
break; | |||||
case paramMaster: | |||||
parameter.hints = kParameterIsAutomable; | |||||
parameter.name = "Master"; | |||||
parameter.symbol = "master"; | |||||
parameter.unit = "dB"; | |||||
parameter.ranges.def = 0.0f; | |||||
parameter.ranges.min = -24.0f; | |||||
parameter.ranges.max = 24.0f; | |||||
break; | |||||
case paramLowMidFreq: | |||||
parameter.hints = kParameterIsAutomable; | |||||
parameter.name = "Low-Mid Freq"; | |||||
parameter.symbol = "low_mid"; | |||||
parameter.unit = "Hz"; | |||||
parameter.ranges.def = 440.0f; | |||||
parameter.ranges.min = 0.0f; | |||||
parameter.ranges.max = 1000.0f; | |||||
break; | |||||
case paramMidHighFreq: | |||||
parameter.hints = kParameterIsAutomable; | |||||
parameter.name = "Mid-High Freq"; | |||||
parameter.symbol = "mid_high"; | |||||
parameter.unit = "Hz"; | |||||
parameter.ranges.def = 1000.0f; | |||||
parameter.ranges.min = 1000.0f; | |||||
parameter.ranges.max = 20000.0f; | |||||
break; | |||||
} | |||||
} | |||||
void DistrhoPlugin3BandEQ::initProgramName(uint32_t index, String& programName) | |||||
{ | |||||
if (index != 0) | |||||
return; | |||||
programName = "Default"; | |||||
} | |||||
// ----------------------------------------------------------------------- | |||||
// Internal data | |||||
float DistrhoPlugin3BandEQ::getParameterValue(uint32_t index) const | |||||
{ | |||||
switch (index) | |||||
{ | |||||
case paramLow: | |||||
return fLow; | |||||
case paramMid: | |||||
return fMid; | |||||
case paramHigh: | |||||
return fHigh; | |||||
case paramMaster: | |||||
return fMaster; | |||||
case paramLowMidFreq: | |||||
return fLowMidFreq; | |||||
case paramMidHighFreq: | |||||
return fMidHighFreq; | |||||
default: | |||||
return 0.0f; | |||||
} | |||||
} | |||||
void DistrhoPlugin3BandEQ::setParameterValue(uint32_t index, float value) | |||||
{ | |||||
if (getSampleRate() <= 0.0) | |||||
return; | |||||
switch (index) | |||||
{ | |||||
case paramLow: | |||||
fLow = value; | |||||
lowVol = std::exp( (fLow/48.0f) * 48.0f / kAMP_DB); | |||||
break; | |||||
case paramMid: | |||||
fMid = value; | |||||
midVol = std::exp( (fMid/48.0f) * 48.0f / kAMP_DB); | |||||
break; | |||||
case paramHigh: | |||||
fHigh = value; | |||||
highVol = std::exp( (fHigh/48.0f) * 48.0f / kAMP_DB); | |||||
break; | |||||
case paramMaster: | |||||
fMaster = value; | |||||
outVol = std::exp( (fMaster/48.0f) * 48.0f / kAMP_DB); | |||||
break; | |||||
case paramLowMidFreq: | |||||
fLowMidFreq = std::fmin(value, fMidHighFreq); | |||||
freqLP = fLowMidFreq; | |||||
xLP = std::exp(-2.0f * kPI * freqLP / (float)getSampleRate()); | |||||
a0LP = 1.0f - xLP; | |||||
b1LP = -xLP; | |||||
break; | |||||
case paramMidHighFreq: | |||||
fMidHighFreq = std::fmax(value, fLowMidFreq); | |||||
freqHP = fMidHighFreq; | |||||
xHP = std::exp(-2.0f * kPI * freqHP / (float)getSampleRate()); | |||||
a0HP = 1.0f - xHP; | |||||
b1HP = -xHP; | |||||
break; | |||||
} | |||||
} | |||||
void DistrhoPlugin3BandEQ::loadProgram(uint32_t index) | |||||
{ | |||||
if (index != 0) | |||||
return; | |||||
// Default values | |||||
fLow = 0.0f; | |||||
fMid = 0.0f; | |||||
fHigh = 0.0f; | |||||
fMaster = 0.0f; | |||||
fLowMidFreq = 220.0f; | |||||
fMidHighFreq = 2000.0f; | |||||
// Internal stuff | |||||
lowVol = midVol = highVol = outVol = 1.0f; | |||||
freqLP = 200.0f; | |||||
freqHP = 2000.0f; | |||||
// reset filter values | |||||
activate(); | |||||
} | |||||
// ----------------------------------------------------------------------- | |||||
// Process | |||||
void DistrhoPlugin3BandEQ::activate() | |||||
{ | |||||
const float sr = (float)getSampleRate(); | |||||
xLP = std::exp(-2.0f * kPI * freqLP / sr); | |||||
#ifdef DISTRHO_OS_WINDOWS | |||||
// don't ask me why, but this fixes a crash/exception below on windows... | |||||
printf("%f\n", -xLP); | |||||
#endif | |||||
a0LP = 1.0f - xLP; | |||||
b1LP = -xLP; | |||||
xHP = std::exp(-2.0f * kPI * freqHP / sr); | |||||
a0HP = 1.0f - xHP; | |||||
b1HP = -xHP; | |||||
} | |||||
void DistrhoPlugin3BandEQ::deactivate() | |||||
{ | |||||
out1LP = out2LP = out1HP = out2HP = 0.0f; | |||||
tmp1LP = tmp2LP = tmp1HP = tmp2HP = 0.0f; | |||||
} | |||||
void DistrhoPlugin3BandEQ::run(const float** inputs, float** outputs, uint32_t frames) | |||||
{ | |||||
const float* in1 = inputs[0]; | |||||
const float* in2 = inputs[1]; | |||||
float* out1 = outputs[0]; | |||||
float* out2 = outputs[1]; | |||||
for (uint32_t i=0; i < frames; ++i) | |||||
{ | |||||
tmp1LP = a0LP * in1[i] - b1LP * tmp1LP + kDC_ADD; | |||||
tmp2LP = a0LP * in2[i] - b1LP * tmp2LP + kDC_ADD; | |||||
out1LP = tmp1LP - kDC_ADD; | |||||
out2LP = tmp2LP - kDC_ADD; | |||||
tmp1HP = a0HP * in1[i] - b1HP * tmp1HP + kDC_ADD; | |||||
tmp2HP = a0HP * in2[i] - b1HP * tmp2HP + kDC_ADD; | |||||
out1HP = in1[i] - tmp1HP - kDC_ADD; | |||||
out2HP = in2[i] - tmp2HP - kDC_ADD; | |||||
out1[i] = (out1LP*lowVol + (in1[i] - out1LP - out1HP)*midVol + out1HP*highVol) * outVol; | |||||
out2[i] = (out2LP*lowVol + (in2[i] - out2LP - out2HP)*midVol + out2HP*highVol) * outVol; | |||||
} | |||||
} | |||||
// ----------------------------------------------------------------------- | |||||
Plugin* createPlugin() | |||||
{ | |||||
return new DistrhoPlugin3BandEQ(); | |||||
} | |||||
// ----------------------------------------------------------------------- | |||||
END_NAMESPACE_DISTRHO |
@@ -0,0 +1,113 @@ | |||||
/* | |||||
* DISTRHO 3BandEQ Plugin, based on 3BandEQ by Michael Gruhn | |||||
* Copyright (C) 2007 Michael Gruhn <michael-gruhn@web.de> | |||||
* Copyright (C) 2012-2015 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 | |||||
* License as published by the Free Software Foundation. | |||||
* | |||||
* This program is distributed in the hope that it will be useful, | |||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
* GNU Lesser General Public License for more details. | |||||
* | |||||
* For a full copy of the license see the LICENSE file. | |||||
*/ | |||||
#ifndef DISTRHO_PLUGIN_3BANDEQ_HPP_INCLUDED | |||||
#define DISTRHO_PLUGIN_3BANDEQ_HPP_INCLUDED | |||||
#include "DistrhoPlugin.hpp" | |||||
START_NAMESPACE_DISTRHO | |||||
// ----------------------------------------------------------------------- | |||||
class DistrhoPlugin3BandEQ : public Plugin | |||||
{ | |||||
public: | |||||
enum Parameters | |||||
{ | |||||
paramLow = 0, | |||||
paramMid, | |||||
paramHigh, | |||||
paramMaster, | |||||
paramLowMidFreq, | |||||
paramMidHighFreq, | |||||
paramCount | |||||
}; | |||||
DistrhoPlugin3BandEQ(); | |||||
protected: | |||||
// ------------------------------------------------------------------- | |||||
// Information | |||||
const char* getLabel() const noexcept override | |||||
{ | |||||
return "3BandEQ"; | |||||
} | |||||
const char* getMaker() const noexcept override | |||||
{ | |||||
return "DISTRHO"; | |||||
} | |||||
const char* getLicense() const noexcept override | |||||
{ | |||||
return "LGPL"; | |||||
} | |||||
uint32_t getVersion() const noexcept override | |||||
{ | |||||
return 0x1000; | |||||
} | |||||
int64_t getUniqueId() const noexcept override | |||||
{ | |||||
return d_cconst('D', '3', 'E', 'Q'); | |||||
} | |||||
// ------------------------------------------------------------------- | |||||
// Init | |||||
void initParameter(uint32_t index, Parameter& parameter) override; | |||||
void initProgramName(uint32_t index, String& programName) override; | |||||
// ------------------------------------------------------------------- | |||||
// Internal data | |||||
float getParameterValue(uint32_t index) const override; | |||||
void setParameterValue(uint32_t index, float value) override; | |||||
void loadProgram(uint32_t index) override; | |||||
// ------------------------------------------------------------------- | |||||
// Process | |||||
void activate() override; | |||||
void deactivate() override; | |||||
void run(const float** inputs, float** outputs, uint32_t frames) override; | |||||
// ------------------------------------------------------------------- | |||||
private: | |||||
float fLow, fMid, fHigh, fMaster, fLowMidFreq, fMidHighFreq; | |||||
float lowVol, midVol, highVol, outVol; | |||||
float freqLP, freqHP; | |||||
float xLP, a0LP, b1LP; | |||||
float xHP, a0HP, b1HP; | |||||
float out1LP, out2LP, out1HP, out2HP; | |||||
float tmp1LP, tmp2LP, tmp1HP, tmp2HP; | |||||
DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(DistrhoPlugin3BandEQ) | |||||
}; | |||||
// ----------------------------------------------------------------------- | |||||
END_NAMESPACE_DISTRHO | |||||
#endif // DISTRHO_PLUGIN_3BANDEQ_HPP_INCLUDED |
@@ -0,0 +1,29 @@ | |||||
/* | |||||
* DISTRHO 3BandEQ Plugin, based on 3BandEQ by Michael Gruhn | |||||
* Copyright (C) 2012-2015 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 | |||||
* License as published by the Free Software Foundation. | |||||
* | |||||
* This program is distributed in the hope that it will be useful, | |||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
* GNU Lesser General Public License for more details. | |||||
* | |||||
* For a full copy of the license see the LICENSE file. | |||||
*/ | |||||
#ifndef DISTRHO_PLUGIN_INFO_H_INCLUDED | |||||
#define DISTRHO_PLUGIN_INFO_H_INCLUDED | |||||
#define DISTRHO_PLUGIN_NAME "3 Band EQ" | |||||
#define DISTRHO_PLUGIN_URI "http://distrho.sf.net/plugins/3BandEQ" | |||||
#define DISTRHO_PLUGIN_HAS_UI 1 | |||||
#define DISTRHO_PLUGIN_IS_RT_SAFE 1 | |||||
#define DISTRHO_PLUGIN_NUM_INPUTS 2 | |||||
#define DISTRHO_PLUGIN_NUM_OUTPUTS 2 | |||||
#define DISTRHO_PLUGIN_WANT_PROGRAMS 1 | |||||
#endif // DISTRHO_PLUGIN_INFO_H_INCLUDED |
@@ -0,0 +1,211 @@ | |||||
/* | |||||
* DISTRHO 3BandEQ Plugin, based on 3BandEQ by Michael Gruhn | |||||
* Copyright (C) 2012-2015 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 | |||||
* License as published by the Free Software Foundation. | |||||
* | |||||
* This program is distributed in the hope that it will be useful, | |||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
* GNU Lesser General Public License for more details. | |||||
* | |||||
* For a full copy of the license see the LICENSE file. | |||||
*/ | |||||
#include "DistrhoPlugin3BandEQ.hpp" | |||||
#include "DistrhoUI3BandEQ.hpp" | |||||
START_NAMESPACE_DISTRHO | |||||
namespace Art = DistrhoArtwork3BandEQ; | |||||
// ----------------------------------------------------------------------- | |||||
DistrhoUI3BandEQ::DistrhoUI3BandEQ() | |||||
: UI(Art::backgroundWidth, Art::backgroundHeight), | |||||
fImgBackground(Art::backgroundData, Art::backgroundWidth, Art::backgroundHeight, GL_BGR), | |||||
fAboutWindow(this) | |||||
{ | |||||
// about | |||||
Image aboutImage(Art::aboutData, Art::aboutWidth, Art::aboutHeight, GL_BGR); | |||||
fAboutWindow.setImage(aboutImage); | |||||
// sliders | |||||
Image sliderImage(Art::sliderData, Art::sliderWidth, Art::sliderHeight); | |||||
Point<int> sliderPosStart(57, 43); | |||||
Point<int> sliderPosEnd(57, 43 + 160); | |||||
// slider Low | |||||
fSliderLow = new ImageSlider(this, sliderImage); | |||||
fSliderLow->setId(DistrhoPlugin3BandEQ::paramLow); | |||||
fSliderLow->setInverted(true); | |||||
fSliderLow->setStartPos(sliderPosStart); | |||||
fSliderLow->setEndPos(sliderPosEnd); | |||||
fSliderLow->setRange(-24.0f, 24.0f); | |||||
fSliderLow->setCallback(this); | |||||
// slider Mid | |||||
sliderPosStart.setX(120); | |||||
sliderPosEnd.setX(120); | |||||
fSliderMid = new ImageSlider(this, sliderImage); | |||||
fSliderMid->setId(DistrhoPlugin3BandEQ::paramMid); | |||||
fSliderMid->setInverted(true); | |||||
fSliderMid->setStartPos(sliderPosStart); | |||||
fSliderMid->setEndPos(sliderPosEnd); | |||||
fSliderMid->setRange(-24.0f, 24.0f); | |||||
fSliderMid->setCallback(this); | |||||
// slider High | |||||
sliderPosStart.setX(183); | |||||
sliderPosEnd.setX(183); | |||||
fSliderHigh = new ImageSlider(this, sliderImage); | |||||
fSliderHigh->setId(DistrhoPlugin3BandEQ::paramHigh); | |||||
fSliderHigh->setInverted(true); | |||||
fSliderHigh->setStartPos(sliderPosStart); | |||||
fSliderHigh->setEndPos(sliderPosEnd); | |||||
fSliderHigh->setRange(-24.0f, 24.0f); | |||||
fSliderHigh->setCallback(this); | |||||
// slider Master | |||||
sliderPosStart.setX(287); | |||||
sliderPosEnd.setX(287); | |||||
fSliderMaster = new ImageSlider(this, sliderImage); | |||||
fSliderMaster->setId(DistrhoPlugin3BandEQ::paramMaster); | |||||
fSliderMaster->setInverted(true); | |||||
fSliderMaster->setStartPos(sliderPosStart); | |||||
fSliderMaster->setEndPos(sliderPosEnd); | |||||
fSliderMaster->setRange(-24.0f, 24.0f); | |||||
fSliderMaster->setCallback(this); | |||||
// knobs | |||||
Image knobImage(Art::knobData, Art::knobWidth, Art::knobHeight); | |||||
// knob Low-Mid | |||||
fKnobLowMid = new ImageKnob(this, knobImage, ImageKnob::Vertical); | |||||
fKnobLowMid->setId(DistrhoPlugin3BandEQ::paramLowMidFreq); | |||||
fKnobLowMid->setAbsolutePos(65, 269); | |||||
fKnobLowMid->setRange(0.0f, 1000.0f); | |||||
fKnobLowMid->setDefault(440.0f); | |||||
fKnobLowMid->setRotationAngle(270); | |||||
fKnobLowMid->setCallback(this); | |||||
// knob Mid-High | |||||
fKnobMidHigh = new ImageKnob(this, knobImage, ImageKnob::Vertical); | |||||
fKnobMidHigh->setId(DistrhoPlugin3BandEQ::paramMidHighFreq); | |||||
fKnobMidHigh->setAbsolutePos(159, 269); | |||||
fKnobMidHigh->setRange(1000.0f, 20000.0f); | |||||
fKnobMidHigh->setDefault(1000.0f); | |||||
fKnobMidHigh->setRotationAngle(270); | |||||
fKnobMidHigh->setCallback(this); | |||||
// about button | |||||
Image aboutImageNormal(Art::aboutButtonNormalData, Art::aboutButtonNormalWidth, Art::aboutButtonNormalHeight); | |||||
Image aboutImageHover(Art::aboutButtonHoverData, Art::aboutButtonHoverWidth, Art::aboutButtonHoverHeight); | |||||
fButtonAbout = new ImageButton(this, aboutImageNormal, aboutImageHover, aboutImageHover); | |||||
fButtonAbout->setAbsolutePos(264, 300); | |||||
fButtonAbout->setCallback(this); | |||||
// set default values | |||||
programLoaded(0); | |||||
} | |||||
// ----------------------------------------------------------------------- | |||||
// DSP Callbacks | |||||
void DistrhoUI3BandEQ::parameterChanged(uint32_t index, float value) | |||||
{ | |||||
switch (index) | |||||
{ | |||||
case DistrhoPlugin3BandEQ::paramLow: | |||||
fSliderLow->setValue(value); | |||||
break; | |||||
case DistrhoPlugin3BandEQ::paramMid: | |||||
fSliderMid->setValue(value); | |||||
break; | |||||
case DistrhoPlugin3BandEQ::paramHigh: | |||||
fSliderHigh->setValue(value); | |||||
break; | |||||
case DistrhoPlugin3BandEQ::paramMaster: | |||||
fSliderMaster->setValue(value); | |||||
break; | |||||
case DistrhoPlugin3BandEQ::paramLowMidFreq: | |||||
fKnobLowMid->setValue(value); | |||||
break; | |||||
case DistrhoPlugin3BandEQ::paramMidHighFreq: | |||||
fKnobMidHigh->setValue(value); | |||||
break; | |||||
} | |||||
} | |||||
void DistrhoUI3BandEQ::programLoaded(uint32_t index) | |||||
{ | |||||
if (index != 0) | |||||
return; | |||||
// Default values | |||||
fSliderLow->setValue(0.0f); | |||||
fSliderMid->setValue(0.0f); | |||||
fSliderHigh->setValue(0.0f); | |||||
fSliderMaster->setValue(0.0f); | |||||
fKnobLowMid->setValue(220.0f); | |||||
fKnobMidHigh->setValue(2000.0f); | |||||
} | |||||
// ----------------------------------------------------------------------- | |||||
// Widget Callbacks | |||||
void DistrhoUI3BandEQ::imageButtonClicked(ImageButton* button, int) | |||||
{ | |||||
if (button != fButtonAbout) | |||||
return; | |||||
fAboutWindow.exec(); | |||||
} | |||||
void DistrhoUI3BandEQ::imageKnobDragStarted(ImageKnob* knob) | |||||
{ | |||||
editParameter(knob->getId(), true); | |||||
} | |||||
void DistrhoUI3BandEQ::imageKnobDragFinished(ImageKnob* knob) | |||||
{ | |||||
editParameter(knob->getId(), false); | |||||
} | |||||
void DistrhoUI3BandEQ::imageKnobValueChanged(ImageKnob* knob, float value) | |||||
{ | |||||
setParameterValue(knob->getId(), value); | |||||
} | |||||
void DistrhoUI3BandEQ::imageSliderDragStarted(ImageSlider* slider) | |||||
{ | |||||
editParameter(slider->getId(), true); | |||||
} | |||||
void DistrhoUI3BandEQ::imageSliderDragFinished(ImageSlider* slider) | |||||
{ | |||||
editParameter(slider->getId(), false); | |||||
} | |||||
void DistrhoUI3BandEQ::imageSliderValueChanged(ImageSlider* slider, float value) | |||||
{ | |||||
setParameterValue(slider->getId(), value); | |||||
} | |||||
void DistrhoUI3BandEQ::onDisplay() | |||||
{ | |||||
fImgBackground.draw(); | |||||
} | |||||
// ----------------------------------------------------------------------- | |||||
UI* createUI() | |||||
{ | |||||
return new DistrhoUI3BandEQ(); | |||||
} | |||||
// ----------------------------------------------------------------------- | |||||
END_NAMESPACE_DISTRHO |
@@ -0,0 +1,72 @@ | |||||
/* | |||||
* DISTRHO 3BandEQ Plugin, based on 3BandEQ by Michael Gruhn | |||||
* Copyright (C) 2012-2015 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 | |||||
* License as published by the Free Software Foundation. | |||||
* | |||||
* This program is distributed in the hope that it will be useful, | |||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
* GNU Lesser General Public License for more details. | |||||
* | |||||
* For a full copy of the license see the LICENSE file. | |||||
*/ | |||||
#ifndef DISTRHO_UI_3BANDEQ_HPP_INCLUDED | |||||
#define DISTRHO_UI_3BANDEQ_HPP_INCLUDED | |||||
#include "DistrhoUI.hpp" | |||||
#include "ImageWidgets.hpp" | |||||
#include "DistrhoArtwork3BandEQ.hpp" | |||||
START_NAMESPACE_DISTRHO | |||||
// ----------------------------------------------------------------------- | |||||
class DistrhoUI3BandEQ : public UI, | |||||
public ImageButton::Callback, | |||||
public ImageKnob::Callback, | |||||
public ImageSlider::Callback | |||||
{ | |||||
public: | |||||
DistrhoUI3BandEQ(); | |||||
protected: | |||||
// ------------------------------------------------------------------- | |||||
// DSP Callbacks | |||||
void parameterChanged(uint32_t index, float value) override; | |||||
void programLoaded(uint32_t index) override; | |||||
// ------------------------------------------------------------------- | |||||
// Widget Callbacks | |||||
void imageButtonClicked(ImageButton* button, int) override; | |||||
void imageKnobDragStarted(ImageKnob* knob) override; | |||||
void imageKnobDragFinished(ImageKnob* knob) override; | |||||
void imageKnobValueChanged(ImageKnob* knob, float value) override; | |||||
void imageSliderDragStarted(ImageSlider* slider) override; | |||||
void imageSliderDragFinished(ImageSlider* slider) override; | |||||
void imageSliderValueChanged(ImageSlider* slider, float value) override; | |||||
void onDisplay() override; | |||||
private: | |||||
Image fImgBackground; | |||||
ImageAboutWindow fAboutWindow; | |||||
ScopedPointer<ImageButton> fButtonAbout; | |||||
ScopedPointer<ImageKnob> fKnobLowMid, fKnobMidHigh; | |||||
ScopedPointer<ImageSlider> fSliderLow, fSliderMid, fSliderHigh, fSliderMaster; | |||||
DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(DistrhoUI3BandEQ) | |||||
}; | |||||
// ----------------------------------------------------------------------- | |||||
END_NAMESPACE_DISTRHO | |||||
#endif // DISTRHO_UI_3BANDEQ_HPP_INCLUDED |
@@ -0,0 +1,55 @@ | |||||
#!/usr/bin/make -f | |||||
# Makefile for DISTRHO Plugins # | |||||
# ---------------------------- # | |||||
# Created by falkTX | |||||
# | |||||
# -------------------------------------------------------------- | |||||
# Project name, used for binaries | |||||
NAME = 3BandEQ | |||||
# -------------------------------------------------------------- | |||||
# Files to build | |||||
OBJS_DSP = \ | |||||
DistrhoPlugin3BandEQ.cpp.o | |||||
OBJS_UI = \ | |||||
DistrhoArtwork3BandEQ.cpp.o \ | |||||
DistrhoUI3BandEQ.cpp.o | |||||
# -------------------------------------------------------------- | |||||
# Do some magic | |||||
include ../Makefile.Mini-Series.mk | |||||
# -------------------------------------------------------------- | |||||
# Enable all possible plugin types | |||||
ifeq ($(HAVE_DGL),true) | |||||
ifeq ($(HAVE_JACK),true) | |||||
TARGETS += jack | |||||
endif | |||||
endif | |||||
ifeq ($(LINUX),true) | |||||
TARGETS += ladspa | |||||
ifeq ($(HAVE_DGL),true) | |||||
ifeq ($(HAVE_LIBLO),true) | |||||
TARGETS += dssi | |||||
endif | |||||
endif | |||||
endif | |||||
ifeq ($(HAVE_DGL),true) | |||||
TARGETS += lv2_sep | |||||
else | |||||
TARGETS += lv2_dsp | |||||
endif | |||||
TARGETS += vst | |||||
all: $(TARGETS) | |||||
# -------------------------------------------------------------- |
@@ -0,0 +1,40 @@ | |||||
/* (Auto-generated binary data file). */ | |||||
#ifndef BINARY_DISTRHOARTWORK3BANDSPLITTER_HPP | |||||
#define BINARY_DISTRHOARTWORK3BANDSPLITTER_HPP | |||||
namespace DistrhoArtwork3BandSplitter | |||||
{ | |||||
extern const char* aboutData; | |||||
const unsigned int aboutDataSize = 172710; | |||||
const unsigned int aboutWidth = 303; | |||||
const unsigned int aboutHeight = 190; | |||||
extern const char* aboutButtonHoverData; | |||||
const unsigned int aboutButtonHoverDataSize = 5888; | |||||
const unsigned int aboutButtonHoverWidth = 92; | |||||
const unsigned int aboutButtonHoverHeight = 16; | |||||
extern const char* aboutButtonNormalData; | |||||
const unsigned int aboutButtonNormalDataSize = 5888; | |||||
const unsigned int aboutButtonNormalWidth = 92; | |||||
const unsigned int aboutButtonNormalHeight = 16; | |||||
extern const char* backgroundData; | |||||
const unsigned int backgroundDataSize = 437472; | |||||
const unsigned int backgroundWidth = 392; | |||||
const unsigned int backgroundHeight = 372; | |||||
extern const char* knobData; | |||||
const unsigned int knobDataSize = 15376; | |||||
const unsigned int knobWidth = 62; | |||||
const unsigned int knobHeight = 62; | |||||
extern const char* sliderData; | |||||
const unsigned int sliderDataSize = 6000; | |||||
const unsigned int sliderWidth = 50; | |||||
const unsigned int sliderHeight = 30; | |||||
} | |||||
#endif // BINARY_DISTRHOARTWORK3BANDSPLITTER_HPP | |||||
@@ -0,0 +1,272 @@ | |||||
/* | |||||
* DISTRHO 3BandSplitter Plugin, based on 3BandSplitter by Michael Gruhn | |||||
* Copyright (C) 2007 Michael Gruhn <michael-gruhn@web.de> | |||||
* Copyright (C) 2012-2015 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 | |||||
* License as published by the Free Software Foundation. | |||||
* | |||||
* This program is distributed in the hope that it will be useful, | |||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
* GNU Lesser General Public License for more details. | |||||
* | |||||
* For a full copy of the license see the LICENSE file. | |||||
*/ | |||||
#include "DistrhoPlugin3BandSplitter.hpp" | |||||
#include <cmath> | |||||
static const float kAMP_DB = 8.656170245f; | |||||
static const float kDC_ADD = 1e-30f; | |||||
static const float kPI = 3.141592654f; | |||||
START_NAMESPACE_DISTRHO | |||||
// ----------------------------------------------------------------------- | |||||
DistrhoPlugin3BandSplitter::DistrhoPlugin3BandSplitter() | |||||
: Plugin(paramCount, 1, 0) // 1 program, 0 states | |||||
{ | |||||
// set default values | |||||
loadProgram(0); | |||||
// reset | |||||
deactivate(); | |||||
} | |||||
// ----------------------------------------------------------------------- | |||||
// Init | |||||
void DistrhoPlugin3BandSplitter::initParameter(uint32_t index, Parameter& parameter) | |||||
{ | |||||
switch (index) | |||||
{ | |||||
case paramLow: | |||||
parameter.hints = kParameterIsAutomable; | |||||
parameter.name = "Low"; | |||||
parameter.symbol = "low"; | |||||
parameter.unit = "dB"; | |||||
parameter.ranges.def = 0.0f; | |||||
parameter.ranges.min = -24.0f; | |||||
parameter.ranges.max = 24.0f; | |||||
break; | |||||
case paramMid: | |||||
parameter.hints = kParameterIsAutomable; | |||||
parameter.name = "Mid"; | |||||
parameter.symbol = "mid"; | |||||
parameter.unit = "dB"; | |||||
parameter.ranges.def = 0.0f; | |||||
parameter.ranges.min = -24.0f; | |||||
parameter.ranges.max = 24.0f; | |||||
break; | |||||
case paramHigh: | |||||
parameter.hints = kParameterIsAutomable; | |||||
parameter.name = "High"; | |||||
parameter.symbol = "high"; | |||||
parameter.unit = "dB"; | |||||
parameter.ranges.def = 0.0f; | |||||
parameter.ranges.min = -24.0f; | |||||
parameter.ranges.max = 24.0f; | |||||
break; | |||||
case paramMaster: | |||||
parameter.hints = kParameterIsAutomable; | |||||
parameter.name = "Master"; | |||||
parameter.symbol = "master"; | |||||
parameter.unit = "dB"; | |||||
parameter.ranges.def = 0.0f; | |||||
parameter.ranges.min = -24.0f; | |||||
parameter.ranges.max = 24.0f; | |||||
break; | |||||
case paramLowMidFreq: | |||||
parameter.hints = kParameterIsAutomable; | |||||
parameter.name = "Low-Mid Freq"; | |||||
parameter.symbol = "low_mid"; | |||||
parameter.unit = "Hz"; | |||||
parameter.ranges.def = 440.0f; | |||||
parameter.ranges.min = 0.0f; | |||||
parameter.ranges.max = 1000.0f; | |||||
break; | |||||
case paramMidHighFreq: | |||||
parameter.hints = kParameterIsAutomable; | |||||
parameter.name = "Mid-High Freq"; | |||||
parameter.symbol = "mid_high"; | |||||
parameter.unit = "Hz"; | |||||
parameter.ranges.def = 1000.0f; | |||||
parameter.ranges.min = 1000.0f; | |||||
parameter.ranges.max = 20000.0f; | |||||
break; | |||||
} | |||||
} | |||||
void DistrhoPlugin3BandSplitter::initProgramName(uint32_t index, String& programName) | |||||
{ | |||||
if (index != 0) | |||||
return; | |||||
programName = "Default"; | |||||
} | |||||
// ----------------------------------------------------------------------- | |||||
// Internal data | |||||
float DistrhoPlugin3BandSplitter::getParameterValue(uint32_t index) const | |||||
{ | |||||
switch (index) | |||||
{ | |||||
case paramLow: | |||||
return fLow; | |||||
case paramMid: | |||||
return fMid; | |||||
case paramHigh: | |||||
return fHigh; | |||||
case paramMaster: | |||||
return fMaster; | |||||
case paramLowMidFreq: | |||||
return fLowMidFreq; | |||||
case paramMidHighFreq: | |||||
return fMidHighFreq; | |||||
default: | |||||
return 0.0f; | |||||
} | |||||
} | |||||
void DistrhoPlugin3BandSplitter::setParameterValue(uint32_t index, float value) | |||||
{ | |||||
if (getSampleRate() <= 0.0) | |||||
return; | |||||
switch (index) | |||||
{ | |||||
case paramLow: | |||||
fLow = value; | |||||
lowVol = std::exp( (fLow/48.0f) * 48.0f / kAMP_DB); | |||||
break; | |||||
case paramMid: | |||||
fMid = value; | |||||
midVol = std::exp( (fMid/48.0f) * 48.0f / kAMP_DB); | |||||
break; | |||||
case paramHigh: | |||||
fHigh = value; | |||||
highVol = std::exp( (fHigh/48.0f) * 48.0f / kAMP_DB); | |||||
break; | |||||
case paramMaster: | |||||
fMaster = value; | |||||
outVol = std::exp( (fMaster/48.0f) * 48.0f / kAMP_DB); | |||||
break; | |||||
case paramLowMidFreq: | |||||
fLowMidFreq = std::fmin(value, fMidHighFreq); | |||||
freqLP = fLowMidFreq; | |||||
xLP = std::exp(-2.0f * kPI * freqLP / (float)getSampleRate()); | |||||
a0LP = 1.0f - xLP; | |||||
b1LP = -xLP; | |||||
break; | |||||
case paramMidHighFreq: | |||||
fMidHighFreq = std::fmax(value, fLowMidFreq); | |||||
freqHP = fMidHighFreq; | |||||
xHP = std::exp(-2.0f * kPI * freqHP / (float)getSampleRate()); | |||||
a0HP = 1.0f - xHP; | |||||
b1HP = -xHP; | |||||
break; | |||||
} | |||||
} | |||||
void DistrhoPlugin3BandSplitter::loadProgram(uint32_t index) | |||||
{ | |||||
if (index != 0) | |||||
return; | |||||
// Default values | |||||
fLow = 0.0f; | |||||
fMid = 0.0f; | |||||
fHigh = 0.0f; | |||||
fMaster = 0.0f; | |||||
fLowMidFreq = 220.0f; | |||||
fMidHighFreq = 2000.0f; | |||||
// Internal stuff | |||||
lowVol = midVol = highVol = outVol = 1.0f; | |||||
freqLP = 200.0f; | |||||
freqHP = 2000.0f; | |||||
// reset filter values | |||||
activate(); | |||||
} | |||||
// ----------------------------------------------------------------------- | |||||
// Process | |||||
void DistrhoPlugin3BandSplitter::activate() | |||||
{ | |||||
const float sr = (float)getSampleRate(); | |||||
xLP = std::exp(-2.0f * kPI * freqLP / sr); | |||||
#ifdef DISTRHO_OS_WINDOWS | |||||
// don't ask me why, but this fixes a crash/exception below on windows... | |||||
printf("%f\n", -xLP); | |||||
#endif | |||||
a0LP = 1.0f - xLP; | |||||
b1LP = -xLP; | |||||
xHP = std::exp(-2.0f * kPI * freqHP / sr); | |||||
a0HP = 1.0f - xHP; | |||||
b1HP = -xHP; | |||||
} | |||||
void DistrhoPlugin3BandSplitter::deactivate() | |||||
{ | |||||
out1LP = out2LP = out1HP = out2HP = 0.0f; | |||||
tmp1LP = tmp2LP = tmp1HP = tmp2HP = 0.0f; | |||||
} | |||||
void DistrhoPlugin3BandSplitter::run(const float** inputs, float** outputs, uint32_t frames) | |||||
{ | |||||
const float* in1 = inputs[0]; | |||||
const float* in2 = inputs[1]; | |||||
float* out1 = outputs[0]; | |||||
float* out2 = outputs[1]; | |||||
float* out3 = outputs[2]; | |||||
float* out4 = outputs[3]; | |||||
float* out5 = outputs[4]; | |||||
float* out6 = outputs[5]; | |||||
for (uint32_t i=0; i < frames; ++i) | |||||
{ | |||||
tmp1LP = a0LP * in1[i] - b1LP * tmp1LP + kDC_ADD; | |||||
tmp2LP = a0LP * in2[i] - b1LP * tmp2LP + kDC_ADD; | |||||
out1LP = tmp1LP - kDC_ADD; | |||||
out2LP = tmp2LP - kDC_ADD; | |||||
tmp1HP = a0HP * in1[i] - b1HP * tmp1HP + kDC_ADD; | |||||
tmp2HP = a0HP * in2[i] - b1HP * tmp2HP + kDC_ADD; | |||||
out1HP = in1[i] - tmp1HP - kDC_ADD; | |||||
out2HP = in2[i] - tmp2HP - kDC_ADD; | |||||
out6[i] = out2HP*highVol * outVol; | |||||
out5[i] = out1HP*highVol * outVol; | |||||
out4[i] = (in2[i] - out2LP - out2HP)*midVol * outVol; | |||||
out3[i] = (in1[i] - out1LP - out1HP)*midVol * outVol; | |||||
out2[i] = out2LP*lowVol * outVol; | |||||
out1[i] = out1LP*lowVol * outVol; | |||||
} | |||||
} | |||||
// ----------------------------------------------------------------------- | |||||
Plugin* createPlugin() | |||||
{ | |||||
return new DistrhoPlugin3BandSplitter(); | |||||
} | |||||
// ----------------------------------------------------------------------- | |||||
END_NAMESPACE_DISTRHO |
@@ -0,0 +1,113 @@ | |||||
/* | |||||
* DISTRHO 3BandSplitter Plugin, based on 3BandSplitter by Michael Gruhn | |||||
* Copyright (C) 2007 Michael Gruhn <michael-gruhn@web.de> | |||||
* Copyright (C) 2012-2015 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 | |||||
* License as published by the Free Software Foundation. | |||||
* | |||||
* This program is distributed in the hope that it will be useful, | |||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
* GNU Lesser General Public License for more details. | |||||
* | |||||
* For a full copy of the license see the LICENSE file. | |||||
*/ | |||||
#ifndef DISTRHO_PLUGIN_3BANDSPLITTER_HPP_INCLUDED | |||||
#define DISTRHO_PLUGIN_3BANDSPLITTER_HPP_INCLUDED | |||||
#include "DistrhoPlugin.hpp" | |||||
START_NAMESPACE_DISTRHO | |||||
// ----------------------------------------------------------------------- | |||||
class DistrhoPlugin3BandSplitter : public Plugin | |||||
{ | |||||
public: | |||||
enum Parameters | |||||
{ | |||||
paramLow = 0, | |||||
paramMid, | |||||
paramHigh, | |||||
paramMaster, | |||||
paramLowMidFreq, | |||||
paramMidHighFreq, | |||||
paramCount | |||||
}; | |||||
DistrhoPlugin3BandSplitter(); | |||||
protected: | |||||
// ------------------------------------------------------------------- | |||||
// Information | |||||
const char* getLabel() const noexcept override | |||||
{ | |||||
return "3BandSplitter"; | |||||
} | |||||
const char* getMaker() const noexcept override | |||||
{ | |||||
return "DISTRHO"; | |||||
} | |||||
const char* getLicense() const noexcept override | |||||
{ | |||||
return "LGPL"; | |||||
} | |||||
uint32_t getVersion() const noexcept override | |||||
{ | |||||
return 0x1000; | |||||
} | |||||
int64_t getUniqueId() const noexcept override | |||||
{ | |||||
return d_cconst('D', '3', 'E', 'S'); | |||||
} | |||||
// ------------------------------------------------------------------- | |||||
// Init | |||||
void initParameter(uint32_t index, Parameter& parameter) override; | |||||
void initProgramName(uint32_t index, String& programName) override; | |||||
// ------------------------------------------------------------------- | |||||
// Internal data | |||||
float getParameterValue(uint32_t index) const override; | |||||
void setParameterValue(uint32_t index, float value) override; | |||||
void loadProgram(uint32_t index) override; | |||||
// ------------------------------------------------------------------- | |||||
// Process | |||||
void activate() override; | |||||
void deactivate() override; | |||||
void run(const float** inputs, float** outputs, uint32_t frames) override; | |||||
// ------------------------------------------------------------------- | |||||
private: | |||||
float fLow, fMid, fHigh, fMaster, fLowMidFreq, fMidHighFreq; | |||||
float lowVol, midVol, highVol, outVol; | |||||
float freqLP, freqHP; | |||||
float xLP, a0LP, b1LP; | |||||
float xHP, a0HP, b1HP; | |||||
float out1LP, out2LP, out1HP, out2HP; | |||||
float tmp1LP, tmp2LP, tmp1HP, tmp2HP; | |||||
DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(DistrhoPlugin3BandSplitter) | |||||
}; | |||||
// ----------------------------------------------------------------------- | |||||
END_NAMESPACE_DISTRHO | |||||
#endif // DISTRHO_PLUGIN_3BANDSPLITTER_HPP_INCLUDED |
@@ -0,0 +1,29 @@ | |||||
/* | |||||
* DISTRHO 3BandSplitter Plugin, based on 3BandSplitter by Michael Gruhn | |||||
* Copyright (C) 2012-2015 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 | |||||
* License as published by the Free Software Foundation. | |||||
* | |||||
* This program is distributed in the hope that it will be useful, | |||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
* GNU Lesser General Public License for more details. | |||||
* | |||||
* For a full copy of the license see the LICENSE file. | |||||
*/ | |||||
#ifndef DISTRHO_PLUGIN_INFO_H_INCLUDED | |||||
#define DISTRHO_PLUGIN_INFO_H_INCLUDED | |||||
#define DISTRHO_PLUGIN_NAME "3 Band Splitter" | |||||
#define DISTRHO_PLUGIN_URI "http://distrho.sf.net/plugins/3BandSplitter" | |||||
#define DISTRHO_PLUGIN_HAS_UI 1 | |||||
#define DISTRHO_PLUGIN_IS_RT_SAFE 1 | |||||
#define DISTRHO_PLUGIN_NUM_INPUTS 2 | |||||
#define DISTRHO_PLUGIN_NUM_OUTPUTS 6 | |||||
#define DISTRHO_PLUGIN_WANT_PROGRAMS 1 | |||||
#endif // DISTRHO_PLUGIN_INFO_H_INCLUDED |
@@ -0,0 +1,213 @@ | |||||
/* | |||||
* DISTRHO 3BandSplitter Plugin, based on 3BandSplitter by Michael Gruhn | |||||
* Copyright (C) 2012-2015 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 | |||||
* License as published by the Free Software Foundation. | |||||
* | |||||
* This program is distributed in the hope that it will be useful, | |||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
* GNU Lesser General Public License for more details. | |||||
* | |||||
* For a full copy of the license see the LICENSE file. | |||||
*/ | |||||
#include "DistrhoPlugin3BandSplitter.hpp" | |||||
#include "DistrhoUI3BandSplitter.hpp" | |||||
using DGL::Point; | |||||
START_NAMESPACE_DISTRHO | |||||
namespace Art = DistrhoArtwork3BandSplitter; | |||||
// ----------------------------------------------------------------------- | |||||
DistrhoUI3BandSplitter::DistrhoUI3BandSplitter() | |||||
: UI(Art::backgroundWidth, Art::backgroundHeight), | |||||
fImgBackground(Art::backgroundData, Art::backgroundWidth, Art::backgroundHeight, GL_BGR), | |||||
fAboutWindow(this) | |||||
{ | |||||
// about | |||||
Image aboutImage(Art::aboutData, Art::aboutWidth, Art::aboutHeight, GL_BGR); | |||||
fAboutWindow.setImage(aboutImage); | |||||
// sliders | |||||
Image sliderImage(Art::sliderData, Art::sliderWidth, Art::sliderHeight); | |||||
Point<int> sliderPosStart(57, 43); | |||||
Point<int> sliderPosEnd(57, 43 + 160); | |||||
// slider Low | |||||
fSliderLow = new ImageSlider(this, sliderImage); | |||||
fSliderLow->setId(DistrhoPlugin3BandSplitter::paramLow); | |||||
fSliderLow->setInverted(true); | |||||
fSliderLow->setStartPos(sliderPosStart); | |||||
fSliderLow->setEndPos(sliderPosEnd); | |||||
fSliderLow->setRange(-24.0f, 24.0f); | |||||
fSliderLow->setCallback(this); | |||||
// slider Mid | |||||
sliderPosStart.setX(120); | |||||
sliderPosEnd.setX(120); | |||||
fSliderMid = new ImageSlider(this, sliderImage); | |||||
fSliderMid->setId(DistrhoPlugin3BandSplitter::paramMid); | |||||
fSliderMid->setInverted(true); | |||||
fSliderMid->setStartPos(sliderPosStart); | |||||
fSliderMid->setEndPos(sliderPosEnd); | |||||
fSliderMid->setRange(-24.0f, 24.0f); | |||||
fSliderMid->setCallback(this); | |||||
// slider High | |||||
sliderPosStart.setX(183); | |||||
sliderPosEnd.setX(183); | |||||
fSliderHigh = new ImageSlider(this, sliderImage); | |||||
fSliderHigh->setId(DistrhoPlugin3BandSplitter::paramHigh); | |||||
fSliderHigh->setInverted(true); | |||||
fSliderHigh->setStartPos(sliderPosStart); | |||||
fSliderHigh->setEndPos(sliderPosEnd); | |||||
fSliderHigh->setRange(-24.0f, 24.0f); | |||||
fSliderHigh->setCallback(this); | |||||
// slider Master | |||||
sliderPosStart.setX(287); | |||||
sliderPosEnd.setX(287); | |||||
fSliderMaster = new ImageSlider(this, sliderImage); | |||||
fSliderMaster->setId(DistrhoPlugin3BandSplitter::paramMaster); | |||||
fSliderMaster->setInverted(true); | |||||
fSliderMaster->setStartPos(sliderPosStart); | |||||
fSliderMaster->setEndPos(sliderPosEnd); | |||||
fSliderMaster->setRange(-24.0f, 24.0f); | |||||
fSliderMaster->setCallback(this); | |||||
// knobs | |||||
Image knobImage(Art::knobData, Art::knobWidth, Art::knobHeight); | |||||
// knob Low-Mid | |||||
fKnobLowMid = new ImageKnob(this, knobImage, ImageKnob::Vertical); | |||||
fKnobLowMid->setId(DistrhoPlugin3BandSplitter::paramLowMidFreq); | |||||
fKnobLowMid->setAbsolutePos(65, 269); | |||||
fKnobLowMid->setRange(0.0f, 1000.0f); | |||||
fKnobLowMid->setDefault(440.0f); | |||||
fKnobLowMid->setRotationAngle(270); | |||||
fKnobLowMid->setCallback(this); | |||||
// knob Mid-High | |||||
fKnobMidHigh = new ImageKnob(this, knobImage, ImageKnob::Vertical); | |||||
fKnobMidHigh->setId(DistrhoPlugin3BandSplitter::paramMidHighFreq); | |||||
fKnobMidHigh->setAbsolutePos(159, 269); | |||||
fKnobMidHigh->setRange(1000.0f, 20000.0f); | |||||
fKnobMidHigh->setDefault(1000.0f); | |||||
fKnobMidHigh->setRotationAngle(270); | |||||
fKnobMidHigh->setCallback(this); | |||||
// about button | |||||
Image aboutImageNormal(Art::aboutButtonNormalData, Art::aboutButtonNormalWidth, Art::aboutButtonNormalHeight); | |||||
Image aboutImageHover(Art::aboutButtonHoverData, Art::aboutButtonHoverWidth, Art::aboutButtonHoverHeight); | |||||
fButtonAbout = new ImageButton(this, aboutImageNormal, aboutImageHover, aboutImageHover); | |||||
fButtonAbout->setAbsolutePos(264, 300); | |||||
fButtonAbout->setCallback(this); | |||||
// set default values | |||||
programLoaded(0); | |||||
} | |||||
// ----------------------------------------------------------------------- | |||||
// DSP Callbacks | |||||
void DistrhoUI3BandSplitter::parameterChanged(uint32_t index, float value) | |||||
{ | |||||
switch (index) | |||||
{ | |||||
case DistrhoPlugin3BandSplitter::paramLow: | |||||
fSliderLow->setValue(value); | |||||
break; | |||||
case DistrhoPlugin3BandSplitter::paramMid: | |||||
fSliderMid->setValue(value); | |||||
break; | |||||
case DistrhoPlugin3BandSplitter::paramHigh: | |||||
fSliderHigh->setValue(value); | |||||
break; | |||||
case DistrhoPlugin3BandSplitter::paramMaster: | |||||
fSliderMaster->setValue(value); | |||||
break; | |||||
case DistrhoPlugin3BandSplitter::paramLowMidFreq: | |||||
fKnobLowMid->setValue(value); | |||||
break; | |||||
case DistrhoPlugin3BandSplitter::paramMidHighFreq: | |||||
fKnobMidHigh->setValue(value); | |||||
break; | |||||
} | |||||
} | |||||
void DistrhoUI3BandSplitter::programLoaded(uint32_t index) | |||||
{ | |||||
if (index != 0) | |||||
return; | |||||
// Default values | |||||
fSliderLow->setValue(0.0f); | |||||
fSliderMid->setValue(0.0f); | |||||
fSliderHigh->setValue(0.0f); | |||||
fSliderMaster->setValue(0.0f); | |||||
fKnobLowMid->setValue(220.0f); | |||||
fKnobMidHigh->setValue(2000.0f); | |||||
} | |||||
// ----------------------------------------------------------------------- | |||||
// Widget Callbacks | |||||
void DistrhoUI3BandSplitter::imageButtonClicked(ImageButton* button, int) | |||||
{ | |||||
if (button != fButtonAbout) | |||||
return; | |||||
fAboutWindow.exec(); | |||||
} | |||||
void DistrhoUI3BandSplitter::imageKnobDragStarted(ImageKnob* knob) | |||||
{ | |||||
editParameter(knob->getId(), true); | |||||
} | |||||
void DistrhoUI3BandSplitter::imageKnobDragFinished(ImageKnob* knob) | |||||
{ | |||||
editParameter(knob->getId(), false); | |||||
} | |||||
void DistrhoUI3BandSplitter::imageKnobValueChanged(ImageKnob* knob, float value) | |||||
{ | |||||
setParameterValue(knob->getId(), value); | |||||
} | |||||
void DistrhoUI3BandSplitter::imageSliderDragStarted(ImageSlider* slider) | |||||
{ | |||||
editParameter(slider->getId(), true); | |||||
} | |||||
void DistrhoUI3BandSplitter::imageSliderDragFinished(ImageSlider* slider) | |||||
{ | |||||
editParameter(slider->getId(), false); | |||||
} | |||||
void DistrhoUI3BandSplitter::imageSliderValueChanged(ImageSlider* slider, float value) | |||||
{ | |||||
setParameterValue(slider->getId(), value); | |||||
} | |||||
void DistrhoUI3BandSplitter::onDisplay() | |||||
{ | |||||
fImgBackground.draw(); | |||||
} | |||||
// ----------------------------------------------------------------------- | |||||
UI* createUI() | |||||
{ | |||||
return new DistrhoUI3BandSplitter(); | |||||
} | |||||
// ----------------------------------------------------------------------- | |||||
END_NAMESPACE_DISTRHO |
@@ -0,0 +1,72 @@ | |||||
/* | |||||
* DISTRHO 3BandSplitter Plugin, based on 3BandSplitter by Michael Gruhn | |||||
* Copyright (C) 2012-2015 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 | |||||
* License as published by the Free Software Foundation. | |||||
* | |||||
* This program is distributed in the hope that it will be useful, | |||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
* GNU Lesser General Public License for more details. | |||||
* | |||||
* For a full copy of the license see the LICENSE file. | |||||
*/ | |||||
#ifndef DISTRHO_UI_3BANDSPLITTER_HPP_INCLUDED | |||||
#define DISTRHO_UI_3BANDSPLITTER_HPP_INCLUDED | |||||
#include "DistrhoUI.hpp" | |||||
#include "ImageWidgets.hpp" | |||||
#include "DistrhoArtwork3BandSplitter.hpp" | |||||
START_NAMESPACE_DISTRHO | |||||
// ----------------------------------------------------------------------- | |||||
class DistrhoUI3BandSplitter : public UI, | |||||
public ImageButton::Callback, | |||||
public ImageKnob::Callback, | |||||
public ImageSlider::Callback | |||||
{ | |||||
public: | |||||
DistrhoUI3BandSplitter(); | |||||
protected: | |||||
// ------------------------------------------------------------------- | |||||
// DSP Callbacks | |||||
void parameterChanged(uint32_t index, float value) override; | |||||
void programLoaded(uint32_t index) override; | |||||
// ------------------------------------------------------------------- | |||||
// Widget Callbacks | |||||
void imageButtonClicked(ImageButton* button, int) override; | |||||
void imageKnobDragStarted(ImageKnob* knob) override; | |||||
void imageKnobDragFinished(ImageKnob* knob) override; | |||||
void imageKnobValueChanged(ImageKnob* knob, float value) override; | |||||
void imageSliderDragStarted(ImageSlider* slider) override; | |||||
void imageSliderDragFinished(ImageSlider* slider) override; | |||||
void imageSliderValueChanged(ImageSlider* slider, float value) override; | |||||
void onDisplay() override; | |||||
private: | |||||
Image fImgBackground; | |||||
ImageAboutWindow fAboutWindow; | |||||
ScopedPointer<ImageButton> fButtonAbout; | |||||
ScopedPointer<ImageKnob> fKnobLowMid, fKnobMidHigh; | |||||
ScopedPointer<ImageSlider> fSliderLow, fSliderMid, fSliderHigh, fSliderMaster; | |||||
DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(DistrhoUI3BandSplitter) | |||||
}; | |||||
// ----------------------------------------------------------------------- | |||||
END_NAMESPACE_DISTRHO | |||||
#endif // DISTRHO_UI_3BANDSPLITTER_HPP_INCLUDED |
@@ -0,0 +1,55 @@ | |||||
#!/usr/bin/make -f | |||||
# Makefile for DISTRHO Plugins # | |||||
# ---------------------------- # | |||||
# Created by falkTX | |||||
# | |||||
# -------------------------------------------------------------- | |||||
# Project name, used for binaries | |||||
NAME = 3BandSplitter | |||||
# -------------------------------------------------------------- | |||||
# Files to build | |||||
OBJS_DSP = \ | |||||
DistrhoPlugin3BandSplitter.cpp.o | |||||
OBJS_UI = \ | |||||
DistrhoArtwork3BandSplitter.cpp.o \ | |||||
DistrhoUI3BandSplitter.cpp.o | |||||
# -------------------------------------------------------------- | |||||
# Do some magic | |||||
include ../Makefile.Mini-Series.mk | |||||
# -------------------------------------------------------------- | |||||
# Enable all possible plugin types | |||||
ifeq ($(HAVE_DGL),true) | |||||
ifeq ($(HAVE_JACK),true) | |||||
TARGETS += jack | |||||
endif | |||||
endif | |||||
ifeq ($(LINUX),true) | |||||
TARGETS += ladspa | |||||
ifeq ($(HAVE_DGL),true) | |||||
ifeq ($(HAVE_LIBLO),true) | |||||
TARGETS += dssi | |||||
endif | |||||
endif | |||||
endif | |||||
ifeq ($(HAVE_DGL),true) | |||||
TARGETS += lv2_sep | |||||
else | |||||
TARGETS += lv2_dsp | |||||
endif | |||||
TARGETS += vst | |||||
all: $(TARGETS) | |||||
# -------------------------------------------------------------- |
@@ -0,0 +1,20 @@ | |||||
/* (Auto-generated binary data file). */ | |||||
#ifndef BINARY_DISTRHOARTWORKAMPLITUDEIMPOSER_HPP | |||||
#define BINARY_DISTRHOARTWORKAMPLITUDEIMPOSER_HPP | |||||
namespace DistrhoArtworkAmplitudeImposer | |||||
{ | |||||
extern const char* backData; | |||||
const unsigned int backDataSize = 90000; | |||||
const unsigned int backWidth = 300; | |||||
const unsigned int backHeight = 150; | |||||
extern const char* sliderData; | |||||
const unsigned int sliderDataSize = 512; | |||||
const unsigned int sliderWidth = 16; | |||||
const unsigned int sliderHeight = 16; | |||||
} | |||||
#endif // BINARY_DISTRHOARTWORKAMPLITUDEIMPOSER_HPP | |||||
@@ -0,0 +1,270 @@ | |||||
/* | |||||
* DISTRHO AmplitudeImposer, a DPF'ied AmplitudeImposer. | |||||
* Copyright (C) 2004 Niall Moody | |||||
* Copyright (C) 2015 Filipe Coelho <falktx@falktx.com> | |||||
* | |||||
* Permission is hereby granted, free of charge, to any person obtaining a | |||||
* copy of this software and associated documentation files (the "Software"), | |||||
* to deal in the Software without restriction, including without limitation | |||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, | |||||
* and/or sell copies of the Software, and to permit persons to whom the | |||||
* Software is furnished to do so, subject to the following conditions: | |||||
* | |||||
* The above copyright notice and this permission notice shall be included in | |||||
* all copies or substantial portions of the Software. | |||||
* | |||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | |||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | |||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | |||||
* DEALINGS IN THE SOFTWARE. | |||||
*/ | |||||
#include "DistrhoPluginAmplitudeImposer.hpp" | |||||
START_NAMESPACE_DISTRHO | |||||
// ----------------------------------------------------------------------- | |||||
struct twofloats { | |||||
float left; | |||||
float right; | |||||
}; | |||||
// ----------------------------------------------------------------------- | |||||
DistrhoPluginAmplitudeImposer::DistrhoPluginAmplitudeImposer() | |||||
: Plugin(kParameterCount, 1, 0), // 1 program, 0 states | |||||
fDepth(1.0f), | |||||
fThreshold(0.5f), | |||||
ampEnvelope_l(0.0f), | |||||
ampEnvelope_r(0.0f), | |||||
audioEnvelope_l(0.0f), | |||||
audioEnvelope_r(0.0f), | |||||
envDecay(0.0001f) {} | |||||
// ----------------------------------------------------------------------- | |||||
// Init | |||||
void DistrhoPluginAmplitudeImposer::initAudioPort(bool input, uint32_t index, AudioPort& port) | |||||
{ | |||||
port.hints = 0x0; | |||||
if (input) | |||||
{ | |||||
switch (index) | |||||
{ | |||||
case 0: | |||||
port.name = "Input Left (Amp Env)"; | |||||
port.symbol = "in_left_amp"; | |||||
break; | |||||
case 1: | |||||
port.name = "Input Right (Amp Env)"; | |||||
port.symbol = "in_left_amp"; | |||||
break; | |||||
case 2: | |||||
port.name = "Input Left (Audio)"; | |||||
port.symbol = "in_left_audio"; | |||||
break; | |||||
case 3: | |||||
port.name = "Input Right (Audio)"; | |||||
port.symbol = "in_right_audio"; | |||||
break; | |||||
} | |||||
} | |||||
else | |||||
{ | |||||
switch (index) | |||||
{ | |||||
case 0: | |||||
port.name = "Output Left"; | |||||
port.symbol = "out_left"; | |||||
break; | |||||
case 1: | |||||
port.name = "Output Right"; | |||||
port.symbol = "out_left"; | |||||
break; | |||||
} | |||||
} | |||||
} | |||||
void DistrhoPluginAmplitudeImposer::initParameter(uint32_t index, Parameter& parameter) | |||||
{ | |||||
parameter.hints = kParameterIsAutomable; | |||||
parameter.ranges.min = 0.0f; | |||||
parameter.ranges.max = 1.0f; | |||||
switch (index) | |||||
{ | |||||
case kParameterDepth: | |||||
parameter.name = "Depth"; | |||||
parameter.symbol = "depth"; | |||||
parameter.ranges.def = 1.0f; | |||||
break; | |||||
case kParameterThreshold: | |||||
parameter.name = "Thres"; | |||||
parameter.symbol = "thres"; | |||||
parameter.ranges.def = 0.5f; | |||||
break; | |||||
} | |||||
} | |||||
void DistrhoPluginAmplitudeImposer::initProgramName(uint32_t index, String& programName) | |||||
{ | |||||
if (index != 0) | |||||
return; | |||||
programName = "Default"; | |||||
} | |||||
// ----------------------------------------------------------------------- | |||||
// Internal data | |||||
float DistrhoPluginAmplitudeImposer::getParameterValue(uint32_t index) const | |||||
{ | |||||
switch(index) | |||||
{ | |||||
case kParameterDepth: | |||||
return fDepth; | |||||
case kParameterThreshold: | |||||
return fThreshold; | |||||
default: | |||||
return 0.0f; | |||||
} | |||||
} | |||||
void DistrhoPluginAmplitudeImposer::setParameterValue(uint32_t index, float value) | |||||
{ | |||||
switch(index) | |||||
{ | |||||
case kParameterDepth: | |||||
fDepth = value; | |||||
break; | |||||
case kParameterThreshold: | |||||
fThreshold = value; | |||||
break; | |||||
} | |||||
} | |||||
void DistrhoPluginAmplitudeImposer::loadProgram(uint32_t index) | |||||
{ | |||||
if (index != 0) | |||||
return; | |||||
fDepth = 1.0f; | |||||
fThreshold = 0.5f; | |||||
} | |||||
// ----------------------------------------------------------------------- | |||||
// Process | |||||
void DistrhoPluginAmplitudeImposer::activate() | |||||
{ | |||||
ampEnvelope_l = 0.0f; | |||||
ampEnvelope_r = 0.0f; | |||||
audioEnvelope_l = 0.0f; | |||||
audioEnvelope_r = 0.0f; | |||||
envDecay = 0.0001f; | |||||
} | |||||
void DistrhoPluginAmplitudeImposer::run(const float** inputs, float** outputs, uint32_t frames) | |||||
{ | |||||
const float* const in1 = inputs[0]; | |||||
const float* const in2 = inputs[1]; | |||||
const float* const in3 = inputs[2]; | |||||
const float* const in4 = inputs[3]; | |||||
/* */ float* const out1 = outputs[0]; | |||||
/* */ float* const out2 = outputs[1]; | |||||
float tmp; | |||||
twofloats tempf; | |||||
twofloats tempin; | |||||
for (uint32_t i=0; i<frames; ++i) | |||||
{ | |||||
// calculate envelope from 1st two inputs | |||||
tmp = std::abs(in1[i]); | |||||
/**/ if (tmp > ampEnvelope_l) | |||||
ampEnvelope_l = tmp; | |||||
else if (tmp < ampEnvelope_l) | |||||
ampEnvelope_l -= envDecay; | |||||
tmp = std::abs(in2[i]); | |||||
/**/ if (tmp > ampEnvelope_r) | |||||
ampEnvelope_r = tmp; | |||||
else if (tmp < ampEnvelope_r) | |||||
ampEnvelope_r -= envDecay; | |||||
// calculate envelope from 2nd two inputs | |||||
tmp = std::abs(in3[i]); | |||||
/**/ if (tmp > audioEnvelope_l) | |||||
audioEnvelope_l = tmp; | |||||
else if (tmp < audioEnvelope_l) | |||||
audioEnvelope_l -= envDecay; | |||||
tmp = std::abs(in4[i]); | |||||
/**/ if (tmp > audioEnvelope_r) | |||||
audioEnvelope_r = tmp; | |||||
else if (tmp < audioEnvelope_r) | |||||
audioEnvelope_r -= envDecay; | |||||
// make sure we're not multiplying by a negative number | |||||
if (ampEnvelope_l < 0.0f) | |||||
ampEnvelope_l = 0.0f; | |||||
if (ampEnvelope_r < 0.0f) | |||||
ampEnvelope_r = 0.0f; | |||||
if (audioEnvelope_l < 0.0f) | |||||
audioEnvelope_l = 0.0f; | |||||
if (audioEnvelope_r < 0.0f) | |||||
audioEnvelope_r = 0.0f; | |||||
// work out whether we need to multiply audio input | |||||
if (audioEnvelope_l > fThreshold) | |||||
{ | |||||
tempin.left = in3[i]; | |||||
} | |||||
else | |||||
{ | |||||
if (audioEnvelope_l > 0.001f) | |||||
tempin.left = in3[i] * (fThreshold/audioEnvelope_l); | |||||
else | |||||
tempin.left = in3[i] * (fThreshold/0.001f); //so it'll decay away smoothly | |||||
} | |||||
if (audioEnvelope_r > fThreshold) | |||||
{ | |||||
tempin.right = in4[i]; | |||||
} | |||||
else | |||||
{ | |||||
if (audioEnvelope_r > 0.001f) | |||||
tempin.right = in4[i] * (fThreshold/audioEnvelope_r); | |||||
else | |||||
tempin.right = in4[i] * (fThreshold/0.001f); | |||||
} | |||||
// calculate output | |||||
tempf.left = tempin.left * ampEnvelope_l; | |||||
tempf.left *= fDepth; | |||||
tempf.left = tempf.left + ((1.0f-fDepth)*tempin.left); | |||||
tempf.right = tempin.right * ampEnvelope_r; | |||||
tempf.right *= fDepth; | |||||
tempf.right = tempf.right + ((1.0f-fDepth)*tempin.right); | |||||
out1[i] = tempf.left; | |||||
out2[i] = tempf.right; | |||||
} | |||||
} | |||||
// ----------------------------------------------------------------------- | |||||
Plugin* createPlugin() | |||||
{ | |||||
return new DistrhoPluginAmplitudeImposer(); | |||||
} | |||||
// ----------------------------------------------------------------------- | |||||
END_NAMESPACE_DISTRHO |
@@ -0,0 +1,111 @@ | |||||
/* | |||||
* DISTRHO AmplitudeImposer, a DPF'ied AmplitudeImposer. | |||||
* Copyright (C) 2004 Niall Moody | |||||
* Copyright (C) 2015 Filipe Coelho <falktx@falktx.com> | |||||
* | |||||
* Permission is hereby granted, free of charge, to any person obtaining a | |||||
* copy of this software and associated documentation files (the "Software"), | |||||
* to deal in the Software without restriction, including without limitation | |||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, | |||||
* and/or sell copies of the Software, and to permit persons to whom the | |||||
* Software is furnished to do so, subject to the following conditions: | |||||
* | |||||
* The above copyright notice and this permission notice shall be included in | |||||
* all copies or substantial portions of the Software. | |||||
* | |||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | |||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | |||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | |||||
* DEALINGS IN THE SOFTWARE. | |||||
*/ | |||||
#ifndef DISTRHO_PLUGIN_AMPLITUDE_IMPOSER_HPP_INCLUDED | |||||
#define DISTRHO_PLUGIN_AMPLITUDE_IMPOSER_HPP_INCLUDED | |||||
#include "DistrhoPlugin.hpp" | |||||
START_NAMESPACE_DISTRHO | |||||
// ----------------------------------------------------------------------- | |||||
class DistrhoPluginAmplitudeImposer : public Plugin | |||||
{ | |||||
public: | |||||
enum Parameters { | |||||
kParameterDepth, | |||||
kParameterThreshold, | |||||
kParameterCount | |||||
}; | |||||
DistrhoPluginAmplitudeImposer(); | |||||
protected: | |||||
// ------------------------------------------------------------------- | |||||
// Information | |||||
const char* getLabel() const noexcept override | |||||
{ | |||||
return "AmplitudeImposer"; | |||||
} | |||||
const char* getMaker() const noexcept override | |||||
{ | |||||
return "ndc Plugs"; | |||||
} | |||||
const char* getLicense() const noexcept override | |||||
{ | |||||
return "MIT"; | |||||
} | |||||
uint32_t getVersion() const noexcept override | |||||
{ | |||||
return 0x1000; | |||||
} | |||||
int64_t getUniqueId() const noexcept override | |||||
{ | |||||
return d_cconst('A', 'm', 'I', 'm'); | |||||
} | |||||
// ------------------------------------------------------------------- | |||||
// Init | |||||
void initAudioPort(bool input, uint32_t index, AudioPort& port) override; | |||||
void initParameter(uint32_t index, Parameter& parameter) override; | |||||
void initProgramName(uint32_t index, String& programName) override; | |||||
// ------------------------------------------------------------------- | |||||
// Internal data | |||||
float getParameterValue(uint32_t index) const override; | |||||
void setParameterValue(uint32_t index, float value) override; | |||||
void loadProgram(uint32_t index) override; | |||||
// ------------------------------------------------------------------- | |||||
// Process | |||||
void activate() override; | |||||
void run(const float** inputs, float** outputs, uint32_t frames) override; | |||||
// ------------------------------------------------------------------- | |||||
private: | |||||
float fDepth; | |||||
float fThreshold; | |||||
float ampEnvelope_l, ampEnvelope_r; | |||||
float audioEnvelope_l, audioEnvelope_r; | |||||
float envDecay; | |||||
DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(DistrhoPluginAmplitudeImposer) | |||||
}; | |||||
// ----------------------------------------------------------------------- | |||||
END_NAMESPACE_DISTRHO | |||||
#endif // DISTRHO_PLUGIN_AMPLITUDE_IMPOSER_HPP_INCLUDED |
@@ -0,0 +1,37 @@ | |||||
/* | |||||
* DISTRHO AmplitudeImposer, a DPF'ied AmplitudeImposer. | |||||
* Copyright (C) 2004 Niall Moody | |||||
* Copyright (C) 2015 Filipe Coelho <falktx@falktx.com> | |||||
* | |||||
* Permission is hereby granted, free of charge, to any person obtaining a | |||||
* copy of this software and associated documentation files (the "Software"), | |||||
* to deal in the Software without restriction, including without limitation | |||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, | |||||
* and/or sell copies of the Software, and to permit persons to whom the | |||||
* Software is furnished to do so, subject to the following conditions: | |||||
* | |||||
* The above copyright notice and this permission notice shall be included in | |||||
* all copies or substantial portions of the Software. | |||||
* | |||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | |||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | |||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | |||||
* DEALINGS IN THE SOFTWARE. | |||||
*/ | |||||
#ifndef DISTRHO_PLUGIN_INFO_H_INCLUDED | |||||
#define DISTRHO_PLUGIN_INFO_H_INCLUDED | |||||
#define DISTRHO_PLUGIN_NAME "Amplitude Imposer" | |||||
#define DISTRHO_PLUGIN_URI "http://www.niallmoody.com/ndcplugs/ampimposer.htm" | |||||
#define DISTRHO_PLUGIN_HAS_UI 1 | |||||
#define DISTRHO_PLUGIN_IS_RT_SAFE 1 | |||||
#define DISTRHO_PLUGIN_NUM_INPUTS 4 | |||||
#define DISTRHO_PLUGIN_NUM_OUTPUTS 2 | |||||
#define DISTRHO_PLUGIN_WANT_PROGRAMS 1 | |||||
#endif // DISTRHO_PLUGIN_INFO_H_INCLUDED |
@@ -0,0 +1,116 @@ | |||||
/* | |||||
* DISTRHO AmplitudeImposer, a DPF'ied AmplitudeImposer. | |||||
* Copyright (C) 2004 Niall Moody | |||||
* Copyright (C) 2015 Filipe Coelho <falktx@falktx.com> | |||||
* | |||||
* Permission is hereby granted, free of charge, to any person obtaining a | |||||
* copy of this software and associated documentation files (the "Software"), | |||||
* to deal in the Software without restriction, including without limitation | |||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, | |||||
* and/or sell copies of the Software, and to permit persons to whom the | |||||
* Software is furnished to do so, subject to the following conditions: | |||||
* | |||||
* The above copyright notice and this permission notice shall be included in | |||||
* all copies or substantial portions of the Software. | |||||
* | |||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | |||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | |||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | |||||
* DEALINGS IN THE SOFTWARE. | |||||
*/ | |||||
#include "DistrhoUIAmplitudeImposer.hpp" | |||||
#include "DistrhoPluginAmplitudeImposer.hpp" | |||||
START_NAMESPACE_DISTRHO | |||||
namespace Art = DistrhoArtworkAmplitudeImposer; | |||||
// ----------------------------------------------------------------------- | |||||
DistrhoUIAmplitudeImposer::DistrhoUIAmplitudeImposer() | |||||
: UI(Art::backWidth, Art::backHeight), | |||||
fImgBackground(Art::backData, Art::backWidth, Art::backHeight, GL_LUMINANCE) | |||||
{ | |||||
// sliders | |||||
Image sliderImage(Art::sliderData, Art::sliderWidth, Art::sliderHeight, GL_LUMINANCE); | |||||
fSliderDepth = new ImageSlider(this, sliderImage); | |||||
fSliderDepth->setId(DistrhoPluginAmplitudeImposer::kParameterDepth); | |||||
fSliderDepth->setStartPos(108, 71); | |||||
fSliderDepth->setEndPos(268, 71); | |||||
fSliderDepth->setRange(0.0f, 1.0f); | |||||
fSliderDepth->setCallback(this); | |||||
fSliderThres = new ImageSlider(this, sliderImage); | |||||
fSliderThres->setId(DistrhoPluginAmplitudeImposer::kParameterThreshold); | |||||
fSliderThres->setStartPos(108, 110); | |||||
fSliderThres->setEndPos(268, 110); | |||||
fSliderThres->setRange(0.0f, 1.0f); | |||||
fSliderThres->setCallback(this); | |||||
// set initial values | |||||
programLoaded(0); | |||||
} | |||||
// ----------------------------------------------------------------------- | |||||
// DSP Callbacks | |||||
void DistrhoUIAmplitudeImposer::parameterChanged(uint32_t index, float value) | |||||
{ | |||||
switch (index) | |||||
{ | |||||
case DistrhoPluginAmplitudeImposer::kParameterDepth: | |||||
fSliderDepth->setValue(value); | |||||
break; | |||||
case DistrhoPluginAmplitudeImposer::kParameterThreshold: | |||||
fSliderThres->setValue(value); | |||||
break; | |||||
} | |||||
} | |||||
void DistrhoUIAmplitudeImposer::programLoaded(uint32_t index) | |||||
{ | |||||
if (index != 0) | |||||
return; | |||||
fSliderDepth->setValue(1.0f); | |||||
fSliderThres->setValue(0.5f); | |||||
} | |||||
// ----------------------------------------------------------------------- | |||||
// Widget Callbacks | |||||
void DistrhoUIAmplitudeImposer::imageSliderDragStarted(ImageSlider* slider) | |||||
{ | |||||
editParameter(slider->getId(), true); | |||||
} | |||||
void DistrhoUIAmplitudeImposer::imageSliderDragFinished(ImageSlider* slider) | |||||
{ | |||||
editParameter(slider->getId(), false); | |||||
} | |||||
void DistrhoUIAmplitudeImposer::imageSliderValueChanged(ImageSlider* slider, float value) | |||||
{ | |||||
setParameterValue(slider->getId(), value); | |||||
} | |||||
void DistrhoUIAmplitudeImposer::onDisplay() | |||||
{ | |||||
fImgBackground.draw(); | |||||
} | |||||
// ----------------------------------------------------------------------- | |||||
UI* createUI() | |||||
{ | |||||
return new DistrhoUIAmplitudeImposer(); | |||||
} | |||||
// ----------------------------------------------------------------------- | |||||
END_NAMESPACE_DISTRHO |
@@ -0,0 +1,74 @@ | |||||
/* | |||||
* DISTRHO AmplitudeImposer, a DPF'ied AmplitudeImposer. | |||||
* Copyright (C) 2004 Niall Moody | |||||
* Copyright (C) 2015 Filipe Coelho <falktx@falktx.com> | |||||
* | |||||
* Permission is hereby granted, free of charge, to any person obtaining a | |||||
* copy of this software and associated documentation files (the "Software"), | |||||
* to deal in the Software without restriction, including without limitation | |||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, | |||||
* and/or sell copies of the Software, and to permit persons to whom the | |||||
* Software is furnished to do so, subject to the following conditions: | |||||
* | |||||
* The above copyright notice and this permission notice shall be included in | |||||
* all copies or substantial portions of the Software. | |||||
* | |||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | |||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | |||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | |||||
* DEALINGS IN THE SOFTWARE. | |||||
*/ | |||||
#ifndef DISTRHO_UI_AMPLITUDE_IMPOSER_HPP_INCLUDED | |||||
#define DISTRHO_UI_AMPLITUDE_IMPOSER_HPP_INCLUDED | |||||
#include "DistrhoUI.hpp" | |||||
#include "ImageSlider.hpp" | |||||
#include "DistrhoArtworkAmplitudeImposer.hpp" | |||||
using DGL::Image; | |||||
using DGL::ImageSlider; | |||||
START_NAMESPACE_DISTRHO | |||||
// ----------------------------------------------------------------------- | |||||
class DistrhoUIAmplitudeImposer : public UI, | |||||
public ImageSlider::Callback | |||||
{ | |||||
public: | |||||
DistrhoUIAmplitudeImposer(); | |||||
protected: | |||||
// ------------------------------------------------------------------- | |||||
// DSP Callbacks | |||||
void parameterChanged(uint32_t index, float value) override; | |||||
void programLoaded(uint32_t index) override; | |||||
// ------------------------------------------------------------------- | |||||
// Widget Callbacks | |||||
void imageSliderDragStarted(ImageSlider* slider) override; | |||||
void imageSliderDragFinished(ImageSlider* slider) override; | |||||
void imageSliderValueChanged(ImageSlider* slider, float value) override; | |||||
void onDisplay() override; | |||||
private: | |||||
Image fImgBackground; | |||||
ScopedPointer<ImageSlider> fSliderDepth, fSliderThres; | |||||
DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(DistrhoUIAmplitudeImposer) | |||||
}; | |||||
// ----------------------------------------------------------------------- | |||||
END_NAMESPACE_DISTRHO | |||||
#endif // DISTRHO_UI_AMPLITUDE_IMPOSER_HPP_INCLUDED |
@@ -0,0 +1,53 @@ | |||||
#!/usr/bin/make -f | |||||
# Makefile for DISTRHO Plugins # | |||||
# ---------------------------- # | |||||
# Created by falkTX | |||||
# | |||||
# -------------------------------------------------------------- | |||||
# Project name, used for binaries | |||||
NAME = AmplitudeImposer | |||||
# -------------------------------------------------------------- | |||||
# Files to build | |||||
OBJS_DSP = \ | |||||
DistrhoPluginAmplitudeImposer.cpp.o | |||||
OBJS_UI = \ | |||||
DistrhoArtworkAmplitudeImposer.cpp.o \ | |||||
DistrhoUIAmplitudeImposer.cpp.o | |||||
# -------------------------------------------------------------- | |||||
# Do some magic | |||||
include ../Makefile.ndc-Plugs.mk | |||||
# -------------------------------------------------------------- | |||||
# Enable all possible plugin types | |||||
ifeq ($(HAVE_JACK),true) | |||||
TARGETS += jack | |||||
endif | |||||
ifeq ($(LINUX),true) | |||||
TARGETS += ladspa | |||||
ifeq ($(HAVE_DGL),true) | |||||
ifeq ($(HAVE_LIBLO),true) | |||||
TARGETS += dssi | |||||
endif | |||||
endif | |||||
endif | |||||
ifeq ($(HAVE_DGL),true) | |||||
TARGETS += lv2_sep | |||||
else | |||||
TARGETS += lv2_dsp | |||||
endif | |||||
TARGETS += vst | |||||
all: $(TARGETS) | |||||
# -------------------------------------------------------------- |
@@ -0,0 +1,20 @@ | |||||
/* (Auto-generated binary data file). */ | |||||
#ifndef BINARY_DISTRHOARTWORKCYCLESHIFTER_HPP | |||||
#define BINARY_DISTRHOARTWORKCYCLESHIFTER_HPP | |||||
namespace DistrhoArtworkCycleShifter | |||||
{ | |||||
extern const char* backData; | |||||
const unsigned int backDataSize = 57352; | |||||
const unsigned int backWidth = 268; | |||||
const unsigned int backHeight = 107; | |||||
extern const char* sliderData; | |||||
const unsigned int sliderDataSize = 392; | |||||
const unsigned int sliderWidth = 14; | |||||
const unsigned int sliderHeight = 14; | |||||
} | |||||
#endif // BINARY_DISTRHOARTWORKCYCLESHIFTER_HPP | |||||
@@ -0,0 +1,193 @@ | |||||
/* | |||||
* DISTRHO CycleShifter, a DPF'ied CycleShifter. | |||||
* Copyright (C) 2004 Niall Moody | |||||
* Copyright (C) 2015 Filipe Coelho <falktx@falktx.com> | |||||
* | |||||
* Permission is hereby granted, free of charge, to any person obtaining a | |||||
* copy of this software and associated documentation files (the "Software"), | |||||
* to deal in the Software without restriction, including without limitation | |||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, | |||||
* and/or sell copies of the Software, and to permit persons to whom the | |||||
* Software is furnished to do so, subject to the following conditions: | |||||
* | |||||
* The above copyright notice and this permission notice shall be included in | |||||
* all copies or substantial portions of the Software. | |||||
* | |||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | |||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | |||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | |||||
* DEALINGS IN THE SOFTWARE. | |||||
*/ | |||||
#include "DistrhoPluginCycleShifter.hpp" | |||||
START_NAMESPACE_DISTRHO | |||||
// ----------------------------------------------------------------------- | |||||
DistrhoPluginCycleShifter::DistrhoPluginCycleShifter() | |||||
: Plugin(kParameterCount, 1, 0), // 1 program, 0 states | |||||
fNewCycleVolume(1.0f), | |||||
fInputVolume(1.0f), | |||||
OutIndex(0), | |||||
InCount(0), | |||||
ReadWrite(false), | |||||
EnvOld(0.0f) | |||||
{ | |||||
std::memset(CycleBuffer, 0, sizeof(float)*BUFFER_SIZE); | |||||
} | |||||
// ----------------------------------------------------------------------- | |||||
// Init | |||||
void DistrhoPluginCycleShifter::initParameter(uint32_t index, Parameter& parameter) | |||||
{ | |||||
parameter.hints = kParameterIsAutomable; | |||||
parameter.ranges.min = 0.0f; | |||||
parameter.ranges.max = 1.0f; | |||||
switch (index) | |||||
{ | |||||
case kParameterNewCycleVolume: | |||||
parameter.name = "New Cycle Vol"; | |||||
parameter.symbol = "ncvolume"; | |||||
parameter.ranges.def = 1.0f; | |||||
break; | |||||
case kParameterInputVolume: | |||||
parameter.name = "Input Vol"; | |||||
parameter.symbol = "ipvolume"; | |||||
parameter.ranges.def = 1.0f; | |||||
break; | |||||
} | |||||
} | |||||
void DistrhoPluginCycleShifter::initProgramName(uint32_t index, String& programName) | |||||
{ | |||||
if (index != 0) | |||||
return; | |||||
programName = "Default"; | |||||
} | |||||
// ----------------------------------------------------------------------- | |||||
// Internal data | |||||
float DistrhoPluginCycleShifter::getParameterValue(uint32_t index) const | |||||
{ | |||||
switch(index) | |||||
{ | |||||
case kParameterNewCycleVolume: | |||||
return fNewCycleVolume; | |||||
case kParameterInputVolume: | |||||
return fInputVolume; | |||||
default: | |||||
return 0.0f; | |||||
} | |||||
} | |||||
void DistrhoPluginCycleShifter::setParameterValue(uint32_t index, float value) | |||||
{ | |||||
switch(index) | |||||
{ | |||||
case kParameterNewCycleVolume: | |||||
fNewCycleVolume = value; | |||||
break; | |||||
case kParameterInputVolume: | |||||
fInputVolume = value; | |||||
break; | |||||
} | |||||
} | |||||
void DistrhoPluginCycleShifter::loadProgram(uint32_t index) | |||||
{ | |||||
if (index != 0) | |||||
return; | |||||
fNewCycleVolume = 1.0f; | |||||
fInputVolume = 1.0f; | |||||
} | |||||
// ----------------------------------------------------------------------- | |||||
// Process | |||||
void DistrhoPluginCycleShifter::activate() | |||||
{ | |||||
std::memset(CycleBuffer, 0, sizeof(float)*BUFFER_SIZE); | |||||
OutIndex = 0; | |||||
InCount = 0; | |||||
ReadWrite = false; | |||||
EnvOld = 0.0f; | |||||
} | |||||
void DistrhoPluginCycleShifter::run(const float** inputs, float** outputs, uint32_t frames) | |||||
{ | |||||
const float* in = inputs[0]; | |||||
/**/ float* out = outputs[0]; | |||||
for (uint32_t i=0; i<frames; ++i) | |||||
*out++ = DoProcess(*in++); | |||||
} | |||||
// ----------------------------------------------------------------------- | |||||
// Borrowed this from Toby Bear's Delphi template - it maybe adds a bit to cpu | |||||
// usage, but it makes things simpler... | |||||
// ----------------------------------------------------------------------- | |||||
float DistrhoPluginCycleShifter::DoProcess(float a) | |||||
{ | |||||
const float tempval = a; | |||||
if (! ReadWrite) // if we're in read mode | |||||
{ | |||||
if (InCount == 0) // if we're waiting for the start of a new cycle to read | |||||
{ | |||||
if (EnvOld < 0.0f && tempval >= 0.0f) // as soon as the input goes past 0 we start reading | |||||
{ | |||||
CycleBuffer[InCount++] = tempval; | |||||
} | |||||
} | |||||
else if (! (EnvOld < 0.0f && tempval >= 0.0f)) // if we've not reached the end of the cycle yet | |||||
{ | |||||
CycleBuffer[InCount] = tempval; | |||||
if (++InCount >= BUFFER_SIZE) // if we've reached the end of the buffer | |||||
{ | |||||
InCount = BUFFER_SIZE; | |||||
ReadWrite = true; // we're in write mode now | |||||
} | |||||
} | |||||
else // we've reached the end of the cycle | |||||
{ | |||||
CycleBuffer[InCount++] = 0.0f; | |||||
ReadWrite = true; | |||||
} | |||||
a *= fInputVolume; | |||||
} | |||||
else // we're in write mode | |||||
{ | |||||
a = (a*fInputVolume) + (CycleBuffer[OutIndex]*fNewCycleVolume); | |||||
if (++OutIndex == InCount) // we've reached the end of our stored cycle | |||||
{ | |||||
InCount = 0; | |||||
OutIndex = 0; | |||||
ReadWrite = false; | |||||
} | |||||
} | |||||
EnvOld = tempval; | |||||
return a; | |||||
} | |||||
// ----------------------------------------------------------------------- | |||||
Plugin* createPlugin() | |||||
{ | |||||
return new DistrhoPluginCycleShifter(); | |||||
} | |||||
// ----------------------------------------------------------------------- | |||||
END_NAMESPACE_DISTRHO |
@@ -0,0 +1,116 @@ | |||||
/* | |||||
* DISTRHO CycleShifter, a DPF'ied CycleShifter. | |||||
* Copyright (C) 2004 Niall Moody | |||||
* Copyright (C) 2015 Filipe Coelho <falktx@falktx.com> | |||||
* | |||||
* Permission is hereby granted, free of charge, to any person obtaining a | |||||
* copy of this software and associated documentation files (the "Software"), | |||||
* to deal in the Software without restriction, including without limitation | |||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, | |||||
* and/or sell copies of the Software, and to permit persons to whom the | |||||
* Software is furnished to do so, subject to the following conditions: | |||||
* | |||||
* The above copyright notice and this permission notice shall be included in | |||||
* all copies or substantial portions of the Software. | |||||
* | |||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | |||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | |||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | |||||
* DEALINGS IN THE SOFTWARE. | |||||
*/ | |||||
#ifndef DISTRHO_PLUGIN_CYCLE_SHIFTER_HPP_INCLUDED | |||||
#define DISTRHO_PLUGIN_CYCLE_SHIFTER_HPP_INCLUDED | |||||
#include "DistrhoPlugin.hpp" | |||||
#define BUFFER_SIZE 11025 | |||||
START_NAMESPACE_DISTRHO | |||||
// ----------------------------------------------------------------------- | |||||
class DistrhoPluginCycleShifter : public Plugin | |||||
{ | |||||
public: | |||||
enum Parameters { | |||||
kParameterNewCycleVolume, | |||||
kParameterInputVolume, | |||||
kParameterCount | |||||
}; | |||||
DistrhoPluginCycleShifter(); | |||||
protected: | |||||
// ------------------------------------------------------------------- | |||||
// Information | |||||
const char* getLabel() const noexcept override | |||||
{ | |||||
return "CycleShifter"; | |||||
} | |||||
const char* getMaker() const noexcept override | |||||
{ | |||||
return "ndc Plugs"; | |||||
} | |||||
const char* getLicense() const noexcept override | |||||
{ | |||||
return "MIT"; | |||||
} | |||||
uint32_t getVersion() const noexcept override | |||||
{ | |||||
return 0x1000; | |||||
} | |||||
int64_t getUniqueId() const noexcept override | |||||
{ | |||||
return d_cconst('C', 'S', 'f', 't'); | |||||
} | |||||
// ------------------------------------------------------------------- | |||||
// Init | |||||
void initParameter(uint32_t index, Parameter& parameter) override; | |||||
void initProgramName(uint32_t index, String& programName) override; | |||||
// ------------------------------------------------------------------- | |||||
// Internal data | |||||
float getParameterValue(uint32_t index) const override; | |||||
void setParameterValue(uint32_t index, float value) override; | |||||
void loadProgram(uint32_t index) override; | |||||
// ------------------------------------------------------------------- | |||||
// Process | |||||
void activate() override; | |||||
void run(const float** inputs, float** outputs, uint32_t frames) override; | |||||
// ------------------------------------------------------------------- | |||||
private: | |||||
float fNewCycleVolume; | |||||
float fInputVolume; | |||||
float CycleBuffer[BUFFER_SIZE]; // buffer to store the cycle in | |||||
int OutIndex; // index for playing the buffer | |||||
int InCount; // counts how many samples we've recorded | |||||
bool ReadWrite; // 0=read, 1=write | |||||
float EnvOld; // last (input) sample - used to determine zero-crossings | |||||
float DoProcess(float a); | |||||
DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(DistrhoPluginCycleShifter) | |||||
}; | |||||
// ----------------------------------------------------------------------- | |||||
END_NAMESPACE_DISTRHO | |||||
#endif // DISTRHO_PLUGIN_CYCLE_SHIFTER_HPP_INCLUDED |
@@ -0,0 +1,37 @@ | |||||
/* | |||||
* DISTRHO CycleShifter, a DPF'ied CycleShifter. | |||||
* Copyright (C) 2004 Niall Moody | |||||
* Copyright (C) 2015 Filipe Coelho <falktx@falktx.com> | |||||
* | |||||
* Permission is hereby granted, free of charge, to any person obtaining a | |||||
* copy of this software and associated documentation files (the "Software"), | |||||
* to deal in the Software without restriction, including without limitation | |||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, | |||||
* and/or sell copies of the Software, and to permit persons to whom the | |||||
* Software is furnished to do so, subject to the following conditions: | |||||
* | |||||
* The above copyright notice and this permission notice shall be included in | |||||
* all copies or substantial portions of the Software. | |||||
* | |||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | |||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | |||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | |||||
* DEALINGS IN THE SOFTWARE. | |||||
*/ | |||||
#ifndef DISTRHO_PLUGIN_INFO_H_INCLUDED | |||||
#define DISTRHO_PLUGIN_INFO_H_INCLUDED | |||||
#define DISTRHO_PLUGIN_NAME "Cycle Shifter" | |||||
#define DISTRHO_PLUGIN_URI "http://www.niallmoody.com/ndcplugs/cycleshifter.htm" | |||||
#define DISTRHO_PLUGIN_HAS_UI 1 | |||||
#define DISTRHO_PLUGIN_IS_RT_SAFE 1 | |||||
#define DISTRHO_PLUGIN_NUM_INPUTS 1 | |||||
#define DISTRHO_PLUGIN_NUM_OUTPUTS 1 | |||||
#define DISTRHO_PLUGIN_WANT_PROGRAMS 1 | |||||
#endif // DISTRHO_PLUGIN_INFO_H_INCLUDED |
@@ -0,0 +1,116 @@ | |||||
/* | |||||
* DISTRHO CycleShifter, a DPF'ied CycleShifter. | |||||
* Copyright (C) 2004 Niall Moody | |||||
* Copyright (C) 2015 Filipe Coelho <falktx@falktx.com> | |||||
* | |||||
* Permission is hereby granted, free of charge, to any person obtaining a | |||||
* copy of this software and associated documentation files (the "Software"), | |||||
* to deal in the Software without restriction, including without limitation | |||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, | |||||
* and/or sell copies of the Software, and to permit persons to whom the | |||||
* Software is furnished to do so, subject to the following conditions: | |||||
* | |||||
* The above copyright notice and this permission notice shall be included in | |||||
* all copies or substantial portions of the Software. | |||||
* | |||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | |||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | |||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | |||||
* DEALINGS IN THE SOFTWARE. | |||||
*/ | |||||
#include "DistrhoUICycleShifter.hpp" | |||||
#include "DistrhoPluginCycleShifter.hpp" | |||||
START_NAMESPACE_DISTRHO | |||||
namespace Art = DistrhoArtworkCycleShifter; | |||||
// ----------------------------------------------------------------------- | |||||
DistrhoUICycleShifter::DistrhoUICycleShifter() | |||||
: UI(Art::backWidth, Art::backHeight), | |||||
fImgBackground(Art::backData, Art::backWidth, Art::backHeight, GL_LUMINANCE) | |||||
{ | |||||
// sliders | |||||
Image sliderImage(Art::sliderData, Art::sliderWidth, Art::sliderHeight, GL_LUMINANCE); | |||||
fSliderNewCycleVol = new ImageSlider(this, sliderImage); | |||||
fSliderNewCycleVol->setId(DistrhoPluginCycleShifter::kParameterNewCycleVolume); | |||||
fSliderNewCycleVol->setStartPos(6, 49); | |||||
fSliderNewCycleVol->setEndPos(247, 49); | |||||
fSliderNewCycleVol->setRange(0.0f, 1.0f); | |||||
fSliderNewCycleVol->setCallback(this); | |||||
fSliderInputVol = new ImageSlider(this, sliderImage); | |||||
fSliderInputVol->setId(DistrhoPluginCycleShifter::kParameterInputVolume); | |||||
fSliderInputVol->setStartPos(6, 80); | |||||
fSliderInputVol->setEndPos(247, 80); | |||||
fSliderInputVol->setRange(0.0f, 1.0f); | |||||
fSliderInputVol->setCallback(this); | |||||
// set initial values | |||||
programLoaded(0); | |||||
} | |||||
// ----------------------------------------------------------------------- | |||||
// DSP Callbacks | |||||
void DistrhoUICycleShifter::parameterChanged(uint32_t index, float value) | |||||
{ | |||||
switch (index) | |||||
{ | |||||
case DistrhoPluginCycleShifter::kParameterNewCycleVolume: | |||||
fSliderNewCycleVol->setValue(value); | |||||
break; | |||||
case DistrhoPluginCycleShifter::kParameterInputVolume: | |||||
fSliderInputVol->setValue(value); | |||||
break; | |||||
} | |||||
} | |||||
void DistrhoUICycleShifter::programLoaded(uint32_t index) | |||||
{ | |||||
if (index != 0) | |||||
return; | |||||
fSliderNewCycleVol->setValue(1.0f); | |||||
fSliderInputVol->setValue(1.0f); | |||||
} | |||||
// ----------------------------------------------------------------------- | |||||
// Widget Callbacks | |||||
void DistrhoUICycleShifter::imageSliderDragStarted(ImageSlider* slider) | |||||
{ | |||||
editParameter(slider->getId(), true); | |||||
} | |||||
void DistrhoUICycleShifter::imageSliderDragFinished(ImageSlider* slider) | |||||
{ | |||||
editParameter(slider->getId(), false); | |||||
} | |||||
void DistrhoUICycleShifter::imageSliderValueChanged(ImageSlider* slider, float value) | |||||
{ | |||||
setParameterValue(slider->getId(), value); | |||||
} | |||||
void DistrhoUICycleShifter::onDisplay() | |||||
{ | |||||
fImgBackground.draw(); | |||||
} | |||||
// ----------------------------------------------------------------------- | |||||
UI* createUI() | |||||
{ | |||||
return new DistrhoUICycleShifter(); | |||||
} | |||||
// ----------------------------------------------------------------------- | |||||
END_NAMESPACE_DISTRHO |
@@ -0,0 +1,74 @@ | |||||
/* | |||||
* DISTRHO CycleShifter, a DPF'ied CycleShifter. | |||||
* Copyright (C) 2004 Niall Moody | |||||
* Copyright (C) 2015 Filipe Coelho <falktx@falktx.com> | |||||
* | |||||
* Permission is hereby granted, free of charge, to any person obtaining a | |||||
* copy of this software and associated documentation files (the "Software"), | |||||
* to deal in the Software without restriction, including without limitation | |||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, | |||||
* and/or sell copies of the Software, and to permit persons to whom the | |||||
* Software is furnished to do so, subject to the following conditions: | |||||
* | |||||
* The above copyright notice and this permission notice shall be included in | |||||
* all copies or substantial portions of the Software. | |||||
* | |||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | |||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | |||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | |||||
* DEALINGS IN THE SOFTWARE. | |||||
*/ | |||||
#ifndef DISTRHO_UI_CYCLE_SHIFTER_HPP_INCLUDED | |||||
#define DISTRHO_UI_CYCLE_SHIFTER_HPP_INCLUDED | |||||
#include "DistrhoUI.hpp" | |||||
#include "ImageSlider.hpp" | |||||
#include "DistrhoArtworkCycleShifter.hpp" | |||||
using DGL::Image; | |||||
using DGL::ImageSlider; | |||||
START_NAMESPACE_DISTRHO | |||||
// ----------------------------------------------------------------------- | |||||
class DistrhoUICycleShifter : public UI, | |||||
public ImageSlider::Callback | |||||
{ | |||||
public: | |||||
DistrhoUICycleShifter(); | |||||
protected: | |||||
// ------------------------------------------------------------------- | |||||
// DSP Callbacks | |||||
void parameterChanged(uint32_t index, float value) override; | |||||
void programLoaded(uint32_t index) override; | |||||
// ------------------------------------------------------------------- | |||||
// Widget Callbacks | |||||
void imageSliderDragStarted(ImageSlider* slider) override; | |||||
void imageSliderDragFinished(ImageSlider* slider) override; | |||||
void imageSliderValueChanged(ImageSlider* slider, float value) override; | |||||
void onDisplay() override; | |||||
private: | |||||
Image fImgBackground; | |||||
ScopedPointer<ImageSlider> fSliderNewCycleVol, fSliderInputVol; | |||||
DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(DistrhoUICycleShifter) | |||||
}; | |||||
// ----------------------------------------------------------------------- | |||||
END_NAMESPACE_DISTRHO | |||||
#endif // DISTRHO_UI_CYCLE_SHIFTER_HPP_INCLUDED |
@@ -0,0 +1,53 @@ | |||||
#!/usr/bin/make -f | |||||
# Makefile for DISTRHO Plugins # | |||||
# ---------------------------- # | |||||
# Created by falkTX | |||||
# | |||||
# -------------------------------------------------------------- | |||||
# Project name, used for binaries | |||||
NAME = CycleShifter | |||||
# -------------------------------------------------------------- | |||||
# Files to build | |||||
OBJS_DSP = \ | |||||
DistrhoPluginCycleShifter.cpp.o | |||||
OBJS_UI = \ | |||||
DistrhoArtworkCycleShifter.cpp.o \ | |||||
DistrhoUICycleShifter.cpp.o | |||||
# -------------------------------------------------------------- | |||||
# Do some magic | |||||
include ../Makefile.ndc-Plugs.mk | |||||
# -------------------------------------------------------------- | |||||
# Enable all possible plugin types | |||||
ifeq ($(HAVE_JACK),true) | |||||
TARGETS += jack | |||||
endif | |||||
ifeq ($(LINUX),true) | |||||
TARGETS += ladspa | |||||
ifeq ($(HAVE_DGL),true) | |||||
ifeq ($(HAVE_LIBLO),true) | |||||
TARGETS += dssi | |||||
endif | |||||
endif | |||||
endif | |||||
ifeq ($(HAVE_DGL),true) | |||||
TARGETS += lv2_sep | |||||
else | |||||
TARGETS += lv2_dsp | |||||
endif | |||||
TARGETS += vst | |||||
all: $(TARGETS) | |||||
# -------------------------------------------------------------- |
@@ -0,0 +1,20 @@ | |||||
/* (Auto-generated binary data file). */ | |||||
#ifndef BINARY_DISTRHOARTWORKMVERB_HPP | |||||
#define BINARY_DISTRHOARTWORKMVERB_HPP | |||||
namespace DistrhoArtworkMVerb | |||||
{ | |||||
extern const char* backgroundData; | |||||
const unsigned int backgroundDataSize = 147744; | |||||
const unsigned int backgroundWidth = 456; | |||||
const unsigned int backgroundHeight = 108; | |||||
extern const char* knobData; | |||||
const unsigned int knobDataSize = 528384; | |||||
const unsigned int knobWidth = 32; | |||||
const unsigned int knobHeight = 4128; | |||||
} | |||||
#endif // BINARY_DISTRHOARTWORKMVERB_HPP | |||||
@@ -0,0 +1,31 @@ | |||||
/* | |||||
* DISTRHO MVerb, a DPF'ied MVerb. | |||||
* Copyright (c) 2010 Martin Eastwood | |||||
* Copyright (C) 2015 Filipe Coelho <falktx@falktx.com> | |||||
* | |||||
* This program is free software; you can redistribute it and/or | |||||
* modify it under the terms of the GNU General Public License as | |||||
* published by the Free Software Foundation; either version 3 of | |||||
* the License, or any later version. | |||||
* | |||||
* This program is distributed in the hope that it will be useful, | |||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
* GNU General Public License for more details. | |||||
* | |||||
* For a full copy of the GNU General Public License see the LICENSE file. | |||||
*/ | |||||
#ifndef DISTRHO_PLUGIN_INFO_H_INCLUDED | |||||
#define DISTRHO_PLUGIN_INFO_H_INCLUDED | |||||
#define DISTRHO_PLUGIN_NAME "MVerb" | |||||
#define DISTRHO_PLUGIN_URI "http://distrho.sf.net/plugins/MVerb" | |||||
#define DISTRHO_PLUGIN_HAS_UI 1 | |||||
#define DISTRHO_PLUGIN_IS_RT_SAFE 1 | |||||
#define DISTRHO_PLUGIN_NUM_INPUTS 2 | |||||
#define DISTRHO_PLUGIN_NUM_OUTPUTS 2 | |||||
#define DISTRHO_PLUGIN_WANT_PROGRAMS 1 | |||||
#endif // DISTRHO_PLUGIN_INFO_H_INCLUDED |
@@ -0,0 +1,235 @@ | |||||
/* | |||||
* DISTRHO MVerb, a DPF'ied MVerb. | |||||
* Copyright (c) 2010 Martin Eastwood | |||||
* Copyright (C) 2015 Filipe Coelho <falktx@falktx.com> | |||||
* | |||||
* This program is free software; you can redistribute it and/or | |||||
* modify it under the terms of the GNU General Public License as | |||||
* published by the Free Software Foundation; either version 3 of | |||||
* the License, or any later version. | |||||
* | |||||
* This program is distributed in the hope that it will be useful, | |||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
* GNU General Public License for more details. | |||||
* | |||||
* For a full copy of the GNU General Public License see the LICENSE file. | |||||
*/ | |||||
#include "DistrhoPluginMVerb.hpp" | |||||
START_NAMESPACE_DISTRHO | |||||
// ----------------------------------------------------------------------- | |||||
DistrhoPluginMVerb::DistrhoPluginMVerb() | |||||
: Plugin(MVerb<float>::NUM_PARAMS, 5, 0) // 5 program, 0 states | |||||
{ | |||||
fVerb.setSampleRate(getSampleRate()); | |||||
// set initial values | |||||
loadProgram(0); | |||||
} | |||||
// ----------------------------------------------------------------------- | |||||
// Init | |||||
void DistrhoPluginMVerb::initParameter(uint32_t index, Parameter& parameter) | |||||
{ | |||||
parameter.unit = "%"; | |||||
parameter.ranges.min = 0.0f; | |||||
parameter.ranges.max = 100.0f; | |||||
// default values taken from 1st preset | |||||
switch (index) | |||||
{ | |||||
case MVerb<float>::DAMPINGFREQ: | |||||
parameter.hints = kParameterIsAutomable; | |||||
parameter.name = "Damping"; | |||||
parameter.symbol = "damping"; | |||||
parameter.ranges.def = 0.5f * 100.0f; | |||||
break; | |||||
case MVerb<float>::DENSITY: | |||||
parameter.hints = kParameterIsAutomable; | |||||
parameter.name = "Density"; | |||||
parameter.symbol = "density"; | |||||
parameter.ranges.def = 0.5f * 100.0f; | |||||
break; | |||||
case MVerb<float>::BANDWIDTHFREQ: | |||||
parameter.hints = kParameterIsAutomable; | |||||
parameter.name = "Bandwidth"; | |||||
parameter.symbol = "bandwidth"; | |||||
parameter.ranges.def = 0.5f * 100.0f; | |||||
break; | |||||
case MVerb<float>::DECAY: | |||||
parameter.hints = kParameterIsAutomable; | |||||
parameter.name = "Decay"; | |||||
parameter.symbol = "decay"; | |||||
parameter.ranges.def = 0.5f * 100.0f; | |||||
break; | |||||
case MVerb<float>::PREDELAY: | |||||
parameter.hints = kParameterIsAutomable; | |||||
parameter.name = "Predelay"; | |||||
parameter.symbol = "predelay"; | |||||
parameter.ranges.def = 0.5f * 100.0f; | |||||
break; | |||||
case MVerb<float>::SIZE: | |||||
parameter.hints = kParameterIsAutomable; | |||||
parameter.name = "Size"; | |||||
parameter.symbol = "size"; | |||||
parameter.ranges.def = 0.75f * 100.0f; | |||||
parameter.ranges.min = 0.05f * 100.0f; | |||||
break; | |||||
case MVerb<float>::GAIN: | |||||
parameter.hints = kParameterIsAutomable; | |||||
parameter.name = "Gain"; | |||||
parameter.symbol = "gain"; | |||||
parameter.ranges.def = 1.0f * 100.0f; | |||||
break; | |||||
case MVerb<float>::MIX: | |||||
parameter.hints = kParameterIsAutomable; | |||||
parameter.name = "Mix"; | |||||
parameter.symbol = "mix"; | |||||
parameter.ranges.def = 0.5f * 100.0f; | |||||
break; | |||||
case MVerb<float>::EARLYMIX: | |||||
parameter.hints = kParameterIsAutomable; | |||||
parameter.name = "Early/Late Mix"; | |||||
parameter.symbol = "earlymix"; | |||||
parameter.ranges.def = 0.5f * 100.0f; | |||||
break; | |||||
} | |||||
} | |||||
void DistrhoPluginMVerb::initProgramName(uint32_t index, String& programName) | |||||
{ | |||||
switch(index) | |||||
{ | |||||
case 0: | |||||
programName = "Halves"; | |||||
break; | |||||
case 1: | |||||
programName = "Dark"; | |||||
break; | |||||
case 2: | |||||
programName = "Cupboard"; | |||||
break; | |||||
case 3: | |||||
programName = "Stadium"; | |||||
break; | |||||
case 4: | |||||
programName = "Subtle"; | |||||
break; | |||||
} | |||||
} | |||||
// ----------------------------------------------------------------------- | |||||
// Internal data | |||||
float DistrhoPluginMVerb::getParameterValue(uint32_t index) const | |||||
{ | |||||
return fVerb.getParameter(static_cast<int>(index)) * 100.0f; | |||||
} | |||||
void DistrhoPluginMVerb::setParameterValue(uint32_t index, float value) | |||||
{ | |||||
fVerb.setParameter(static_cast<int>(index), value / 100.0f); | |||||
} | |||||
void DistrhoPluginMVerb::loadProgram(uint32_t index) | |||||
{ | |||||
// NOTE: DAMPINGFREQ is reversed | |||||
switch(index) | |||||
{ | |||||
case 0: | |||||
fVerb.setParameter(MVerb<float>::DAMPINGFREQ, 0.5f); | |||||
fVerb.setParameter(MVerb<float>::DENSITY, 0.5f); | |||||
fVerb.setParameter(MVerb<float>::BANDWIDTHFREQ, 0.5f); | |||||
fVerb.setParameter(MVerb<float>::DECAY, 0.5f); | |||||
fVerb.setParameter(MVerb<float>::PREDELAY, 0.5f); | |||||
fVerb.setParameter(MVerb<float>::SIZE, 0.75f); | |||||
fVerb.setParameter(MVerb<float>::GAIN, 1.0f); | |||||
fVerb.setParameter(MVerb<float>::MIX, 0.5f); | |||||
fVerb.setParameter(MVerb<float>::EARLYMIX, 0.5f); | |||||
break; | |||||
case 1: | |||||
fVerb.setParameter(MVerb<float>::DAMPINGFREQ, 0.1f); | |||||
fVerb.setParameter(MVerb<float>::DENSITY, 0.5f); | |||||
fVerb.setParameter(MVerb<float>::BANDWIDTHFREQ, 0.1f); | |||||
fVerb.setParameter(MVerb<float>::DECAY, 0.5f); | |||||
fVerb.setParameter(MVerb<float>::PREDELAY, 0.0f); | |||||
fVerb.setParameter(MVerb<float>::SIZE, 0.5f); | |||||
fVerb.setParameter(MVerb<float>::GAIN, 1.0f); | |||||
fVerb.setParameter(MVerb<float>::MIX, 0.5f); | |||||
fVerb.setParameter(MVerb<float>::EARLYMIX, 0.75f); | |||||
break; | |||||
case 2: | |||||
fVerb.setParameter(MVerb<float>::DAMPINGFREQ, 1.0f); | |||||
fVerb.setParameter(MVerb<float>::DENSITY, 0.5f); | |||||
fVerb.setParameter(MVerb<float>::BANDWIDTHFREQ, 1.0f); | |||||
fVerb.setParameter(MVerb<float>::DECAY, 0.5f); | |||||
fVerb.setParameter(MVerb<float>::PREDELAY, 0.0f); | |||||
fVerb.setParameter(MVerb<float>::SIZE, 0.25f); | |||||
fVerb.setParameter(MVerb<float>::GAIN, 1.0f); | |||||
fVerb.setParameter(MVerb<float>::MIX, 0.35f); | |||||
fVerb.setParameter(MVerb<float>::EARLYMIX, 0.75f); | |||||
break; | |||||
case 3: | |||||
fVerb.setParameter(MVerb<float>::DAMPINGFREQ, 1.0f); | |||||
fVerb.setParameter(MVerb<float>::DENSITY, 0.5f); | |||||
fVerb.setParameter(MVerb<float>::BANDWIDTHFREQ, 1.0f); | |||||
fVerb.setParameter(MVerb<float>::DECAY, 0.5f); | |||||
fVerb.setParameter(MVerb<float>::PREDELAY, 0.0f); | |||||
fVerb.setParameter(MVerb<float>::SIZE, 1.0f); | |||||
fVerb.setParameter(MVerb<float>::GAIN, 1.0f); | |||||
fVerb.setParameter(MVerb<float>::MIX, 0.35f); | |||||
fVerb.setParameter(MVerb<float>::EARLYMIX, 0.75f); | |||||
break; | |||||
case 4: | |||||
fVerb.setParameter(MVerb<float>::DAMPINGFREQ, 1.0f); | |||||
fVerb.setParameter(MVerb<float>::DENSITY, 0.5f); | |||||
fVerb.setParameter(MVerb<float>::BANDWIDTHFREQ, 1.0f); | |||||
fVerb.setParameter(MVerb<float>::DECAY, 0.5f); | |||||
fVerb.setParameter(MVerb<float>::PREDELAY, 0.0f); | |||||
fVerb.setParameter(MVerb<float>::SIZE, 0.5f); | |||||
fVerb.setParameter(MVerb<float>::GAIN, 1.0f); | |||||
fVerb.setParameter(MVerb<float>::MIX, 0.15f); | |||||
fVerb.setParameter(MVerb<float>::EARLYMIX, 0.75f); | |||||
break; | |||||
} | |||||
fVerb.reset(); | |||||
} | |||||
// ----------------------------------------------------------------------- | |||||
// Process | |||||
void DistrhoPluginMVerb::activate() | |||||
{ | |||||
fVerb.reset(); | |||||
} | |||||
void DistrhoPluginMVerb::run(const float** inputs, float** outputs, uint32_t frames) | |||||
{ | |||||
fVerb.process(inputs, outputs, static_cast<int>(frames)); | |||||
} | |||||
// ----------------------------------------------------------------------- | |||||
// Callbacks | |||||
void DistrhoPluginMVerb::sampleRateChanged(double newSampleRate) | |||||
{ | |||||
fVerb.setSampleRate(newSampleRate); | |||||
} | |||||
// ----------------------------------------------------------------------- | |||||
Plugin* createPlugin() | |||||
{ | |||||
return new DistrhoPluginMVerb(); | |||||
} | |||||
// ----------------------------------------------------------------------- | |||||
END_NAMESPACE_DISTRHO |
@@ -0,0 +1,99 @@ | |||||
/* | |||||
* DISTRHO MVerb, a DPF'ied MVerb. | |||||
* Copyright (c) 2010 Martin Eastwood | |||||
* Copyright (C) 2015 Filipe Coelho <falktx@falktx.com> | |||||
* | |||||
* This program is free software; you can redistribute it and/or | |||||
* modify it under the terms of the GNU General Public License as | |||||
* published by the Free Software Foundation; either version 3 of | |||||
* the License, or any later version. | |||||
* | |||||
* This program is distributed in the hope that it will be useful, | |||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
* GNU General Public License for more details. | |||||
* | |||||
* For a full copy of the GNU General Public License see the LICENSE file. | |||||
*/ | |||||
#ifndef DISTRHO_PLUGIN_MVERB_HPP_INCLUDED | |||||
#define DISTRHO_PLUGIN_MVERB_HPP_INCLUDED | |||||
#include "DistrhoPlugin.hpp" | |||||
#include "MVerb.h" | |||||
START_NAMESPACE_DISTRHO | |||||
// ----------------------------------------------------------------------- | |||||
class DistrhoPluginMVerb : public Plugin | |||||
{ | |||||
public: | |||||
DistrhoPluginMVerb(); | |||||
protected: | |||||
// ------------------------------------------------------------------- | |||||
// Information | |||||
const char* getLabel() const noexcept override | |||||
{ | |||||
return "MVerb"; | |||||
} | |||||
const char* getMaker() const noexcept override | |||||
{ | |||||
return "Martin Eastwood, falkTX"; | |||||
} | |||||
const char* getLicense() const noexcept override | |||||
{ | |||||
return "GPL v3+"; | |||||
} | |||||
uint32_t getVersion() const noexcept override | |||||
{ | |||||
return 0x1000; | |||||
} | |||||
int64_t getUniqueId() const noexcept override | |||||
{ | |||||
return d_cconst('M', 'V', 'r', 'b'); | |||||
} | |||||
// ------------------------------------------------------------------- | |||||
// Init | |||||
void initParameter(uint32_t index, Parameter& parameter) override; | |||||
void initProgramName(uint32_t index, String& programName) override; | |||||
// ------------------------------------------------------------------- | |||||
// Internal data | |||||
float getParameterValue(uint32_t index) const override; | |||||
void setParameterValue(uint32_t index, float value) override; | |||||
void loadProgram(uint32_t index) override; | |||||
// ------------------------------------------------------------------- | |||||
// Process | |||||
void activate() override; | |||||
void run(const float** inputs, float** outputs, uint32_t frames) override; | |||||
// ------------------------------------------------------------------- | |||||
// Callbacks | |||||
void sampleRateChanged(double newSampleRate) override; | |||||
// ------------------------------------------------------------------- | |||||
private: | |||||
MVerb<float> fVerb; | |||||
DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(DistrhoPluginMVerb) | |||||
}; | |||||
// ----------------------------------------------------------------------- | |||||
END_NAMESPACE_DISTRHO | |||||
#endif // DISTRHO_PLUGIN_MVERB_HPP_INCLUDED |
@@ -0,0 +1,260 @@ | |||||
/* | |||||
* DISTRHO MVerb, a DPF'ied MVerb. | |||||
* Copyright (c) 2010 Martin Eastwood | |||||
* Copyright (C) 2015 Filipe Coelho <falktx@falktx.com> | |||||
* | |||||
* This program is free software; you can redistribute it and/or | |||||
* modify it under the terms of the GNU General Public License as | |||||
* published by the Free Software Foundation; either version 3 of | |||||
* the License, or any later version. | |||||
* | |||||
* This program is distributed in the hope that it will be useful, | |||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
* GNU General Public License for more details. | |||||
* | |||||
* For a full copy of the GNU General Public License see the LICENSE file. | |||||
*/ | |||||
#include "DistrhoUIMVerb.hpp" | |||||
#include "MVerb.h" | |||||
#include "font/Kh-Kangrey.h" | |||||
START_NAMESPACE_DISTRHO | |||||
namespace Art = DistrhoArtworkMVerb; | |||||
using DGL::Color; | |||||
// ----------------------------------------------------------------------- | |||||
DistrhoUIMVerb::DistrhoUIMVerb() | |||||
: UI(Art::backgroundWidth, Art::backgroundHeight), | |||||
fImgBackground(Art::backgroundData, Art::backgroundWidth, Art::backgroundHeight, GL_BGR) | |||||
{ | |||||
// text | |||||
fNanoText.createFontFromMemory("kh", (const uchar*)khkangrey_ttf, khkangrey_ttfSize, false); | |||||
// knobs | |||||
Image knobImage(Art::knobData, Art::knobWidth, Art::knobHeight); | |||||
{ | |||||
ImageKnob* const knob(new ImageKnob(this, knobImage, ImageKnob::Vertical)); | |||||
knob->setId(MVerb<float>::DAMPINGFREQ); | |||||
knob->setAbsolutePos(56 + 7*40, 40); | |||||
knob->setRange(0.0f, 100.0f); | |||||
knob->setDefault(50.0f); | |||||
knob->setCallback(this); | |||||
fKnobs.push_back(knob); | |||||
} | |||||
{ | |||||
ImageKnob* const knob(new ImageKnob(this, knobImage, ImageKnob::Vertical)); | |||||
knob->setId(MVerb<float>::DENSITY); | |||||
knob->setAbsolutePos(56 + 4*40, 40); | |||||
knob->setRange(0.0f, 100.0f); | |||||
knob->setDefault(50.0f); | |||||
knob->setCallback(this); | |||||
fKnobs.push_back(knob); | |||||
} | |||||
{ | |||||
ImageKnob* const knob(new ImageKnob(this, knobImage, ImageKnob::Vertical)); | |||||
knob->setId(MVerb<float>::BANDWIDTHFREQ); | |||||
knob->setAbsolutePos(56 + 5*40, 40); | |||||
knob->setRange(0.0f, 100.0f); | |||||
knob->setDefault(50.0f); | |||||
knob->setCallback(this); | |||||
fKnobs.push_back(knob); | |||||
} | |||||
{ | |||||
ImageKnob* const knob(new ImageKnob(this, knobImage, ImageKnob::Vertical)); | |||||
knob->setId(MVerb<float>::DECAY); | |||||
knob->setAbsolutePos(56 + 6*40, 40); | |||||
knob->setRange(0.0f, 100.0f); | |||||
knob->setDefault(50.0f); | |||||
knob->setCallback(this); | |||||
fKnobs.push_back(knob); | |||||
} | |||||
{ | |||||
ImageKnob* const knob(new ImageKnob(this, knobImage, ImageKnob::Vertical)); | |||||
knob->setId(MVerb<float>::PREDELAY); | |||||
knob->setAbsolutePos(56 + 1*40, 40); | |||||
knob->setRange(0.0f, 100.0f); | |||||
knob->setDefault(50.0f); | |||||
knob->setCallback(this); | |||||
fKnobs.push_back(knob); | |||||
} | |||||
{ | |||||
ImageKnob* const knob(new ImageKnob(this, knobImage, ImageKnob::Vertical)); | |||||
knob->setId(MVerb<float>::SIZE); | |||||
knob->setAbsolutePos(56 + 3*40, 40); | |||||
knob->setRange(5.0f, 100.0f); | |||||
knob->setDefault(100.0f); | |||||
knob->setCallback(this); | |||||
fKnobs.push_back(knob); | |||||
} | |||||
{ | |||||
ImageKnob* const knob(new ImageKnob(this, knobImage, ImageKnob::Vertical)); | |||||
knob->setId(MVerb<float>::GAIN); | |||||
knob->setAbsolutePos(56 + 8*40, 40); | |||||
knob->setRange(0.0f, 100.0f); | |||||
knob->setDefault(75.0f); | |||||
knob->setCallback(this); | |||||
fKnobs.push_back(knob); | |||||
} | |||||
{ | |||||
ImageKnob* const knob(new ImageKnob(this, knobImage, ImageKnob::Vertical)); | |||||
knob->setId(MVerb<float>::MIX); | |||||
knob->setAbsolutePos(56 + 0*40, 40); | |||||
knob->setRange(0.0f, 100.0f); | |||||
knob->setDefault(50.0f); | |||||
knob->setCallback(this); | |||||
fKnobs.push_back(knob); | |||||
} | |||||
{ | |||||
ImageKnob* const knob(new ImageKnob(this, knobImage, ImageKnob::Vertical)); | |||||
knob->setId(MVerb<float>::EARLYMIX); | |||||
knob->setAbsolutePos(56 + 2*40, 40); | |||||
knob->setRange(0.0f, 100.0f); | |||||
knob->setDefault(50.0f); | |||||
knob->setCallback(this); | |||||
fKnobs.push_back(knob); | |||||
} | |||||
// set initial values | |||||
programLoaded(0); | |||||
} | |||||
DistrhoUIMVerb::~DistrhoUIMVerb() | |||||
{ | |||||
for (std::vector<ImageKnob*>::iterator it=fKnobs.begin(), end=fKnobs.end(); it != end; ++it) | |||||
{ | |||||
ImageKnob* const knob(*it); | |||||
delete knob; | |||||
} | |||||
fKnobs.clear(); | |||||
} | |||||
// ----------------------------------------------------------------------- | |||||
// DSP Callbacks | |||||
void DistrhoUIMVerb::parameterChanged(uint32_t index, float value) | |||||
{ | |||||
fKnobs[index]->setValue(value); | |||||
} | |||||
void DistrhoUIMVerb::programLoaded(uint32_t index) | |||||
{ | |||||
switch(index) | |||||
{ | |||||
case 0: | |||||
fKnobs[MVerb<float>::DAMPINGFREQ]->setValue(0.5f*100.0f); | |||||
fKnobs[MVerb<float>::DENSITY]->setValue(0.5f*100.0f); | |||||
fKnobs[MVerb<float>::BANDWIDTHFREQ]->setValue(0.5f*100.0f); | |||||
fKnobs[MVerb<float>::DECAY]->setValue(0.5f*100.0f); | |||||
fKnobs[MVerb<float>::PREDELAY]->setValue(0.5f*100.0f); | |||||
fKnobs[MVerb<float>::GAIN]->setValue(1.0f*100.0f); | |||||
fKnobs[MVerb<float>::MIX]->setValue(0.5f*100.0f); | |||||
fKnobs[MVerb<float>::EARLYMIX]->setValue(0.5f*100.0f); | |||||
fKnobs[MVerb<float>::SIZE]->setValue(0.75f*100.0f); | |||||
break; | |||||
case 1: | |||||
fKnobs[MVerb<float>::DAMPINGFREQ]->setValue(0.9f*100.0f); | |||||
fKnobs[MVerb<float>::DENSITY]->setValue(0.5f*100.0f); | |||||
fKnobs[MVerb<float>::BANDWIDTHFREQ]->setValue(0.1f*100.0f); | |||||
fKnobs[MVerb<float>::DECAY]->setValue(0.5f*100.0f); | |||||
fKnobs[MVerb<float>::PREDELAY]->setValue(0.0f*100.0f); | |||||
fKnobs[MVerb<float>::SIZE]->setValue(0.5f*100.0f); | |||||
fKnobs[MVerb<float>::GAIN]->setValue(1.0f*100.0f); | |||||
fKnobs[MVerb<float>::MIX]->setValue(0.5f*100.0f); | |||||
fKnobs[MVerb<float>::EARLYMIX]->setValue(0.75f*100.0f); | |||||
break; | |||||
case 2: | |||||
fKnobs[MVerb<float>::DAMPINGFREQ]->setValue(0.0f*100.0f); | |||||
fKnobs[MVerb<float>::DENSITY]->setValue(0.5f*100.0f); | |||||
fKnobs[MVerb<float>::BANDWIDTHFREQ]->setValue(1.0f*100.0f); | |||||
fKnobs[MVerb<float>::DECAY]->setValue(0.5f*100.0f); | |||||
fKnobs[MVerb<float>::PREDELAY]->setValue(0.0f*100.0f); | |||||
fKnobs[MVerb<float>::SIZE]->setValue(0.25f*100.0f); | |||||
fKnobs[MVerb<float>::GAIN]->setValue(1.0f*100.0f); | |||||
fKnobs[MVerb<float>::MIX]->setValue(0.35f*100.0f); | |||||
fKnobs[MVerb<float>::EARLYMIX]->setValue(0.75f*100.0f); | |||||
break; | |||||
case 3: | |||||
fKnobs[MVerb<float>::DAMPINGFREQ]->setValue(0.0f*100.0f); | |||||
fKnobs[MVerb<float>::DENSITY]->setValue(0.5f*100.0f); | |||||
fKnobs[MVerb<float>::BANDWIDTHFREQ]->setValue(1.0f*100.0f); | |||||
fKnobs[MVerb<float>::DECAY]->setValue(0.5f*100.0f); | |||||
fKnobs[MVerb<float>::PREDELAY]->setValue(0.0f*100.0f); | |||||
fKnobs[MVerb<float>::SIZE]->setValue(1.0f*100.0f); | |||||
fKnobs[MVerb<float>::GAIN]->setValue(1.0f*100.0f); | |||||
fKnobs[MVerb<float>::MIX]->setValue(0.35f*100.0f); | |||||
fKnobs[MVerb<float>::EARLYMIX]->setValue(0.75f*100.0f); | |||||
break; | |||||
case 4: | |||||
fKnobs[MVerb<float>::DAMPINGFREQ]->setValue(0.0f*100.0f); | |||||
fKnobs[MVerb<float>::DENSITY]->setValue(0.5f*100.0f); | |||||
fKnobs[MVerb<float>::BANDWIDTHFREQ]->setValue(1.0f*100.0f); | |||||
fKnobs[MVerb<float>::DECAY]->setValue(0.5f*100.0f); | |||||
fKnobs[MVerb<float>::PREDELAY]->setValue(0.0f*100.0f); | |||||
fKnobs[MVerb<float>::SIZE]->setValue(0.5f*100.0f); | |||||
fKnobs[MVerb<float>::GAIN]->setValue(1.0f*100.0f); | |||||
fKnobs[MVerb<float>::MIX]->setValue(0.15f*100.0f); | |||||
fKnobs[MVerb<float>::EARLYMIX]->setValue(0.75f*100.0f); | |||||
break; | |||||
} | |||||
} | |||||
// ----------------------------------------------------------------------- | |||||
// Widget Callbacks | |||||
void DistrhoUIMVerb::imageKnobDragStarted(ImageKnob* knob) | |||||
{ | |||||
editParameter(knob->getId(), true); | |||||
} | |||||
void DistrhoUIMVerb::imageKnobDragFinished(ImageKnob* knob) | |||||
{ | |||||
editParameter(knob->getId(), false); | |||||
} | |||||
void DistrhoUIMVerb::imageKnobValueChanged(ImageKnob* knob, float value) | |||||
{ | |||||
setParameterValue(knob->getId(), value); | |||||
} | |||||
void DistrhoUIMVerb::onDisplay() | |||||
{ | |||||
fImgBackground.draw(); | |||||
// text display | |||||
fNanoText.beginFrame(this); | |||||
fNanoText.fontFace("kh"); | |||||
fNanoText.fontSize(20); | |||||
fNanoText.textAlign(NanoVG::ALIGN_CENTER|NanoVG::ALIGN_TOP); | |||||
fNanoText.fillColor(Color(1.0f, 1.0f, 1.0f)); | |||||
char strBuf[32+1]; | |||||
strBuf[32] = '\0'; | |||||
for (std::size_t i=0; i<MVerb<float>::NUM_PARAMS; ++i) | |||||
{ | |||||
std::snprintf(strBuf, 32, "%i%%", int(fKnobs[i]->getValue())); | |||||
fNanoText.textBox(58.0f + float(fKnobs[i]->getAbsoluteX()) - 56.0f, 73.0f, 30.0f, strBuf, nullptr); | |||||
} | |||||
fNanoText.endFrame(); | |||||
} | |||||
// ----------------------------------------------------------------------- | |||||
UI* createUI() | |||||
{ | |||||
return new DistrhoUIMVerb(); | |||||
} | |||||
// ----------------------------------------------------------------------- | |||||
END_NAMESPACE_DISTRHO |
@@ -0,0 +1,73 @@ | |||||
/* | |||||
* DISTRHO MVerb, a DPF'ied MVerb. | |||||
* Copyright (c) 2010 Martin Eastwood | |||||
* Copyright (C) 2015 Filipe Coelho <falktx@falktx.com> | |||||
* | |||||
* This program is free software; you can redistribute it and/or | |||||
* modify it under the terms of the GNU General Public License as | |||||
* published by the Free Software Foundation; either version 3 of | |||||
* the License, or any later version. | |||||
* | |||||
* This program is distributed in the hope that it will be useful, | |||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
* GNU General Public License for more details. | |||||
* | |||||
* For a full copy of the GNU General Public License see the LICENSE file. | |||||
*/ | |||||
#ifndef DISTRHO_UI_MVERB_HPP_INCLUDED | |||||
#define DISTRHO_UI_MVERB_HPP_INCLUDED | |||||
#include "DistrhoUI.hpp" | |||||
#include "NanoVG.hpp" | |||||
#include "ImageWidgets.hpp" | |||||
#include "DistrhoArtworkMVerb.hpp" | |||||
#include <vector> | |||||
using DGL::Image; | |||||
using DGL::ImageKnob; | |||||
using DGL::NanoVG; | |||||
START_NAMESPACE_DISTRHO | |||||
// ----------------------------------------------------------------------- | |||||
class DistrhoUIMVerb : public UI, | |||||
public ImageKnob::Callback | |||||
{ | |||||
public: | |||||
DistrhoUIMVerb(); | |||||
~DistrhoUIMVerb() override; | |||||
protected: | |||||
// ------------------------------------------------------------------- | |||||
// DSP Callbacks | |||||
void parameterChanged(uint32_t index, float value) override; | |||||
void programLoaded(uint32_t index) override; | |||||
// ------------------------------------------------------------------- | |||||
// Widget Callbacks | |||||
void imageKnobDragStarted(ImageKnob* knob) override; | |||||
void imageKnobDragFinished(ImageKnob* knob) override; | |||||
void imageKnobValueChanged(ImageKnob* knob, float value) override; | |||||
void onDisplay() override; | |||||
private: | |||||
Image fImgBackground; | |||||
NanoVG fNanoText; | |||||
std::vector<ImageKnob*> fKnobs; | |||||
DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(DistrhoUIMVerb) | |||||
}; | |||||
// ----------------------------------------------------------------------- | |||||
END_NAMESPACE_DISTRHO | |||||
#endif // DISTRHO_UI_MVERB_HPP_INCLUDED |
@@ -0,0 +1,842 @@ | |||||
// Copyright (c) 2010 Martin Eastwood | |||||
// This code is distributed under the terms of the GNU General Public License | |||||
// MVerb is free software: you can redistribute it and/or modify | |||||
// it under the terms of the GNU General Public License as published by | |||||
// the Free Software Foundation, either version 3 of the License, or | |||||
// at your option) any later version. | |||||
// | |||||
// MVerb is distributed in the hope that it will be useful, | |||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
// GNU General Public License for more details. | |||||
// | |||||
// You should have received a copy of the GNU General Public License | |||||
// along with this MVerb. If not, see <http://www.gnu.org/licenses/>. | |||||
#ifndef EMVERB_H | |||||
#define EMVERB_H | |||||
#include <cmath> | |||||
#include <cstring> | |||||
//forward declaration | |||||
template<typename T, int maxLength> class Allpass; | |||||
template<typename T, int maxLength> class StaticAllpassFourTap; | |||||
template<typename T, int maxLength> class StaticDelayLine; | |||||
template<typename T, int maxLength> class StaticDelayLineFourTap; | |||||
template<typename T, int maxLength> class StaticDelayLineEightTap; | |||||
template<typename T, int OverSampleCount> class StateVariable; | |||||
template<typename T> | |||||
class MVerb | |||||
{ | |||||
private: | |||||
Allpass<T, 96000> allpass[4]; | |||||
StaticAllpassFourTap<T, 96000> allpassFourTap[4]; | |||||
StateVariable<T,4> bandwidthFilter[2]; | |||||
StateVariable<T,4> damping[2]; | |||||
StaticDelayLine<T, 96000> predelay; | |||||
StaticDelayLineFourTap<T, 96000> staticDelayLine[4]; | |||||
StaticDelayLineEightTap<T, 96000> earlyReflectionsDelayLine[2]; | |||||
T SampleRate, DampingFreq, Density1, Density2, BandwidthFreq, PreDelayTime, Decay, Gain, Mix, EarlyMix, Size; | |||||
T MixSmooth, EarlyLateSmooth, BandwidthSmooth, DampingSmooth, PredelaySmooth, SizeSmooth, DensitySmooth, DecaySmooth; | |||||
T PreviousLeftTank, PreviousRightTank; | |||||
int ControlRate, ControlRateCounter; | |||||
public: | |||||
enum | |||||
{ | |||||
DAMPINGFREQ=0, | |||||
DENSITY, | |||||
BANDWIDTHFREQ, | |||||
DECAY, | |||||
PREDELAY, | |||||
SIZE, | |||||
GAIN, | |||||
MIX, | |||||
EARLYMIX, | |||||
NUM_PARAMS | |||||
}; | |||||
MVerb(){ | |||||
DampingFreq = 18000.; | |||||
BandwidthFreq = 18000.; | |||||
SampleRate = 44100.; | |||||
Decay = 0.5; | |||||
Gain = 1.; | |||||
Mix = 1.; | |||||
Size = 1.; | |||||
EarlyMix = 1.; | |||||
PreviousLeftTank = 0.; | |||||
PreviousRightTank = 0.; | |||||
PreDelayTime = 100 * (SampleRate / 1000); | |||||
MixSmooth = EarlyLateSmooth = BandwidthSmooth = DampingSmooth = PredelaySmooth = SizeSmooth = DecaySmooth = DensitySmooth = 0.; | |||||
ControlRate = SampleRate / 1000; | |||||
ControlRateCounter = 0; | |||||
reset(); | |||||
} | |||||
~MVerb(){ | |||||
//nowt to do here | |||||
} | |||||
void process(const T **inputs, T **outputs, int sampleFrames){ | |||||
T OneOverSampleFrames = 1. / sampleFrames; | |||||
T MixDelta = (Mix - MixSmooth) * OneOverSampleFrames; | |||||
T EarlyLateDelta = (EarlyMix - EarlyLateSmooth) * OneOverSampleFrames; | |||||
T BandwidthDelta = (((BandwidthFreq * 18400.) + 100.) - BandwidthSmooth) * OneOverSampleFrames; | |||||
T DampingDelta = (((DampingFreq * 18400.) + 100.) - DampingSmooth) * OneOverSampleFrames; | |||||
T PredelayDelta = ((PreDelayTime * 200 * (SampleRate / 1000)) - PredelaySmooth) * OneOverSampleFrames; | |||||
T SizeDelta = (Size - SizeSmooth) * OneOverSampleFrames; | |||||
T DecayDelta = (((0.7995f * Decay) + 0.005) - DecaySmooth) * OneOverSampleFrames; | |||||
T DensityDelta = (((0.7995f * Density1) + 0.005) - DensitySmooth) * OneOverSampleFrames; | |||||
for(int i=0;i<sampleFrames;++i){ | |||||
T left = inputs[0][i]; | |||||
T right = inputs[1][i]; | |||||
MixSmooth += MixDelta; | |||||
EarlyLateSmooth += EarlyLateDelta; | |||||
BandwidthSmooth += BandwidthDelta; | |||||
DampingSmooth += DampingDelta; | |||||
PredelaySmooth += PredelayDelta; | |||||
SizeSmooth += SizeDelta; | |||||
DecaySmooth += DecayDelta; | |||||
DensitySmooth += DensityDelta; | |||||
if (ControlRateCounter >= ControlRate){ | |||||
ControlRateCounter = 0; | |||||
bandwidthFilter[0].Frequency(BandwidthSmooth); | |||||
bandwidthFilter[1].Frequency(BandwidthSmooth); | |||||
damping[0].Frequency(DampingSmooth); | |||||
damping[1].Frequency(DampingSmooth); | |||||
} | |||||
++ControlRateCounter; | |||||
predelay.SetLength(PredelaySmooth); | |||||
Density2 = DecaySmooth + 0.15; | |||||
if (Density2 > 0.5) | |||||
Density2 = 0.5; | |||||
if (Density2 < 0.25) | |||||
Density2 = 0.25; | |||||
allpassFourTap[1].SetFeedback(Density2); | |||||
allpassFourTap[3].SetFeedback(Density2); | |||||
allpassFourTap[0].SetFeedback(Density1); | |||||
allpassFourTap[2].SetFeedback(Density1); | |||||
T bandwidthLeft = bandwidthFilter[0](left) ; | |||||
T bandwidthRight = bandwidthFilter[1](right) ; | |||||
T earlyReflectionsL = earlyReflectionsDelayLine[0] ( bandwidthLeft * 0.5 + bandwidthRight * 0.3 ) | |||||
+ earlyReflectionsDelayLine[0].GetIndex(2) * 0.6 | |||||
+ earlyReflectionsDelayLine[0].GetIndex(3) * 0.4 | |||||
+ earlyReflectionsDelayLine[0].GetIndex(4) * 0.3 | |||||
+ earlyReflectionsDelayLine[0].GetIndex(5) * 0.3 | |||||
+ earlyReflectionsDelayLine[0].GetIndex(6) * 0.1 | |||||
+ earlyReflectionsDelayLine[0].GetIndex(7) * 0.1 | |||||
+ ( bandwidthLeft * 0.4 + bandwidthRight * 0.2 ) * 0.5 ; | |||||
T earlyReflectionsR = earlyReflectionsDelayLine[1] ( bandwidthLeft * 0.3 + bandwidthRight * 0.5 ) | |||||
+ earlyReflectionsDelayLine[1].GetIndex(2) * 0.6 | |||||
+ earlyReflectionsDelayLine[1].GetIndex(3) * 0.4 | |||||
+ earlyReflectionsDelayLine[1].GetIndex(4) * 0.3 | |||||
+ earlyReflectionsDelayLine[1].GetIndex(5) * 0.3 | |||||
+ earlyReflectionsDelayLine[1].GetIndex(6) * 0.1 | |||||
+ earlyReflectionsDelayLine[1].GetIndex(7) * 0.1 | |||||
+ ( bandwidthLeft * 0.2 + bandwidthRight * 0.4 ) * 0.5 ; | |||||
T predelayMonoInput = predelay(( bandwidthRight + bandwidthLeft ) * 0.5f); | |||||
T smearedInput = predelayMonoInput; | |||||
for(int j=0;j<4;j++) | |||||
smearedInput = allpass[j] ( smearedInput ); | |||||
T leftTank = allpassFourTap[0] ( smearedInput + PreviousRightTank ) ; | |||||
leftTank = staticDelayLine[0] (leftTank); | |||||
leftTank = damping[0](leftTank); | |||||
leftTank = allpassFourTap[1](leftTank); | |||||
leftTank = staticDelayLine[1](leftTank); | |||||
T rightTank = allpassFourTap[2] (smearedInput + PreviousLeftTank) ; | |||||
rightTank = staticDelayLine[2](rightTank); | |||||
rightTank = damping[1] (rightTank); | |||||
rightTank = allpassFourTap[3](rightTank); | |||||
rightTank = staticDelayLine[3](rightTank); | |||||
PreviousLeftTank = leftTank * DecaySmooth; | |||||
PreviousRightTank = rightTank * DecaySmooth; | |||||
T accumulatorL = (0.6*staticDelayLine[2].GetIndex(1)) | |||||
+(0.6*staticDelayLine[2].GetIndex(2)) | |||||
-(0.6*allpassFourTap[3].GetIndex(1)) | |||||
+(0.6*staticDelayLine[3].GetIndex(1)) | |||||
-(0.6*staticDelayLine[0].GetIndex(1)) | |||||
-(0.6*allpassFourTap[1].GetIndex(1)) | |||||
-(0.6*staticDelayLine[1].GetIndex(1)); | |||||
T accumulatorR = (0.6*staticDelayLine[0].GetIndex(2)) | |||||
+(0.6*staticDelayLine[0].GetIndex(3)) | |||||
-(0.6*allpassFourTap[1].GetIndex(2)) | |||||
+(0.6*staticDelayLine[1].GetIndex(2)) | |||||
-(0.6*staticDelayLine[2].GetIndex(3)) | |||||
-(0.6*allpassFourTap[3].GetIndex(2)) | |||||
-(0.6*staticDelayLine[3].GetIndex(2)); | |||||
accumulatorL = ((accumulatorL * EarlyMix) + ((1 - EarlyMix) * earlyReflectionsL)); | |||||
accumulatorR = ((accumulatorR * EarlyMix) + ((1 - EarlyMix) * earlyReflectionsR)); | |||||
left = ( left + MixSmooth * ( accumulatorL - left ) ) * Gain; | |||||
right = ( right + MixSmooth * ( accumulatorR - right ) ) * Gain; | |||||
outputs[0][i] = left; | |||||
outputs[1][i] = right; | |||||
} | |||||
} | |||||
void reset(){ | |||||
ControlRateCounter = 0; | |||||
bandwidthFilter[0].SetSampleRate (SampleRate ); | |||||
bandwidthFilter[1].SetSampleRate (SampleRate ); | |||||
bandwidthFilter[0].Reset(); | |||||
bandwidthFilter[1].Reset(); | |||||
damping[0].SetSampleRate (SampleRate ); | |||||
damping[1].SetSampleRate (SampleRate ); | |||||
damping[0].Reset(); | |||||
damping[1].Reset(); | |||||
predelay.Clear(); | |||||
predelay.SetLength(PreDelayTime); | |||||
allpass[0].Clear(); | |||||
allpass[1].Clear(); | |||||
allpass[2].Clear(); | |||||
allpass[3].Clear(); | |||||
allpass[0].SetLength (0.0048 * SampleRate); | |||||
allpass[1].SetLength (0.0036 * SampleRate); | |||||
allpass[2].SetLength (0.0127 * SampleRate); | |||||
allpass[3].SetLength (0.0093 * SampleRate); | |||||
allpass[0].SetFeedback (0.75); | |||||
allpass[1].SetFeedback (0.75); | |||||
allpass[2].SetFeedback (0.625); | |||||
allpass[3].SetFeedback (0.625); | |||||
allpassFourTap[0].Clear(); | |||||
allpassFourTap[1].Clear(); | |||||
allpassFourTap[2].Clear(); | |||||
allpassFourTap[3].Clear(); | |||||
allpassFourTap[0].SetLength(0.020 * SampleRate * Size); | |||||
allpassFourTap[1].SetLength(0.060 * SampleRate * Size); | |||||
allpassFourTap[2].SetLength(0.030 * SampleRate * Size); | |||||
allpassFourTap[3].SetLength(0.089 * SampleRate * Size); | |||||
allpassFourTap[0].SetFeedback(Density1); | |||||
allpassFourTap[1].SetFeedback(Density2); | |||||
allpassFourTap[2].SetFeedback(Density1); | |||||
allpassFourTap[3].SetFeedback(Density2); | |||||
allpassFourTap[0].SetIndex(0,0,0,0); | |||||
allpassFourTap[1].SetIndex(0,0.006 * SampleRate * Size, 0.041 * SampleRate * Size, 0); | |||||
allpassFourTap[2].SetIndex(0,0,0,0); | |||||
allpassFourTap[3].SetIndex(0,0.031 * SampleRate * Size, 0.011 * SampleRate * Size, 0); | |||||
staticDelayLine[0].Clear(); | |||||
staticDelayLine[1].Clear(); | |||||
staticDelayLine[2].Clear(); | |||||
staticDelayLine[3].Clear(); | |||||
staticDelayLine[0].SetLength(0.15 * SampleRate * Size); | |||||
staticDelayLine[1].SetLength(0.12 * SampleRate * Size); | |||||
staticDelayLine[2].SetLength(0.14 * SampleRate * Size); | |||||
staticDelayLine[3].SetLength(0.11 * SampleRate * Size); | |||||
staticDelayLine[0].SetIndex(0, 0.067 * SampleRate * Size, 0.011 * SampleRate * Size , 0.121 * SampleRate * Size); | |||||
staticDelayLine[1].SetIndex(0, 0.036 * SampleRate * Size, 0.089 * SampleRate * Size , 0); | |||||
staticDelayLine[2].SetIndex(0, 0.0089 * SampleRate * Size, 0.099 * SampleRate * Size , 0); | |||||
staticDelayLine[3].SetIndex(0, 0.067 * SampleRate * Size, 0.0041 * SampleRate * Size , 0); | |||||
earlyReflectionsDelayLine[0].Clear(); | |||||
earlyReflectionsDelayLine[1].Clear(); | |||||
earlyReflectionsDelayLine[0].SetLength(0.089 * SampleRate); | |||||
earlyReflectionsDelayLine[0].SetIndex (0, 0.0199*SampleRate, 0.0219*SampleRate, 0.0354*SampleRate,0.0389*SampleRate, 0.0414*SampleRate, 0.0692*SampleRate, 0); | |||||
earlyReflectionsDelayLine[1].SetLength(0.069 * SampleRate); | |||||
earlyReflectionsDelayLine[1].SetIndex (0, 0.0099*SampleRate, 0.011*SampleRate, 0.0182*SampleRate,0.0189*SampleRate, 0.0213*SampleRate, 0.0431*SampleRate, 0); | |||||
} | |||||
void setParameter(int index, T value){ | |||||
switch(index){ | |||||
case DAMPINGFREQ: | |||||
DampingFreq = /* 1. - */ value; // FIXME? | |||||
break; | |||||
case DENSITY: | |||||
Density1 = value; | |||||
break; | |||||
case BANDWIDTHFREQ: | |||||
BandwidthFreq = value; | |||||
break; | |||||
case PREDELAY: | |||||
PreDelayTime = value; | |||||
break; | |||||
case SIZE: | |||||
Size = value; | |||||
allpassFourTap[0].Clear(); | |||||
allpassFourTap[1].Clear(); | |||||
allpassFourTap[2].Clear(); | |||||
allpassFourTap[3].Clear(); | |||||
allpassFourTap[0].SetLength(0.020 * SampleRate * Size); | |||||
allpassFourTap[1].SetLength(0.060 * SampleRate * Size); | |||||
allpassFourTap[2].SetLength(0.030 * SampleRate * Size); | |||||
allpassFourTap[3].SetLength(0.089 * SampleRate * Size); | |||||
allpassFourTap[1].SetIndex(0,0.006 * SampleRate * Size, 0.041 * SampleRate * Size, 0); | |||||
allpassFourTap[3].SetIndex(0,0.031 * SampleRate * Size, 0.011 * SampleRate * Size, 0); | |||||
staticDelayLine[0].Clear(); | |||||
staticDelayLine[1].Clear(); | |||||
staticDelayLine[2].Clear(); | |||||
staticDelayLine[3].Clear(); | |||||
staticDelayLine[0].SetLength(0.15 * SampleRate * Size); | |||||
staticDelayLine[1].SetLength(0.12 * SampleRate * Size); | |||||
staticDelayLine[2].SetLength(0.14 * SampleRate * Size); | |||||
staticDelayLine[3].SetLength(0.11 * SampleRate * Size); | |||||
staticDelayLine[0].SetIndex(0, 0.067 * SampleRate * Size, 0.011 * SampleRate * Size , 0.121 * SampleRate * Size); | |||||
staticDelayLine[1].SetIndex(0, 0.036 * SampleRate * Size, 0.089 * SampleRate * Size , 0); | |||||
staticDelayLine[2].SetIndex(0, 0.0089 * SampleRate * Size, 0.099 * SampleRate * Size , 0); | |||||
staticDelayLine[3].SetIndex(0, 0.067 * SampleRate * Size, 0.0041 * SampleRate * Size , 0); | |||||
break; | |||||
case DECAY: | |||||
Decay = value; | |||||
break; | |||||
case GAIN: | |||||
Gain = value; | |||||
break; | |||||
case MIX: | |||||
Mix = value; | |||||
break; | |||||
case EARLYMIX: | |||||
EarlyMix = value; | |||||
break; | |||||
} | |||||
} | |||||
float getParameter(int index) const{ | |||||
switch(index){ | |||||
case DAMPINGFREQ: | |||||
return DampingFreq; | |||||
break; | |||||
case DENSITY: | |||||
return Density1; | |||||
break; | |||||
case BANDWIDTHFREQ: | |||||
return BandwidthFreq; | |||||
break; | |||||
case PREDELAY: | |||||
return PreDelayTime; | |||||
break; | |||||
case SIZE: | |||||
return Size; | |||||
break; | |||||
case DECAY: | |||||
return Decay; | |||||
break; | |||||
case GAIN: | |||||
return Gain; | |||||
break; | |||||
case MIX: | |||||
return Mix; | |||||
break; | |||||
case EARLYMIX: | |||||
return EarlyMix; | |||||
break; | |||||
default: return 0.f; | |||||
break; | |||||
} | |||||
} | |||||
void setSampleRate(T sr){ | |||||
SampleRate = sr; | |||||
ControlRate = SampleRate / 1000; | |||||
reset(); | |||||
} | |||||
}; | |||||
template<typename T, int maxLength> | |||||
class Allpass | |||||
{ | |||||
private: | |||||
T buffer[maxLength]; | |||||
int index; | |||||
int Length; | |||||
T Feedback; | |||||
public: | |||||
Allpass() | |||||
{ | |||||
SetLength ( maxLength - 1 ); | |||||
Clear(); | |||||
Feedback = 0.5; | |||||
} | |||||
T operator()(T input) | |||||
{ | |||||
T output; | |||||
T bufout; | |||||
bufout = buffer[index]; | |||||
T temp = input * -Feedback; | |||||
output = bufout + temp; | |||||
buffer[index] = input + ((bufout+temp)*Feedback); | |||||
if(++index>=Length) index = 0; | |||||
return output; | |||||
} | |||||
void SetLength (int Length) | |||||
{ | |||||
if( Length >= maxLength ) | |||||
Length = maxLength; | |||||
if( Length < 0 ) | |||||
Length = 0; | |||||
this->Length = Length; | |||||
} | |||||
void SetFeedback(T feedback) | |||||
{ | |||||
Feedback = feedback; | |||||
} | |||||
void Clear() | |||||
{ | |||||
std::memset(buffer, 0, sizeof(buffer)); | |||||
index = 0; | |||||
} | |||||
int GetLength() const | |||||
{ | |||||
return Length; | |||||
} | |||||
}; | |||||
template<typename T, int maxLength> | |||||
class StaticAllpassFourTap | |||||
{ | |||||
private: | |||||
T buffer[maxLength]; | |||||
int index1, index2, index3, index4; | |||||
int Length; | |||||
T Feedback; | |||||
public: | |||||
StaticAllpassFourTap() | |||||
{ | |||||
SetLength ( maxLength - 1 ); | |||||
Clear(); | |||||
Feedback = 0.5; | |||||
} | |||||
T operator()(T input) | |||||
{ | |||||
T output; | |||||
T bufout; | |||||
bufout = buffer[index1]; | |||||
T temp = input * -Feedback; | |||||
output = bufout + temp; | |||||
buffer[index1] = input + ((bufout+temp)*Feedback); | |||||
if(++index1>=Length) | |||||
index1 = 0; | |||||
if(++index2 >= Length) | |||||
index2 = 0; | |||||
if(++index3 >= Length) | |||||
index3 = 0; | |||||
if(++index4 >= Length) | |||||
index4 = 0; | |||||
return output; | |||||
} | |||||
void SetIndex (int Index1, int Index2, int Index3, int Index4) | |||||
{ | |||||
index1 = Index1; | |||||
index2 = Index2; | |||||
index3 = Index3; | |||||
index4 = Index4; | |||||
} | |||||
T GetIndex (int Index) | |||||
{ | |||||
switch (Index) | |||||
{ | |||||
case 0: | |||||
return buffer[index1]; | |||||
break; | |||||
case 1: | |||||
return buffer[index2]; | |||||
break; | |||||
case 2: | |||||
return buffer[index3]; | |||||
break; | |||||
case 3: | |||||
return buffer[index4]; | |||||
break; | |||||
default: | |||||
return buffer[index1]; | |||||
break; | |||||
} | |||||
} | |||||
void SetLength (int Length) | |||||
{ | |||||
if( Length >= maxLength ) | |||||
Length = maxLength; | |||||
if( Length < 0 ) | |||||
Length = 0; | |||||
this->Length = Length; | |||||
} | |||||
void Clear() | |||||
{ | |||||
std::memset(buffer, 0, sizeof(buffer)); | |||||
index1 = index2 = index3 = index4 = 0; | |||||
} | |||||
void SetFeedback(T feedback) | |||||
{ | |||||
Feedback = feedback; | |||||
} | |||||
int GetLength() const | |||||
{ | |||||
return Length; | |||||
} | |||||
}; | |||||
template<typename T, int maxLength> | |||||
class StaticDelayLine | |||||
{ | |||||
private: | |||||
T buffer[maxLength]; | |||||
int index; | |||||
int Length; | |||||
T Feedback; | |||||
public: | |||||
StaticDelayLine() | |||||
{ | |||||
SetLength ( maxLength - 1 ); | |||||
Clear(); | |||||
} | |||||
T operator()(T input) | |||||
{ | |||||
T output = buffer[index]; | |||||
buffer[index++] = input; | |||||
if(index >= Length) | |||||
index = 0; | |||||
return output; | |||||
} | |||||
void SetLength (int Length) | |||||
{ | |||||
if( Length >= maxLength ) | |||||
Length = maxLength; | |||||
if( Length < 0 ) | |||||
Length = 0; | |||||
this->Length = Length; | |||||
} | |||||
void Clear() | |||||
{ | |||||
std::memset(buffer, 0, sizeof(buffer)); | |||||
index = 0; | |||||
} | |||||
int GetLength() const | |||||
{ | |||||
return Length; | |||||
} | |||||
}; | |||||
template<typename T, int maxLength> | |||||
class StaticDelayLineFourTap | |||||
{ | |||||
private: | |||||
T buffer[maxLength]; | |||||
int index1, index2, index3, index4; | |||||
int Length; | |||||
T Feedback; | |||||
public: | |||||
StaticDelayLineFourTap() | |||||
{ | |||||
SetLength ( maxLength - 1 ); | |||||
Clear(); | |||||
} | |||||
//get ouput and iterate | |||||
T operator()(T input) | |||||
{ | |||||
T output = buffer[index1]; | |||||
buffer[index1++] = input; | |||||
if(index1 >= Length) | |||||
index1 = 0; | |||||
if(++index2 >= Length) | |||||
index2 = 0; | |||||
if(++index3 >= Length) | |||||
index3 = 0; | |||||
if(++index4 >= Length) | |||||
index4 = 0; | |||||
return output; | |||||
} | |||||
void SetIndex (int Index1, int Index2, int Index3, int Index4) | |||||
{ | |||||
index1 = Index1; | |||||
index2 = Index2; | |||||
index3 = Index3; | |||||
index4 = Index4; | |||||
} | |||||
T GetIndex (int Index) | |||||
{ | |||||
switch (Index) | |||||
{ | |||||
case 0: | |||||
return buffer[index1]; | |||||
break; | |||||
case 1: | |||||
return buffer[index2]; | |||||
break; | |||||
case 2: | |||||
return buffer[index3]; | |||||
break; | |||||
case 3: | |||||
return buffer[index4]; | |||||
break; | |||||
default: | |||||
return buffer[index1]; | |||||
break; | |||||
} | |||||
} | |||||
void SetLength (int Length) | |||||
{ | |||||
if( Length >= maxLength ) | |||||
Length = maxLength; | |||||
if( Length < 0 ) | |||||
Length = 0; | |||||
this->Length = Length; | |||||
} | |||||
void Clear() | |||||
{ | |||||
std::memset(buffer, 0, sizeof(buffer)); | |||||
index1 = index2 = index3 = index4 = 0; | |||||
} | |||||
int GetLength() const | |||||
{ | |||||
return Length; | |||||
} | |||||
}; | |||||
template<typename T, int maxLength> | |||||
class StaticDelayLineEightTap | |||||
{ | |||||
private: | |||||
T buffer[maxLength]; | |||||
int index1, index2, index3, index4, index5, index6, index7, index8; | |||||
int Length; | |||||
T Feedback; | |||||
public: | |||||
StaticDelayLineEightTap() | |||||
{ | |||||
SetLength ( maxLength - 1 ); | |||||
Clear(); | |||||
} | |||||
//get ouput and iterate | |||||
T operator()(T input) | |||||
{ | |||||
T output = buffer[index1]; | |||||
buffer[index1++] = input; | |||||
if(index1 >= Length) | |||||
index1 = 0; | |||||
if(++index2 >= Length) | |||||
index2 = 0; | |||||
if(++index3 >= Length) | |||||
index3 = 0; | |||||
if(++index4 >= Length) | |||||
index4 = 0; | |||||
if(++index5 >= Length) | |||||
index5 = 0; | |||||
if(++index6 >= Length) | |||||
index6 = 0; | |||||
if(++index7 >= Length) | |||||
index7 = 0; | |||||
if(++index8 >= Length) | |||||
index8 = 0; | |||||
return output; | |||||
} | |||||
void SetIndex (int Index1, int Index2, int Index3, int Index4, int Index5, int Index6, int Index7, int Index8) | |||||
{ | |||||
index1 = Index1; | |||||
index2 = Index2; | |||||
index3 = Index3; | |||||
index4 = Index4; | |||||
index5 = Index5; | |||||
index6 = Index6; | |||||
index7 = Index7; | |||||
index8 = Index8; | |||||
} | |||||
T GetIndex (int Index) | |||||
{ | |||||
switch (Index) | |||||
{ | |||||
case 0: | |||||
return buffer[index1]; | |||||
break; | |||||
case 1: | |||||
return buffer[index2]; | |||||
break; | |||||
case 2: | |||||
return buffer[index3]; | |||||
break; | |||||
case 3: | |||||
return buffer[index4]; | |||||
break; | |||||
case 4: | |||||
return buffer[index5]; | |||||
break; | |||||
case 5: | |||||
return buffer[index6]; | |||||
break; | |||||
case 6: | |||||
return buffer[index7]; | |||||
break; | |||||
case 7: | |||||
return buffer[index8]; | |||||
break; | |||||
default: | |||||
return buffer[index1]; | |||||
break; | |||||
} | |||||
} | |||||
void SetLength (int Length) | |||||
{ | |||||
if( Length >= maxLength ) | |||||
Length = maxLength; | |||||
if( Length < 0 ) | |||||
Length = 0; | |||||
this->Length = Length; | |||||
} | |||||
void Clear() | |||||
{ | |||||
std::memset(buffer, 0, sizeof(buffer)); | |||||
index1 = index2 = index3 = index4 = index5 = index6 = index7 = index8 = 0; | |||||
} | |||||
int GetLength() const | |||||
{ | |||||
return Length; | |||||
} | |||||
}; | |||||
template<typename T, int OverSampleCount> | |||||
class StateVariable | |||||
{ | |||||
public: | |||||
enum FilterType | |||||
{ | |||||
LOWPASS, | |||||
HIGHPASS, | |||||
BANDPASS, | |||||
NOTCH, | |||||
FilterTypeCount | |||||
}; | |||||
private: | |||||
T sampleRate; | |||||
T frequency; | |||||
T q; | |||||
T f; | |||||
T low; | |||||
T high; | |||||
T band; | |||||
T notch; | |||||
T *out; | |||||
public: | |||||
StateVariable() | |||||
{ | |||||
SetSampleRate(44100.); | |||||
Frequency(1000.); | |||||
Resonance(0); | |||||
Type(LOWPASS); | |||||
Reset(); | |||||
} | |||||
T operator()(T input) | |||||
{ | |||||
for(unsigned int i = 0; i < OverSampleCount; i++) | |||||
{ | |||||
low += f * band + 1e-25; | |||||
high = input - low - q * band; | |||||
band += f * high; | |||||
notch = low + high; | |||||
} | |||||
return *out; | |||||
} | |||||
void Reset() | |||||
{ | |||||
low = high = band = notch = 0; | |||||
} | |||||
void SetSampleRate(T sampleRate) | |||||
{ | |||||
this->sampleRate = sampleRate * OverSampleCount; | |||||
UpdateCoefficient(); | |||||
} | |||||
void Frequency(T frequency) | |||||
{ | |||||
this->frequency = frequency; | |||||
UpdateCoefficient(); | |||||
} | |||||
void Resonance(T resonance) | |||||
{ | |||||
this->q = 2 - 2 * resonance; | |||||
} | |||||
void Type(int type) | |||||
{ | |||||
switch(type) | |||||
{ | |||||
case LOWPASS: | |||||
out = &low; | |||||
break; | |||||
case HIGHPASS: | |||||
out = &high; | |||||
break; | |||||
case BANDPASS: | |||||
out = &band; | |||||
break; | |||||
case NOTCH: | |||||
out = ¬ch; | |||||
break; | |||||
default: | |||||
out = &low; | |||||
break; | |||||
} | |||||
} | |||||
private: | |||||
void UpdateCoefficient() | |||||
{ | |||||
f = 2. * std::sin(M_PI * frequency / sampleRate); | |||||
} | |||||
}; | |||||
#endif |
@@ -0,0 +1,54 @@ | |||||
#!/usr/bin/make -f | |||||
# Makefile for DISTRHO Plugins # | |||||
# ---------------------------- # | |||||
# Created by falkTX | |||||
# | |||||
# -------------------------------------------------------------- | |||||
# Project name, used for binaries | |||||
NAME = MVerb | |||||
# -------------------------------------------------------------- | |||||
# Files to build | |||||
OBJS_DSP = \ | |||||
DistrhoPluginMVerb.cpp.o | |||||
OBJS_UI = \ | |||||
DistrhoArtworkMVerb.cpp.o \ | |||||
DistrhoUIMVerb.cpp.o \ | |||||
font/Kh-Kangrey.cpp.o | |||||
# -------------------------------------------------------------- | |||||
# Do some magic | |||||
include ../Makefile.MVerb.mk | |||||
# -------------------------------------------------------------- | |||||
# Enable all possible plugin types | |||||
ifeq ($(HAVE_JACK),true) | |||||
TARGETS += jack | |||||
endif | |||||
ifeq ($(LINUX),true) | |||||
TARGETS += ladspa | |||||
ifeq ($(HAVE_DGL),true) | |||||
ifeq ($(HAVE_LIBLO),true) | |||||
TARGETS += dssi | |||||
endif | |||||
endif | |||||
endif | |||||
ifeq ($(HAVE_DGL),true) | |||||
TARGETS += lv2_sep | |||||
else | |||||
TARGETS += lv2_dsp | |||||
endif | |||||
TARGETS += vst | |||||
all: $(TARGETS) | |||||
# -------------------------------------------------------------- |
@@ -0,0 +1,9 @@ | |||||
/* binary data of Kh-Kangrey.ttf */ | |||||
#ifndef BINARY_KH_KANGREY_H | |||||
#define BINARY_KH_KANGREY_H | |||||
extern const char* khkangrey_ttf; | |||||
const int khkangrey_ttfSize = 158316; | |||||
#endif |
@@ -0,0 +1 @@ | |||||
http://openfontlibrary.org/en/font/kh-kangrey |
@@ -0,0 +1,149 @@ | |||||
#!/usr/bin/make -f | |||||
# Makefile for DISTRHO Plugins # | |||||
# ---------------------------- # | |||||
# Created by falkTX | |||||
# | |||||
# NAME, OBJS_DSP and OBJS_UI have been defined before | |||||
include ../../Makefile.mk | |||||
# -------------------------------------------------------------- | |||||
# Basic setup | |||||
TARGET_DIR = ../../bin | |||||
BUILD_C_FLAGS += -I. | |||||
BUILD_CXX_FLAGS += -I. -I../../dpf/distrho -I../../dpf/dgl | |||||
ifeq ($(HAVE_DGL),true) | |||||
BASE_FLAGS += -DHAVE_DGL | |||||
endif | |||||
ifeq ($(HAVE_JACK),true) | |||||
BASE_FLAGS += -DHAVE_JACK | |||||
endif | |||||
ifeq ($(HAVE_LIBLO),true) | |||||
BASE_FLAGS += -DHAVE_LIBLO | |||||
endif | |||||
# -------------------------------------------------------------- | |||||
# Set plugin binary file targets | |||||
jack = $(TARGET_DIR)/$(NAME)$(APP_EXT) | |||||
ladspa_dsp = $(TARGET_DIR)/$(NAME)-ladspa$(LIB_EXT) | |||||
dssi_dsp = $(TARGET_DIR)/$(NAME)-dssi$(LIB_EXT) | |||||
dssi_ui = $(TARGET_DIR)/$(NAME)-dssi/$(NAME)_ui$(APP_EXT) | |||||
lv2 = $(TARGET_DIR)/$(NAME).lv2/$(NAME)$(LIB_EXT) | |||||
lv2_dsp = $(TARGET_DIR)/$(NAME).lv2/$(NAME)_dsp$(LIB_EXT) | |||||
lv2_ui = $(TARGET_DIR)/$(NAME).lv2/$(NAME)_ui$(LIB_EXT) | |||||
vst = $(TARGET_DIR)/$(NAME)-vst$(LIB_EXT) | |||||
# -------------------------------------------------------------- | |||||
# Set distrho code files | |||||
DISTRHO_PLUGIN_FILES = ../../dpf/distrho/DistrhoPluginMain.cpp | |||||
ifeq ($(HAVE_DGL),true) | |||||
DISTRHO_UI_FILES = ../../dpf/distrho/DistrhoUIMain.cpp ../../dpf/libdgl.a | |||||
endif | |||||
# -------------------------------------------------------------- | |||||
# Handle plugins without UI | |||||
ifneq ($(HAVE_DGL),true) | |||||
dssi_ui = | |||||
lv2_ui = | |||||
DISTRHO_UI_FILES = | |||||
DGL_LIBS = | |||||
OBJS_UI = | |||||
endif | |||||
# -------------------------------------------------------------- | |||||
# all needs to be first | |||||
all: | |||||
# -------------------------------------------------------------- | |||||
# Common | |||||
%.c.o: %.c | |||||
$(CC) $< $(BUILD_C_FLAGS) -MD -MP -c -o $@ | |||||
%.cpp.o: %.cpp | |||||
$(CXX) $< $(BUILD_CXX_FLAGS) -MD -MP -c -o $@ | |||||
clean: | |||||
rm -f *.d *.o font/*.d font/*.o | |||||
rm -rf $(TARGET_DIR)/$(NAME) $(TARGET_DIR)/$(NAME)-* $(TARGET_DIR)/$(NAME).lv2/ | |||||
# -------------------------------------------------------------- | |||||
# JACK | |||||
jack: $(jack) | |||||
$(jack): $(OBJS_DSP) $(OBJS_UI) $(DISTRHO_PLUGIN_FILES) $(DISTRHO_UI_FILES) | |||||
mkdir -p $(shell dirname $@) | |||||
$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(DGL_LIBS) $(shell pkg-config --cflags --libs jack) -DDISTRHO_PLUGIN_TARGET_JACK -o $@ | |||||
# -------------------------------------------------------------- | |||||
# LADSPA | |||||
ladspa: $(ladspa_dsp) | |||||
$(ladspa_dsp): $(OBJS_DSP) $(DISTRHO_PLUGIN_FILES) | |||||
mkdir -p $(shell dirname $@) | |||||
$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(SHARED) -DDISTRHO_PLUGIN_TARGET_LADSPA -o $@ | |||||
# -------------------------------------------------------------- | |||||
# DSSI | |||||
dssi: $(dssi_dsp) $(dssi_ui) | |||||
dssi_dsp: $(dssi_dsp) | |||||
dssi_ui: $(dssi_ui) | |||||
$(dssi_dsp): $(OBJS_DSP) $(DISTRHO_PLUGIN_FILES) | |||||
mkdir -p $(shell dirname $@) | |||||
$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(SHARED) -DDISTRHO_PLUGIN_TARGET_DSSI -o $@ | |||||
$(dssi_ui): $(OBJS_UI) $(DISTRHO_UI_FILES) | |||||
mkdir -p $(shell dirname $@) | |||||
$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(DGL_LIBS) $(shell pkg-config --cflags --libs liblo) -DDISTRHO_PLUGIN_TARGET_DSSI -o $@ | |||||
# -------------------------------------------------------------- | |||||
# LV2 | |||||
lv2_one: $(lv2) | |||||
lv2_dsp: $(lv2_dsp) | |||||
lv2_sep: $(lv2_dsp) $(lv2_ui) | |||||
$(lv2): $(OBJS_DSP) $(OBJS_UI) $(DISTRHO_PLUGIN_FILES) $(DISTRHO_UI_FILES) | |||||
mkdir -p $(shell dirname $@) | |||||
$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(DGL_LIBS) $(SHARED) -DDISTRHO_PLUGIN_TARGET_LV2 -o $@ | |||||
$(lv2_dsp): $(OBJS_DSP) $(DISTRHO_PLUGIN_FILES) | |||||
mkdir -p $(shell dirname $@) | |||||
$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(SHARED) -DDISTRHO_PLUGIN_TARGET_LV2 -o $@ | |||||
$(lv2_ui): $(OBJS_UI) $(DISTRHO_UI_FILES) | |||||
mkdir -p $(shell dirname $@) | |||||
$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(DGL_LIBS) $(SHARED) -DDISTRHO_PLUGIN_TARGET_LV2 -o $@ | |||||
# -------------------------------------------------------------- | |||||
# VST | |||||
vst: $(vst) | |||||
$(vst): $(OBJS_DSP) $(OBJS_UI) $(DISTRHO_PLUGIN_FILES) $(DISTRHO_UI_FILES) | |||||
mkdir -p $(shell dirname $@) | |||||
$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(DGL_LIBS) $(SHARED) -DDISTRHO_PLUGIN_TARGET_VST -o $@ | |||||
# -------------------------------------------------------------- | |||||
-include $(OBJS_DSP:%.o=%.d) | |||||
ifeq ($(HAVE_DGL),true) | |||||
-include $(OBJS_UI:%.o=%.d) | |||||
endif | |||||
# -------------------------------------------------------------- |
@@ -0,0 +1,149 @@ | |||||
#!/usr/bin/make -f | |||||
# Makefile for DISTRHO Plugins # | |||||
# ---------------------------- # | |||||
# Created by falkTX | |||||
# | |||||
# NAME, OBJS_DSP and OBJS_UI have been defined before | |||||
include ../../Makefile.mk | |||||
# -------------------------------------------------------------- | |||||
# Basic setup | |||||
TARGET_DIR = ../../bin | |||||
BUILD_C_FLAGS += -I. | |||||
BUILD_CXX_FLAGS += -I. -I../../dpf/distrho -I../../dpf/dgl | |||||
ifeq ($(HAVE_DGL),true) | |||||
BASE_FLAGS += -DHAVE_DGL | |||||
endif | |||||
ifeq ($(HAVE_JACK),true) | |||||
BASE_FLAGS += -DHAVE_JACK | |||||
endif | |||||
ifeq ($(HAVE_LIBLO),true) | |||||
BASE_FLAGS += -DHAVE_LIBLO | |||||
endif | |||||
# -------------------------------------------------------------- | |||||
# Set plugin binary file targets | |||||
jack = $(TARGET_DIR)/$(NAME)$(APP_EXT) | |||||
ladspa_dsp = $(TARGET_DIR)/$(NAME)-ladspa$(LIB_EXT) | |||||
dssi_dsp = $(TARGET_DIR)/$(NAME)-dssi$(LIB_EXT) | |||||
dssi_ui = $(TARGET_DIR)/$(NAME)-dssi/$(NAME)_ui$(APP_EXT) | |||||
lv2 = $(TARGET_DIR)/$(NAME).lv2/$(NAME)$(LIB_EXT) | |||||
lv2_dsp = $(TARGET_DIR)/$(NAME).lv2/$(NAME)_dsp$(LIB_EXT) | |||||
lv2_ui = $(TARGET_DIR)/$(NAME).lv2/$(NAME)_ui$(LIB_EXT) | |||||
vst = $(TARGET_DIR)/$(NAME)-vst$(LIB_EXT) | |||||
# -------------------------------------------------------------- | |||||
# Set distrho code files | |||||
DISTRHO_PLUGIN_FILES = ../../dpf/distrho/DistrhoPluginMain.cpp | |||||
ifeq ($(HAVE_DGL),true) | |||||
DISTRHO_UI_FILES = ../../dpf/distrho/DistrhoUIMain.cpp ../../dpf/libdgl.a | |||||
endif | |||||
# -------------------------------------------------------------- | |||||
# Handle plugins without UI | |||||
ifneq ($(HAVE_DGL),true) | |||||
dssi_ui = | |||||
lv2_ui = | |||||
DISTRHO_UI_FILES = | |||||
DGL_LIBS = | |||||
OBJS_UI = | |||||
endif | |||||
# -------------------------------------------------------------- | |||||
# all needs to be first | |||||
all: | |||||
# -------------------------------------------------------------- | |||||
# Common | |||||
%.c.o: %.c | |||||
$(CC) $< $(BUILD_C_FLAGS) -MD -MP -c -o $@ | |||||
%.cpp.o: %.cpp | |||||
$(CXX) $< $(BUILD_CXX_FLAGS) -MD -MP -c -o $@ | |||||
clean: | |||||
rm -f *.d *.o | |||||
rm -rf $(TARGET_DIR)/$(NAME) $(TARGET_DIR)/$(NAME)-* $(TARGET_DIR)/$(NAME).lv2/ | |||||
# -------------------------------------------------------------- | |||||
# JACK | |||||
jack: $(jack) | |||||
$(jack): $(OBJS_DSP) $(OBJS_UI) $(DISTRHO_PLUGIN_FILES) $(DISTRHO_UI_FILES) | |||||
mkdir -p $(shell dirname $@) | |||||
$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(DGL_LIBS) $(shell pkg-config --cflags --libs jack) -DDISTRHO_PLUGIN_TARGET_JACK -o $@ | |||||
# -------------------------------------------------------------- | |||||
# LADSPA | |||||
ladspa: $(ladspa_dsp) | |||||
$(ladspa_dsp): $(OBJS_DSP) $(DISTRHO_PLUGIN_FILES) | |||||
mkdir -p $(shell dirname $@) | |||||
$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(SHARED) -DDISTRHO_PLUGIN_TARGET_LADSPA -o $@ | |||||
# -------------------------------------------------------------- | |||||
# DSSI | |||||
dssi: $(dssi_dsp) $(dssi_ui) | |||||
dssi_dsp: $(dssi_dsp) | |||||
dssi_ui: $(dssi_ui) | |||||
$(dssi_dsp): $(OBJS_DSP) $(DISTRHO_PLUGIN_FILES) | |||||
mkdir -p $(shell dirname $@) | |||||
$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(SHARED) -DDISTRHO_PLUGIN_TARGET_DSSI -o $@ | |||||
$(dssi_ui): $(OBJS_UI) $(DISTRHO_UI_FILES) | |||||
mkdir -p $(shell dirname $@) | |||||
$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(DGL_LIBS) $(shell pkg-config --cflags --libs liblo) -DDISTRHO_PLUGIN_TARGET_DSSI -o $@ | |||||
# -------------------------------------------------------------- | |||||
# LV2 | |||||
lv2_one: $(lv2) | |||||
lv2_dsp: $(lv2_dsp) | |||||
lv2_sep: $(lv2_dsp) $(lv2_ui) | |||||
$(lv2): $(OBJS_DSP) $(OBJS_UI) $(DISTRHO_PLUGIN_FILES) $(DISTRHO_UI_FILES) | |||||
mkdir -p $(shell dirname $@) | |||||
$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(DGL_LIBS) $(SHARED) -DDISTRHO_PLUGIN_TARGET_LV2 -o $@ | |||||
$(lv2_dsp): $(OBJS_DSP) $(DISTRHO_PLUGIN_FILES) | |||||
mkdir -p $(shell dirname $@) | |||||
$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(SHARED) -DDISTRHO_PLUGIN_TARGET_LV2 -o $@ | |||||
$(lv2_ui): $(OBJS_UI) $(DISTRHO_UI_FILES) | |||||
mkdir -p $(shell dirname $@) | |||||
$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(DGL_LIBS) $(SHARED) -DDISTRHO_PLUGIN_TARGET_LV2 -o $@ | |||||
# -------------------------------------------------------------- | |||||
# VST | |||||
vst: $(vst) | |||||
$(vst): $(OBJS_DSP) $(OBJS_UI) $(DISTRHO_PLUGIN_FILES) $(DISTRHO_UI_FILES) | |||||
mkdir -p $(shell dirname $@) | |||||
$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(DGL_LIBS) $(SHARED) -DDISTRHO_PLUGIN_TARGET_VST -o $@ | |||||
# -------------------------------------------------------------- | |||||
-include $(OBJS_DSP:%.o=%.d) | |||||
ifeq ($(HAVE_DGL),true) | |||||
-include $(OBJS_UI:%.o=%.d) | |||||
endif | |||||
# -------------------------------------------------------------- |
@@ -0,0 +1,149 @@ | |||||
#!/usr/bin/make -f | |||||
# Makefile for DISTRHO Plugins # | |||||
# ---------------------------- # | |||||
# Created by falkTX | |||||
# | |||||
# NAME, OBJS_DSP and OBJS_UI have been defined before | |||||
include ../../Makefile.mk | |||||
# -------------------------------------------------------------- | |||||
# Basic setup | |||||
TARGET_DIR = ../../bin | |||||
BUILD_C_FLAGS += -I. | |||||
BUILD_CXX_FLAGS += -I. -I../../dpf/distrho -I../../dpf/dgl | |||||
ifeq ($(HAVE_DGL),true) | |||||
BASE_FLAGS += -DHAVE_DGL | |||||
endif | |||||
ifeq ($(HAVE_JACK),true) | |||||
BASE_FLAGS += -DHAVE_JACK | |||||
endif | |||||
ifeq ($(HAVE_LIBLO),true) | |||||
BASE_FLAGS += -DHAVE_LIBLO | |||||
endif | |||||
# -------------------------------------------------------------- | |||||
# Set plugin binary file targets | |||||
jack = $(TARGET_DIR)/$(NAME)$(APP_EXT) | |||||
ladspa_dsp = $(TARGET_DIR)/$(NAME)-ladspa$(LIB_EXT) | |||||
dssi_dsp = $(TARGET_DIR)/$(NAME)-dssi$(LIB_EXT) | |||||
dssi_ui = $(TARGET_DIR)/$(NAME)-dssi/$(NAME)_ui$(APP_EXT) | |||||
lv2 = $(TARGET_DIR)/$(NAME).lv2/$(NAME)$(LIB_EXT) | |||||
lv2_dsp = $(TARGET_DIR)/$(NAME).lv2/$(NAME)_dsp$(LIB_EXT) | |||||
lv2_ui = $(TARGET_DIR)/$(NAME).lv2/$(NAME)_ui$(LIB_EXT) | |||||
vst = $(TARGET_DIR)/$(NAME)-vst$(LIB_EXT) | |||||
# -------------------------------------------------------------- | |||||
# Set distrho code files | |||||
DISTRHO_PLUGIN_FILES = ../../dpf/distrho/DistrhoPluginMain.cpp | |||||
ifeq ($(HAVE_DGL),true) | |||||
DISTRHO_UI_FILES = ../../dpf/distrho/DistrhoUIMain.cpp ../../dpf/libdgl.a | |||||
endif | |||||
# -------------------------------------------------------------- | |||||
# Handle plugins without UI | |||||
ifneq ($(HAVE_DGL),true) | |||||
dssi_ui = | |||||
lv2_ui = | |||||
DISTRHO_UI_FILES = | |||||
DGL_LIBS = | |||||
OBJS_UI = | |||||
endif | |||||
# -------------------------------------------------------------- | |||||
# all needs to be first | |||||
all: | |||||
# -------------------------------------------------------------- | |||||
# Common | |||||
%.c.o: %.c | |||||
$(CC) $< $(BUILD_C_FLAGS) -MD -MP -c -o $@ | |||||
%.cpp.o: %.cpp | |||||
$(CXX) $< $(BUILD_CXX_FLAGS) -MD -MP -c -o $@ | |||||
clean: | |||||
rm -f *.d *.o | |||||
rm -rf $(TARGET_DIR)/$(NAME) $(TARGET_DIR)/$(NAME)-* $(TARGET_DIR)/$(NAME).lv2/ | |||||
# -------------------------------------------------------------- | |||||
# JACK | |||||
jack: $(jack) | |||||
$(jack): $(OBJS_DSP) $(OBJS_UI) $(DISTRHO_PLUGIN_FILES) $(DISTRHO_UI_FILES) | |||||
mkdir -p $(shell dirname $@) | |||||
$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) -lpthread $(DGL_LIBS) $(shell pkg-config --cflags --libs jack) -DDISTRHO_PLUGIN_TARGET_JACK -o $@ | |||||
# -------------------------------------------------------------- | |||||
# LADSPA | |||||
ladspa: $(ladspa_dsp) | |||||
$(ladspa_dsp): $(OBJS_DSP) $(DISTRHO_PLUGIN_FILES) | |||||
mkdir -p $(shell dirname $@) | |||||
$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) -lpthread $(SHARED) -DDISTRHO_PLUGIN_TARGET_LADSPA -o $@ | |||||
# -------------------------------------------------------------- | |||||
# DSSI | |||||
dssi: $(dssi_dsp) $(dssi_ui) | |||||
dssi_dsp: $(dssi_dsp) | |||||
dssi_ui: $(dssi_ui) | |||||
$(dssi_dsp): $(OBJS_DSP) $(DISTRHO_PLUGIN_FILES) | |||||
mkdir -p $(shell dirname $@) | |||||
$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) -lpthread $(SHARED) -DDISTRHO_PLUGIN_TARGET_DSSI -o $@ | |||||
$(dssi_ui): $(OBJS_UI) $(DISTRHO_UI_FILES) | |||||
mkdir -p $(shell dirname $@) | |||||
$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(DGL_LIBS) $(shell pkg-config --cflags --libs liblo) -DDISTRHO_PLUGIN_TARGET_DSSI -o $@ | |||||
# -------------------------------------------------------------- | |||||
# LV2 | |||||
lv2_one: $(lv2) | |||||
lv2_dsp: $(lv2_dsp) | |||||
lv2_sep: $(lv2_dsp) $(lv2_ui) | |||||
$(lv2): $(OBJS_DSP) $(OBJS_UI) $(DISTRHO_PLUGIN_FILES) $(DISTRHO_UI_FILES) | |||||
mkdir -p $(shell dirname $@) | |||||
$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) -lpthread $(DGL_LIBS) $(SHARED) -DDISTRHO_PLUGIN_TARGET_LV2 -o $@ | |||||
$(lv2_dsp): $(OBJS_DSP) $(DISTRHO_PLUGIN_FILES) | |||||
mkdir -p $(shell dirname $@) | |||||
$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) -lpthread $(SHARED) -DDISTRHO_PLUGIN_TARGET_LV2 -o $@ | |||||
$(lv2_ui): $(OBJS_UI) $(DISTRHO_UI_FILES) | |||||
mkdir -p $(shell dirname $@) | |||||
$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(DGL_LIBS) $(SHARED) -DDISTRHO_PLUGIN_TARGET_LV2 -o $@ | |||||
# -------------------------------------------------------------- | |||||
# VST | |||||
vst: $(vst) | |||||
$(vst): $(OBJS_DSP) $(OBJS_UI) $(DISTRHO_PLUGIN_FILES) $(DISTRHO_UI_FILES) | |||||
mkdir -p $(shell dirname $@) | |||||
$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) -lpthread $(DGL_LIBS) $(SHARED) -DDISTRHO_PLUGIN_TARGET_VST -o $@ | |||||
# -------------------------------------------------------------- | |||||
-include $(OBJS_DSP:%.o=%.d) | |||||
ifeq ($(HAVE_DGL),true) | |||||
-include $(OBJS_UI:%.o=%.d) | |||||
endif | |||||
# -------------------------------------------------------------- |
@@ -0,0 +1,88 @@ | |||||
#!/usr/bin/make -f | |||||
# Makefile for DISTRHO Plugins # | |||||
# ---------------------------- # | |||||
# Created by falkTX | |||||
# | |||||
# NAME, OBJS_DSP and OBJS_UI have been defined before | |||||
include ../../Makefile.mk | |||||
# -------------------------------------------------------------- | |||||
# Basic setup | |||||
TARGET_DIR = ../../bin | |||||
BUILD_C_FLAGS += -I. | |||||
BUILD_CXX_FLAGS += -I. -I../../dpf/distrho -I../../dpf/dgl | |||||
BASE_FLAGS += -DHAVE_DGL | |||||
ifeq ($(HAVE_JACK),true) | |||||
BASE_FLAGS += -DHAVE_JACK | |||||
endif | |||||
# -------------------------------------------------------------- | |||||
# Set plugin binary file targets | |||||
jack = $(TARGET_DIR)/$(NAME)$(APP_EXT) | |||||
lv2 = $(TARGET_DIR)/$(NAME).lv2/$(NAME)$(LIB_EXT) | |||||
vst = $(TARGET_DIR)/$(NAME)-vst$(LIB_EXT) | |||||
# -------------------------------------------------------------- | |||||
# Set distrho code files | |||||
DISTRHO_PLUGIN_FILES = ../../dpf/distrho/DistrhoPluginMain.cpp | |||||
DISTRHO_UI_FILES = ../../dpf/distrho/DistrhoUIMain.cpp ../../dpf/libdgl.a | |||||
# -------------------------------------------------------------- | |||||
# all needs to be first | |||||
all: | |||||
# -------------------------------------------------------------- | |||||
# Common | |||||
%.c.o: %.c | |||||
$(CC) $< $(BUILD_C_FLAGS) -MD -MP -c -o $@ | |||||
%.cpp.o: %.cpp | |||||
$(CXX) $< $(BUILD_CXX_FLAGS) -MD -MP -c -o $@ | |||||
clean: | |||||
rm -f *.d *.o | |||||
rm -rf $(TARGET_DIR)/$(NAME) $(TARGET_DIR)/$(NAME)-* $(TARGET_DIR)/$(NAME).lv2/ | |||||
# -------------------------------------------------------------- | |||||
# JACK | |||||
jack: $(jack) | |||||
$(jack): $(OBJS_DSP) $(OBJS_UI) $(DISTRHO_PLUGIN_FILES) $(DISTRHO_UI_FILES) | |||||
mkdir -p $(shell dirname $@) | |||||
$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(DGL_LIBS) $(shell pkg-config --cflags --libs jack libprojectM) -lpthread -DDISTRHO_PLUGIN_TARGET_JACK -o $@ | |||||
# -------------------------------------------------------------- | |||||
# LV2 | |||||
lv2: $(lv2) | |||||
$(lv2): $(OBJS_DSP) $(OBJS_UI) $(DISTRHO_PLUGIN_FILES) $(DISTRHO_UI_FILES) | |||||
mkdir -p $(shell dirname $@) | |||||
$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(DGL_LIBS) $(shell pkg-config --cflags --libs libprojectM) -lpthread $(SHARED) -DDISTRHO_PLUGIN_TARGET_LV2 -o $@ | |||||
# -------------------------------------------------------------- | |||||
# VST | |||||
vst: $(vst) | |||||
$(vst): $(OBJS_DSP) $(OBJS_UI) $(DISTRHO_PLUGIN_FILES) $(DISTRHO_UI_FILES) | |||||
mkdir -p $(shell dirname $@) | |||||
$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(DGL_LIBS) $(shell pkg-config --cflags --libs libprojectM) -lpthread $(SHARED) -DDISTRHO_PLUGIN_TARGET_VST -o $@ | |||||
# -------------------------------------------------------------- | |||||
-include $(OBJS_DSP:%.o=%.d) | |||||
-include $(OBJS_UI:%.o=%.d) | |||||
# -------------------------------------------------------------- |
@@ -0,0 +1,149 @@ | |||||
#!/usr/bin/make -f | |||||
# Makefile for DISTRHO Plugins # | |||||
# ---------------------------- # | |||||
# Created by falkTX | |||||
# | |||||
# NAME, OBJS_DSP and OBJS_UI have been defined before | |||||
include ../../Makefile.mk | |||||
# -------------------------------------------------------------- | |||||
# Basic setup | |||||
TARGET_DIR = ../../bin | |||||
BUILD_C_FLAGS += -I. | |||||
BUILD_CXX_FLAGS += -I. -I../../dpf/distrho -I../../dpf/dgl | |||||
ifeq ($(HAVE_DGL),true) | |||||
BASE_FLAGS += -DHAVE_DGL | |||||
endif | |||||
ifeq ($(HAVE_JACK),true) | |||||
BASE_FLAGS += -DHAVE_JACK | |||||
endif | |||||
ifeq ($(HAVE_LIBLO),true) | |||||
BASE_FLAGS += -DHAVE_LIBLO | |||||
endif | |||||
# -------------------------------------------------------------- | |||||
# Set plugin binary file targets | |||||
jack = $(TARGET_DIR)/$(NAME)$(APP_EXT) | |||||
ladspa_dsp = $(TARGET_DIR)/$(NAME)-ladspa$(LIB_EXT) | |||||
dssi_dsp = $(TARGET_DIR)/$(NAME)-dssi$(LIB_EXT) | |||||
dssi_ui = $(TARGET_DIR)/$(NAME)-dssi/$(NAME)_ui$(APP_EXT) | |||||
lv2 = $(TARGET_DIR)/$(NAME).lv2/$(NAME)$(LIB_EXT) | |||||
lv2_dsp = $(TARGET_DIR)/$(NAME).lv2/$(NAME)_dsp$(LIB_EXT) | |||||
lv2_ui = $(TARGET_DIR)/$(NAME).lv2/$(NAME)_ui$(LIB_EXT) | |||||
vst = $(TARGET_DIR)/$(NAME)-vst$(LIB_EXT) | |||||
# -------------------------------------------------------------- | |||||
# Set distrho code files | |||||
DISTRHO_PLUGIN_FILES = ../../dpf/distrho/DistrhoPluginMain.cpp | |||||
ifeq ($(HAVE_DGL),true) | |||||
DISTRHO_UI_FILES = ../../dpf/distrho/DistrhoUIMain.cpp ../../dpf/libdgl.a | |||||
endif | |||||
# -------------------------------------------------------------- | |||||
# Handle plugins without UI | |||||
ifneq ($(HAVE_DGL),true) | |||||
dssi_ui = | |||||
lv2_ui = | |||||
DISTRHO_UI_FILES = | |||||
DGL_LIBS = | |||||
OBJS_UI = | |||||
endif | |||||
# -------------------------------------------------------------- | |||||
# all needs to be first | |||||
all: | |||||
# -------------------------------------------------------------- | |||||
# Common | |||||
%.c.o: %.c | |||||
$(CC) $< $(BUILD_C_FLAGS) -MD -MP -c -o $@ | |||||
%.cpp.o: %.cpp | |||||
$(CXX) $< $(BUILD_CXX_FLAGS) -MD -MP -c -o $@ | |||||
clean: | |||||
rm -f *.d *.o font/*.d font/*.o | |||||
rm -rf $(TARGET_DIR)/$(NAME) $(TARGET_DIR)/$(NAME)-* $(TARGET_DIR)/$(NAME).lv2/ | |||||
# -------------------------------------------------------------- | |||||
# JACK | |||||
jack: $(jack) | |||||
$(jack): $(OBJS_DSP) $(OBJS_UI) $(DISTRHO_PLUGIN_FILES) $(DISTRHO_UI_FILES) | |||||
mkdir -p $(shell dirname $@) | |||||
$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(DGL_LIBS) $(shell pkg-config --cflags --libs jack) -DDISTRHO_PLUGIN_TARGET_JACK -o $@ | |||||
# -------------------------------------------------------------- | |||||
# LADSPA | |||||
ladspa: $(ladspa_dsp) | |||||
$(ladspa_dsp): $(OBJS_DSP) $(DISTRHO_PLUGIN_FILES) | |||||
mkdir -p $(shell dirname $@) | |||||
$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(SHARED) -DDISTRHO_PLUGIN_TARGET_LADSPA -o $@ | |||||
# -------------------------------------------------------------- | |||||
# DSSI | |||||
dssi: $(dssi_dsp) $(dssi_ui) | |||||
dssi_dsp: $(dssi_dsp) | |||||
dssi_ui: $(dssi_ui) | |||||
$(dssi_dsp): $(OBJS_DSP) $(DISTRHO_PLUGIN_FILES) | |||||
mkdir -p $(shell dirname $@) | |||||
$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(SHARED) -DDISTRHO_PLUGIN_TARGET_DSSI -o $@ | |||||
$(dssi_ui): $(OBJS_UI) $(DISTRHO_UI_FILES) | |||||
mkdir -p $(shell dirname $@) | |||||
$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(DGL_LIBS) $(shell pkg-config --cflags --libs liblo) -DDISTRHO_PLUGIN_TARGET_DSSI -o $@ | |||||
# -------------------------------------------------------------- | |||||
# LV2 | |||||
lv2_one: $(lv2) | |||||
lv2_dsp: $(lv2_dsp) | |||||
lv2_sep: $(lv2_dsp) $(lv2_ui) | |||||
$(lv2): $(OBJS_DSP) $(OBJS_UI) $(DISTRHO_PLUGIN_FILES) $(DISTRHO_UI_FILES) | |||||
mkdir -p $(shell dirname $@) | |||||
$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(DGL_LIBS) $(SHARED) -DDISTRHO_PLUGIN_TARGET_LV2 -o $@ | |||||
$(lv2_dsp): $(OBJS_DSP) $(DISTRHO_PLUGIN_FILES) | |||||
mkdir -p $(shell dirname $@) | |||||
$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(SHARED) -DDISTRHO_PLUGIN_TARGET_LV2 -o $@ | |||||
$(lv2_ui): $(OBJS_UI) $(DISTRHO_UI_FILES) | |||||
mkdir -p $(shell dirname $@) | |||||
$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(DGL_LIBS) $(SHARED) -DDISTRHO_PLUGIN_TARGET_LV2 -o $@ | |||||
# -------------------------------------------------------------- | |||||
# VST | |||||
vst: $(vst) | |||||
$(vst): $(OBJS_DSP) $(OBJS_UI) $(DISTRHO_PLUGIN_FILES) $(DISTRHO_UI_FILES) | |||||
mkdir -p $(shell dirname $@) | |||||
$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(DGL_LIBS) $(SHARED) -DDISTRHO_PLUGIN_TARGET_VST -o $@ | |||||
# -------------------------------------------------------------- | |||||
-include $(OBJS_DSP:%.o=%.d) | |||||
ifeq ($(HAVE_DGL),true) | |||||
-include $(OBJS_UI:%.o=%.d) | |||||
endif | |||||
# -------------------------------------------------------------- |
@@ -0,0 +1,90 @@ | |||||
/* (Auto-generated binary data file). */ | |||||
#ifndef BINARY_DISTRHOARTWORKNEKOBI_HPP | |||||
#define BINARY_DISTRHOARTWORKNEKOBI_HPP | |||||
namespace DistrhoArtworkNekobi | |||||
{ | |||||
extern const char* aboutData; | |||||
const unsigned int aboutDataSize = 172710; | |||||
const unsigned int aboutWidth = 303; | |||||
const unsigned int aboutHeight = 190; | |||||
extern const char* aboutButtonHoverData; | |||||
const unsigned int aboutButtonHoverDataSize = 5888; | |||||
const unsigned int aboutButtonHoverWidth = 92; | |||||
const unsigned int aboutButtonHoverHeight = 16; | |||||
extern const char* aboutButtonNormalData; | |||||
const unsigned int aboutButtonNormalDataSize = 5888; | |||||
const unsigned int aboutButtonNormalWidth = 92; | |||||
const unsigned int aboutButtonNormalHeight = 16; | |||||
extern const char* backgroundData; | |||||
const unsigned int backgroundDataSize = 206064; | |||||
const unsigned int backgroundWidth = 636; | |||||
const unsigned int backgroundHeight = 108; | |||||
extern const char* claw1Data; | |||||
const unsigned int claw1DataSize = 4096; | |||||
const unsigned int claw1Width = 32; | |||||
const unsigned int claw1Height = 32; | |||||
extern const char* claw2Data; | |||||
const unsigned int claw2DataSize = 4096; | |||||
const unsigned int claw2Width = 32; | |||||
const unsigned int claw2Height = 32; | |||||
extern const char* knobData; | |||||
const unsigned int knobDataSize = 10000; | |||||
const unsigned int knobWidth = 50; | |||||
const unsigned int knobHeight = 50; | |||||
extern const char* run1Data; | |||||
const unsigned int run1DataSize = 4096; | |||||
const unsigned int run1Width = 32; | |||||
const unsigned int run1Height = 32; | |||||
extern const char* run2Data; | |||||
const unsigned int run2DataSize = 4096; | |||||
const unsigned int run2Width = 32; | |||||
const unsigned int run2Height = 32; | |||||
extern const char* run3Data; | |||||
const unsigned int run3DataSize = 4096; | |||||
const unsigned int run3Width = 32; | |||||
const unsigned int run3Height = 32; | |||||
extern const char* run4Data; | |||||
const unsigned int run4DataSize = 4096; | |||||
const unsigned int run4Width = 32; | |||||
const unsigned int run4Height = 32; | |||||
extern const char* scratch1Data; | |||||
const unsigned int scratch1DataSize = 4096; | |||||
const unsigned int scratch1Width = 32; | |||||
const unsigned int scratch1Height = 32; | |||||
extern const char* scratch2Data; | |||||
const unsigned int scratch2DataSize = 4096; | |||||
const unsigned int scratch2Width = 32; | |||||
const unsigned int scratch2Height = 32; | |||||
extern const char* sitData; | |||||
const unsigned int sitDataSize = 4096; | |||||
const unsigned int sitWidth = 32; | |||||
const unsigned int sitHeight = 32; | |||||
extern const char* sliderData; | |||||
const unsigned int sliderDataSize = 6084; | |||||
const unsigned int sliderWidth = 39; | |||||
const unsigned int sliderHeight = 39; | |||||
extern const char* tailData; | |||||
const unsigned int tailDataSize = 4096; | |||||
const unsigned int tailWidth = 32; | |||||
const unsigned int tailHeight = 32; | |||||
} | |||||
#endif // BINARY_DISTRHOARTWORKNEKOBI_HPP | |||||
@@ -0,0 +1,37 @@ | |||||
/* | |||||
* DISTRHO Nekobi Plugin, based on Nekobee by Sean Bolton and others. | |||||
* Copyright (C) 2013-2015 Filipe Coelho <falktx@falktx.com> | |||||
* | |||||
* This program is free software; you can redistribute it and/or | |||||
* modify it under the terms of the GNU General Public License as | |||||
* published by the Free Software Foundation; either version 2 of | |||||
* the License, or any later version. | |||||
* | |||||
* This program is distributed in the hope that it will be useful, | |||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
* GNU General Public License for more details. | |||||
* | |||||
* For a full copy of the GNU General Public License see the LICENSE file. | |||||
*/ | |||||
#ifndef DISTRHO_PLUGIN_INFO_H_INCLUDED | |||||
#define DISTRHO_PLUGIN_INFO_H_INCLUDED | |||||
#define DISTRHO_PLUGIN_NAME "Nekobi" | |||||
#define DISTRHO_PLUGIN_HAS_UI 1 | |||||
#define DISTRHO_PLUGIN_IS_SYNTH 1 | |||||
#define DISTRHO_PLUGIN_NUM_INPUTS 0 | |||||
#define DISTRHO_PLUGIN_NUM_OUTPUTS 1 | |||||
#define DISTRHO_PLUGIN_IS_RT_SAFE 1 | |||||
#define DISTRHO_PLUGIN_WANT_LATENCY 0 | |||||
#define DISTRHO_PLUGIN_WANT_PROGRAMS 0 | |||||
#define DISTRHO_PLUGIN_WANT_STATE 0 | |||||
#define DISTRHO_PLUGIN_WANT_TIMEPOS 0 | |||||
#define DISTRHO_PLUGIN_URI "http://distrho.sf.net/plugins/Nekobi" | |||||
#endif // DISTRHO_PLUGIN_INFO_H_INCLUDED |
@@ -0,0 +1,399 @@ | |||||
/* | |||||
* DISTRHO Nekobi Plugin, based on Nekobee by Sean Bolton and others. | |||||
* Copyright (C) 2004 Sean Bolton and others | |||||
* Copyright (C) 2013-2015 Filipe Coelho <falktx@falktx.com> | |||||
* | |||||
* This program is free software; you can redistribute it and/or | |||||
* modify it under the terms of the GNU General Public License as | |||||
* published by the Free Software Foundation; either version 2 of | |||||
* the License, or any later version. | |||||
* | |||||
* This program is distributed in the hope that it will be useful, | |||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
* GNU General Public License for more details. | |||||
* | |||||
* For a full copy of the GNU General Public License see the LICENSE file. | |||||
*/ | |||||
#include "DistrhoPluginNekobi.hpp" | |||||
extern "C" { | |||||
#include "nekobee-src/nekobee_synth.c" | |||||
#include "nekobee-src/nekobee_voice.c" | |||||
#include "nekobee-src/nekobee_voice_render.c" | |||||
#include "nekobee-src/minblep_tables.c" | |||||
// ----------------------------------------------------------------------- | |||||
// mutual exclusion | |||||
bool dssp_voicelist_mutex_trylock(nekobee_synth_t* const synth) | |||||
{ | |||||
/* Attempt the mutex lock */ | |||||
if (pthread_mutex_trylock(&synth->voicelist_mutex) != 0) | |||||
{ | |||||
synth->voicelist_mutex_grab_failed = 1; | |||||
return false; | |||||
} | |||||
/* Clean up if a previous mutex grab failed */ | |||||
if (synth->voicelist_mutex_grab_failed) | |||||
{ | |||||
nekobee_synth_all_voices_off(synth); | |||||
synth->voicelist_mutex_grab_failed = 0; | |||||
} | |||||
return true; | |||||
} | |||||
bool dssp_voicelist_mutex_unlock(nekobee_synth_t* const synth) | |||||
{ | |||||
return (pthread_mutex_unlock(&synth->voicelist_mutex) == 0); | |||||
} | |||||
// ----------------------------------------------------------------------- | |||||
// nekobee_handle_raw_event | |||||
void nekobee_handle_raw_event(nekobee_synth_t* const synth, const uint8_t size, const uint8_t* const data) | |||||
{ | |||||
if (size != 3) | |||||
return; | |||||
switch (data[0] & 0xf0) | |||||
{ | |||||
case 0x80: | |||||
nekobee_synth_note_off(synth, data[1], data[2]); | |||||
break; | |||||
case 0x90: | |||||
if (data[2] > 0) | |||||
nekobee_synth_note_on(synth, data[1], data[2]); | |||||
else | |||||
nekobee_synth_note_off(synth, data[1], 64); /* shouldn't happen, but... */ | |||||
break; | |||||
case 0xB0: | |||||
nekobee_synth_control_change(synth, data[1], data[2]); | |||||
break; | |||||
default: | |||||
break; | |||||
} | |||||
} | |||||
} /* extern "C" */ | |||||
START_NAMESPACE_DISTRHO | |||||
// ----------------------------------------------------------------------- | |||||
DistrhoPluginNekobi::DistrhoPluginNekobi() | |||||
: Plugin(paramCount, 0, 0) // 0 programs, 0 states | |||||
{ | |||||
nekobee_init_tables(); | |||||
// init synth | |||||
fSynth.sample_rate = getSampleRate(); | |||||
fSynth.deltat = 1.0f / (float)getSampleRate(); | |||||
fSynth.nugget_remains = 0; | |||||
fSynth.note_id = 0; | |||||
fSynth.polyphony = XSYNTH_DEFAULT_POLYPHONY; | |||||
fSynth.voices = XSYNTH_DEFAULT_POLYPHONY; | |||||
fSynth.monophonic = XSYNTH_MONO_MODE_ONCE; | |||||
fSynth.glide = 0; | |||||
fSynth.last_noteon_pitch = 0.0f; | |||||
fSynth.vcf_accent = 0.0f; | |||||
fSynth.vca_accent = 0.0f; | |||||
for (int i=0; i<8; ++i) | |||||
fSynth.held_keys[i] = -1; | |||||
fSynth.voice = nekobee_voice_new(); | |||||
fSynth.voicelist_mutex_grab_failed = 0; | |||||
pthread_mutex_init(&fSynth.voicelist_mutex, nullptr); | |||||
fSynth.channel_pressure = 0; | |||||
fSynth.pitch_wheel_sensitivity = 0; | |||||
fSynth.pitch_wheel = 0; | |||||
for (int i=0; i<128; ++i) | |||||
{ | |||||
fSynth.key_pressure[i] = 0; | |||||
fSynth.cc[i] = 0; | |||||
} | |||||
fSynth.cc[7] = 127; // full volume | |||||
fSynth.mod_wheel = 1.0f; | |||||
fSynth.pitch_bend = 1.0f; | |||||
fSynth.cc_volume = 1.0f; | |||||
// Default values | |||||
fParams.waveform = 0.0f; | |||||
fParams.tuning = 0.0f; | |||||
fParams.cutoff = 25.0f; | |||||
fParams.resonance = 25.0f; | |||||
fParams.envMod = 50.0f; | |||||
fParams.decay = 75.0f; | |||||
fParams.accent = 25.0f; | |||||
fParams.volume = 75.0f; | |||||
// Internal stuff | |||||
fSynth.waveform = 0.0f; | |||||
fSynth.tuning = 1.0f; | |||||
fSynth.cutoff = 5.0f; | |||||
fSynth.resonance = 0.8f; | |||||
fSynth.envmod = 0.3f; | |||||
fSynth.decay = 0.0002f; | |||||
fSynth.accent = 0.3f; | |||||
fSynth.volume = 0.75f; | |||||
// reset | |||||
deactivate(); | |||||
} | |||||
DistrhoPluginNekobi::~DistrhoPluginNekobi() | |||||
{ | |||||
std::free(fSynth.voice); | |||||
} | |||||
// ----------------------------------------------------------------------- | |||||
// Init | |||||
void DistrhoPluginNekobi::initParameter(uint32_t index, Parameter& parameter) | |||||
{ | |||||
switch (index) | |||||
{ | |||||
case paramWaveform: | |||||
parameter.hints = kParameterIsAutomable|kParameterIsBoolean; | |||||
parameter.name = "Waveform"; | |||||
parameter.symbol = "waveform"; | |||||
parameter.ranges.def = 0.0f; | |||||
parameter.ranges.min = 0.0f; | |||||
parameter.ranges.max = 1.0f; | |||||
break; | |||||
case paramTuning: | |||||
parameter.hints = kParameterIsAutomable; // was 0.5 <-> 2.0, log | |||||
parameter.name = "Tuning"; | |||||
parameter.symbol = "tuning"; | |||||
parameter.ranges.def = 0.0f; | |||||
parameter.ranges.min = -12.0f; | |||||
parameter.ranges.max = 12.0f; | |||||
break; | |||||
case paramCutoff: | |||||
parameter.hints = kParameterIsAutomable; // modified x2.5 | |||||
parameter.name = "Cutoff"; | |||||
parameter.symbol = "cutoff"; | |||||
parameter.unit = "%"; | |||||
parameter.ranges.def = 25.0f; | |||||
parameter.ranges.min = 0.0f; | |||||
parameter.ranges.max = 100.0f; | |||||
break; | |||||
case paramResonance: | |||||
parameter.hints = kParameterIsAutomable; // modified x100 | |||||
parameter.name = "VCF Resonance"; | |||||
parameter.symbol = "resonance"; | |||||
parameter.unit = "%"; | |||||
parameter.ranges.def = 25.0f; | |||||
parameter.ranges.min = 0.0f; | |||||
parameter.ranges.max = 95.0f; | |||||
break; | |||||
case paramEnvMod: | |||||
parameter.hints = kParameterIsAutomable; // modified x100 | |||||
parameter.name = "Env Mod"; | |||||
parameter.symbol = "env_mod"; | |||||
parameter.unit = "%"; | |||||
parameter.ranges.def = 50.0f; | |||||
parameter.ranges.min = 0.0f; | |||||
parameter.ranges.max = 100.0f; | |||||
break; | |||||
case paramDecay: | |||||
parameter.hints = kParameterIsAutomable; // was 0.000009 <-> 0.0005, log | |||||
parameter.name = "Decay"; | |||||
parameter.symbol = "decay"; | |||||
parameter.unit = "%"; | |||||
parameter.ranges.def = 75.0f; | |||||
parameter.ranges.min = 0.0f; | |||||
parameter.ranges.max = 100.0f; | |||||
break; | |||||
case paramAccent: | |||||
parameter.hints = kParameterIsAutomable; // modified x100 | |||||
parameter.name = "Accent"; | |||||
parameter.symbol = "accent"; | |||||
parameter.unit = "%"; | |||||
parameter.ranges.def = 25.0f; | |||||
parameter.ranges.min = 0.0f; | |||||
parameter.ranges.max = 100.0f; | |||||
break; | |||||
case paramVolume: | |||||
parameter.hints = kParameterIsAutomable; // modified x100 | |||||
parameter.name = "Volume"; | |||||
parameter.symbol = "volume"; | |||||
parameter.unit = "%"; | |||||
parameter.ranges.def = 75.0f; | |||||
parameter.ranges.min = 0.0f; | |||||
parameter.ranges.max = 100.0f; | |||||
break; | |||||
} | |||||
} | |||||
// ----------------------------------------------------------------------- | |||||
// Internal data | |||||
float DistrhoPluginNekobi::getParameterValue(uint32_t index) const | |||||
{ | |||||
switch (index) | |||||
{ | |||||
case paramWaveform: | |||||
return fParams.waveform; | |||||
case paramTuning: | |||||
return fParams.tuning; | |||||
case paramCutoff: | |||||
return fParams.cutoff; | |||||
case paramResonance: | |||||
return fParams.resonance; | |||||
case paramEnvMod: | |||||
return fParams.envMod; | |||||
case paramDecay: | |||||
return fParams.decay; | |||||
case paramAccent: | |||||
return fParams.accent; | |||||
case paramVolume: | |||||
return fParams.volume; | |||||
} | |||||
return 0.0f; | |||||
} | |||||
void DistrhoPluginNekobi::setParameterValue(uint32_t index, float value) | |||||
{ | |||||
switch (index) | |||||
{ | |||||
case paramWaveform: | |||||
fParams.waveform = value; | |||||
fSynth.waveform = value; | |||||
DISTRHO_SAFE_ASSERT(fSynth.waveform == 0.0f || fSynth.waveform == 1.0f); | |||||
break; | |||||
case paramTuning: | |||||
fParams.tuning = value; | |||||
fSynth.tuning = (value+12.0f)/24.0f * 1.5 + 0.5f; // FIXME: log? | |||||
DISTRHO_SAFE_ASSERT(fSynth.tuning >= 0.5f && fSynth.tuning <= 2.0f); | |||||
break; | |||||
case paramCutoff: | |||||
fParams.cutoff = value; | |||||
fSynth.cutoff = value/2.5f; | |||||
DISTRHO_SAFE_ASSERT(fSynth.cutoff >= 0.0f && fSynth.cutoff <= 40.0f); | |||||
break; | |||||
case paramResonance: | |||||
fParams.resonance = value; | |||||
fSynth.resonance = value/100.0f; | |||||
DISTRHO_SAFE_ASSERT(fSynth.resonance >= 0.0f && fSynth.resonance <= 0.95f); | |||||
break; | |||||
case paramEnvMod: | |||||
fParams.envMod = value; | |||||
fSynth.envmod = value/100.0f; | |||||
DISTRHO_SAFE_ASSERT(fSynth.envmod >= 0.0f && fSynth.envmod <= 1.0f); | |||||
break; | |||||
case paramDecay: | |||||
fParams.decay = value; | |||||
fSynth.decay = value/100.0f * 0.000491f + 0.000009f; // FIXME: log? | |||||
DISTRHO_SAFE_ASSERT(fSynth.decay >= 0.000009f && fSynth.decay <= 0.0005f); | |||||
break; | |||||
case paramAccent: | |||||
fParams.accent = value; | |||||
fSynth.accent = value/100.0f; | |||||
DISTRHO_SAFE_ASSERT(fSynth.accent >= 0.0f && fSynth.accent <= 1.0f); | |||||
break; | |||||
case paramVolume: | |||||
fParams.volume = value; | |||||
fSynth.volume = value/100.0f; | |||||
DISTRHO_SAFE_ASSERT(fSynth.volume >= 0.0f && fSynth.volume <= 1.0f); | |||||
break; | |||||
} | |||||
} | |||||
// ----------------------------------------------------------------------- | |||||
// Process | |||||
void DistrhoPluginNekobi::activate() | |||||
{ | |||||
fSynth.nugget_remains = 0; | |||||
fSynth.note_id = 0; | |||||
if (fSynth.voice != nullptr) | |||||
nekobee_synth_all_voices_off(&fSynth); | |||||
} | |||||
void DistrhoPluginNekobi::deactivate() | |||||
{ | |||||
if (fSynth.voice != nullptr) | |||||
nekobee_synth_all_voices_off(&fSynth); | |||||
} | |||||
void DistrhoPluginNekobi::run(const float**, float** outputs, uint32_t frames, const MidiEvent* midiEvents, uint32_t midiEventCount) | |||||
{ | |||||
uint32_t framesDone = 0; | |||||
uint32_t curEventIndex = 0; | |||||
uint32_t burstSize; | |||||
float* out = outputs[0]; | |||||
if (fSynth.voice == nullptr || ! dssp_voicelist_mutex_trylock(&fSynth)) | |||||
{ | |||||
std::memset(out, 0, sizeof(float)*frames); | |||||
return; | |||||
} | |||||
while (framesDone < frames) | |||||
{ | |||||
if (fSynth.nugget_remains == 0) | |||||
fSynth.nugget_remains = XSYNTH_NUGGET_SIZE; | |||||
/* process any ready events */ | |||||
while (curEventIndex < midiEventCount && framesDone == midiEvents[curEventIndex].frame) | |||||
{ | |||||
if (midiEvents[curEventIndex].size > MidiEvent::kDataSize) | |||||
continue; | |||||
nekobee_handle_raw_event(&fSynth, midiEvents[curEventIndex].size, midiEvents[curEventIndex].data); | |||||
curEventIndex++; | |||||
} | |||||
/* calculate the sample count (burstSize) for the next nekobee_voice_render() call to be the smallest of: | |||||
* - control calculation quantization size (XSYNTH_NUGGET_SIZE, in samples) | |||||
* - the number of samples remaining in an already-begun nugget (synth->nugget_remains) | |||||
* - the number of samples until the next event is ready | |||||
* - the number of samples left in this run | |||||
*/ | |||||
burstSize = XSYNTH_NUGGET_SIZE; | |||||
/* we're still in the middle of a nugget, so reduce the burst size | |||||
* to end when the nugget ends */ | |||||
if (fSynth.nugget_remains < burstSize) | |||||
burstSize = fSynth.nugget_remains; | |||||
/* reduce burst size to end when next event is ready */ | |||||
if (curEventIndex < midiEventCount && midiEvents[curEventIndex].frame - framesDone < burstSize) | |||||
burstSize = midiEvents[curEventIndex].frame - framesDone; | |||||
/* reduce burst size to end at end of this run */ | |||||
if (frames - framesDone < burstSize) | |||||
burstSize = frames - framesDone; | |||||
/* render the burst */ | |||||
nekobee_synth_render_voices(&fSynth, out + framesDone, burstSize, (burstSize == fSynth.nugget_remains)); | |||||
framesDone += burstSize; | |||||
fSynth.nugget_remains -= burstSize; | |||||
} | |||||
dssp_voicelist_mutex_unlock(&fSynth); | |||||
} | |||||
// ----------------------------------------------------------------------- | |||||
Plugin* createPlugin() | |||||
{ | |||||
return new DistrhoPluginNekobi(); | |||||
} | |||||
// ----------------------------------------------------------------------- | |||||
END_NAMESPACE_DISTRHO |
@@ -0,0 +1,121 @@ | |||||
/* | |||||
* DISTRHO Nekobi Plugin, based on Nekobee by Sean Bolton and others. | |||||
* Copyright (C) 2004 Sean Bolton and others | |||||
* Copyright (C) 2013-2015 Filipe Coelho <falktx@falktx.com> | |||||
* | |||||
* This program is free software; you can redistribute it and/or | |||||
* modify it under the terms of the GNU General Public License as | |||||
* published by the Free Software Foundation; either version 2 of | |||||
* the License, or any later version. | |||||
* | |||||
* This program is distributed in the hope that it will be useful, | |||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
* GNU General Public License for more details. | |||||
* | |||||
* For a full copy of the GNU General Public License see the LICENSE file. | |||||
*/ | |||||
#ifndef DISTRHO_PLUGIN_NEKOBI_HPP_INCLUDED | |||||
#define DISTRHO_PLUGIN_NEKOBI_HPP_INCLUDED | |||||
#include "DistrhoPlugin.hpp" | |||||
extern "C" { | |||||
#include "nekobee-src/nekobee_synth.h" | |||||
} | |||||
START_NAMESPACE_DISTRHO | |||||
// ----------------------------------------------------------------------- | |||||
class DistrhoPluginNekobi : public Plugin | |||||
{ | |||||
public: | |||||
enum Parameters | |||||
{ | |||||
paramWaveform = 0, | |||||
paramTuning, | |||||
paramCutoff, | |||||
paramResonance, | |||||
paramEnvMod, | |||||
paramDecay, | |||||
paramAccent, | |||||
paramVolume, | |||||
paramCount | |||||
}; | |||||
DistrhoPluginNekobi(); | |||||
~DistrhoPluginNekobi() override; | |||||
protected: | |||||
// ------------------------------------------------------------------- | |||||
// Information | |||||
const char* getLabel() const noexcept override | |||||
{ | |||||
return "Nekobi"; | |||||
} | |||||
const char* getMaker() const noexcept override | |||||
{ | |||||
return "Sean Bolton, falkTX"; | |||||
} | |||||
const char* getLicense() const noexcept override | |||||
{ | |||||
return "GPL v2+"; | |||||
} | |||||
uint32_t getVersion() const noexcept override | |||||
{ | |||||
return 0x1000; | |||||
} | |||||
int64_t getUniqueId() const noexcept override | |||||
{ | |||||
return d_cconst('D', 'N', 'e', 'k'); | |||||
} | |||||
// ------------------------------------------------------------------- | |||||
// Init | |||||
void initParameter(uint32_t index, Parameter& parameter) override; | |||||
// ------------------------------------------------------------------- | |||||
// Internal data | |||||
float getParameterValue(uint32_t index) const override; | |||||
void setParameterValue(uint32_t index, float value) override; | |||||
// ------------------------------------------------------------------- | |||||
// Process | |||||
void activate() override; | |||||
void deactivate() override; | |||||
void run(const float**, float** outputs, uint32_t frames, const MidiEvent* midiEvents, uint32_t midiEventCount) override; | |||||
// ------------------------------------------------------------------- | |||||
private: | |||||
struct ParamValues { | |||||
float waveform; | |||||
float tuning; | |||||
float cutoff; | |||||
float resonance; | |||||
float envMod; | |||||
float decay; | |||||
float accent; | |||||
float volume; | |||||
} fParams; | |||||
nekobee_synth_t fSynth; | |||||
DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(DistrhoPluginNekobi) | |||||
}; | |||||
// ----------------------------------------------------------------------- | |||||
END_NAMESPACE_DISTRHO | |||||
#endif // DISTRHO_PLUGIN_NEKOBI_HPP_INCLUDED |
@@ -0,0 +1,231 @@ | |||||
/* | |||||
* DISTRHO Nekobi Plugin, based on Nekobee by Sean Bolton and others. | |||||
* Copyright (C) 2013-2015 Filipe Coelho <falktx@falktx.com> | |||||
* | |||||
* This program is free software; you can redistribute it and/or | |||||
* modify it under the terms of the GNU General Public License as | |||||
* published by the Free Software Foundation; either version 2 of | |||||
* the License, or any later version. | |||||
* | |||||
* This program is distributed in the hope that it will be useful, | |||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
* GNU General Public License for more details. | |||||
* | |||||
* For a full copy of the GNU General Public License see the LICENSE file. | |||||
*/ | |||||
#include "DistrhoPluginNekobi.hpp" | |||||
#include "DistrhoUINekobi.hpp" | |||||
START_NAMESPACE_DISTRHO | |||||
namespace Art = DistrhoArtworkNekobi; | |||||
// ----------------------------------------------------------------------- | |||||
DistrhoUINekobi::DistrhoUINekobi() | |||||
: UI(Art::backgroundWidth, Art::backgroundHeight), | |||||
fImgBackground(Art::backgroundData, Art::backgroundWidth, Art::backgroundHeight, GL_BGR), | |||||
fAboutWindow(this) | |||||
{ | |||||
// FIXME | |||||
fNeko.setTimerSpeed(5); | |||||
// about | |||||
Image aboutImage(Art::aboutData, Art::aboutWidth, Art::aboutHeight, GL_BGR); | |||||
fAboutWindow.setImage(aboutImage); | |||||
// slider | |||||
Image sliderImage(Art::sliderData, Art::sliderWidth, Art::sliderHeight); | |||||
fSliderWaveform = new ImageSlider(this, sliderImage); | |||||
fSliderWaveform->setId(DistrhoPluginNekobi::paramWaveform); | |||||
fSliderWaveform->setStartPos(133, 40); | |||||
fSliderWaveform->setEndPos(133, 60); | |||||
fSliderWaveform->setRange(0.0f, 1.0f); | |||||
fSliderWaveform->setStep(1.0f); | |||||
fSliderWaveform->setValue(0.0f); | |||||
fSliderWaveform->setCallback(this); | |||||
// knobs | |||||
Image knobImage(Art::knobData, Art::knobWidth, Art::knobHeight); | |||||
// knob Tuning | |||||
fKnobTuning = new ImageKnob(this, knobImage, ImageKnob::Vertical); | |||||
fKnobTuning->setId(DistrhoPluginNekobi::paramTuning); | |||||
fKnobTuning->setAbsolutePos(41, 43); | |||||
fKnobTuning->setRange(-12.0f, 12.0f); | |||||
fKnobTuning->setDefault(0.0f); | |||||
fKnobTuning->setValue(0.0f); | |||||
fKnobTuning->setRotationAngle(305); | |||||
fKnobTuning->setCallback(this); | |||||
// knob Cutoff | |||||
fKnobCutoff = new ImageKnob(this, knobImage, ImageKnob::Vertical); | |||||
fKnobCutoff->setId(DistrhoPluginNekobi::paramCutoff); | |||||
fKnobCutoff->setAbsolutePos(185, 43); | |||||
fKnobCutoff->setRange(0.0f, 100.0f); | |||||
fKnobCutoff->setDefault(25.0f); | |||||
fKnobCutoff->setValue(25.0f); | |||||
fKnobCutoff->setRotationAngle(305); | |||||
fKnobCutoff->setCallback(this); | |||||
// knob Resonance | |||||
fKnobResonance = new ImageKnob(this, knobImage, ImageKnob::Vertical); | |||||
fKnobResonance->setId(DistrhoPluginNekobi::paramResonance); | |||||
fKnobResonance->setAbsolutePos(257, 43); | |||||
fKnobResonance->setRange(0.0f, 95.0f); | |||||
fKnobResonance->setDefault(25.0f); | |||||
fKnobResonance->setValue(25.0f); | |||||
fKnobResonance->setRotationAngle(305); | |||||
fKnobResonance->setCallback(this); | |||||
// knob Env Mod | |||||
fKnobEnvMod = new ImageKnob(this, knobImage, ImageKnob::Vertical); | |||||
fKnobEnvMod->setId(DistrhoPluginNekobi::paramEnvMod); | |||||
fKnobEnvMod->setAbsolutePos(329, 43); | |||||
fKnobEnvMod->setRange(0.0f, 100.0f); | |||||
fKnobEnvMod->setDefault(50.0f); | |||||
fKnobEnvMod->setValue(50.0f); | |||||
fKnobEnvMod->setRotationAngle(305); | |||||
fKnobEnvMod->setCallback(this); | |||||
// knob Decay | |||||
fKnobDecay = new ImageKnob(this, knobImage, ImageKnob::Vertical); | |||||
fKnobDecay->setId(DistrhoPluginNekobi::paramDecay); | |||||
fKnobDecay->setAbsolutePos(400, 43); | |||||
fKnobDecay->setRange(0.0f, 100.0f); | |||||
fKnobDecay->setDefault(75.0f); | |||||
fKnobDecay->setValue(75.0f); | |||||
fKnobDecay->setRotationAngle(305); | |||||
fKnobDecay->setCallback(this); | |||||
// knob Accent | |||||
fKnobAccent = new ImageKnob(this, knobImage, ImageKnob::Vertical); | |||||
fKnobAccent->setId(DistrhoPluginNekobi::paramAccent); | |||||
fKnobAccent->setAbsolutePos(473, 43); | |||||
fKnobAccent->setRange(0.0f, 100.0f); | |||||
fKnobAccent->setDefault(25.0f); | |||||
fKnobAccent->setValue(25.0f); | |||||
fKnobAccent->setRotationAngle(305); | |||||
fKnobAccent->setCallback(this); | |||||
// knob Volume | |||||
fKnobVolume = new ImageKnob(this, knobImage, ImageKnob::Vertical); | |||||
fKnobVolume->setId(DistrhoPluginNekobi::paramVolume); | |||||
fKnobVolume->setAbsolutePos(545, 43); | |||||
fKnobVolume->setRange(0.0f, 100.0f); | |||||
fKnobVolume->setDefault(75.0f); | |||||
fKnobVolume->setValue(75.0f); | |||||
fKnobVolume->setRotationAngle(305); | |||||
fKnobVolume->setCallback(this); | |||||
// about button | |||||
Image aboutImageNormal(Art::aboutButtonNormalData, Art::aboutButtonNormalWidth, Art::aboutButtonNormalHeight); | |||||
Image aboutImageHover(Art::aboutButtonHoverData, Art::aboutButtonHoverWidth, Art::aboutButtonHoverHeight); | |||||
fButtonAbout = new ImageButton(this, aboutImageNormal, aboutImageHover, aboutImageHover); | |||||
fButtonAbout->setAbsolutePos(505, 5); | |||||
fButtonAbout->setCallback(this); | |||||
} | |||||
// ----------------------------------------------------------------------- | |||||
// DSP Callbacks | |||||
void DistrhoUINekobi::parameterChanged(uint32_t index, float value) | |||||
{ | |||||
switch (index) | |||||
{ | |||||
case DistrhoPluginNekobi::paramTuning: | |||||
fKnobTuning->setValue(value); | |||||
break; | |||||
case DistrhoPluginNekobi::paramWaveform: | |||||
fSliderWaveform->setValue(value); | |||||
break; | |||||
case DistrhoPluginNekobi::paramCutoff: | |||||
fKnobCutoff->setValue(value); | |||||
break; | |||||
case DistrhoPluginNekobi::paramResonance: | |||||
fKnobResonance->setValue(value); | |||||
break; | |||||
case DistrhoPluginNekobi::paramEnvMod: | |||||
fKnobEnvMod->setValue(value); | |||||
break; | |||||
case DistrhoPluginNekobi::paramDecay: | |||||
fKnobDecay->setValue(value); | |||||
break; | |||||
case DistrhoPluginNekobi::paramAccent: | |||||
fKnobAccent->setValue(value); | |||||
break; | |||||
case DistrhoPluginNekobi::paramVolume: | |||||
fKnobVolume->setValue(value); | |||||
break; | |||||
} | |||||
} | |||||
// ----------------------------------------------------------------------- | |||||
// UI Callbacks | |||||
void DistrhoUINekobi::uiIdle() | |||||
{ | |||||
if (fNeko.idle()) | |||||
repaint(); | |||||
} | |||||
// ----------------------------------------------------------------------- | |||||
// Widget Callbacks | |||||
void DistrhoUINekobi::imageButtonClicked(ImageButton* button, int) | |||||
{ | |||||
if (button != fButtonAbout) | |||||
return; | |||||
fAboutWindow.exec(); | |||||
} | |||||
void DistrhoUINekobi::imageKnobDragStarted(ImageKnob* knob) | |||||
{ | |||||
editParameter(knob->getId(), true); | |||||
} | |||||
void DistrhoUINekobi::imageKnobDragFinished(ImageKnob* knob) | |||||
{ | |||||
editParameter(knob->getId(), false); | |||||
} | |||||
void DistrhoUINekobi::imageKnobValueChanged(ImageKnob* knob, float value) | |||||
{ | |||||
setParameterValue(knob->getId(), value); | |||||
} | |||||
void DistrhoUINekobi::imageSliderDragStarted(ImageSlider* slider) | |||||
{ | |||||
editParameter(slider->getId(), true); | |||||
} | |||||
void DistrhoUINekobi::imageSliderDragFinished(ImageSlider* slider) | |||||
{ | |||||
editParameter(slider->getId(), false); | |||||
} | |||||
void DistrhoUINekobi::imageSliderValueChanged(ImageSlider* slider, float value) | |||||
{ | |||||
setParameterValue(slider->getId(), value); | |||||
} | |||||
void DistrhoUINekobi::onDisplay() | |||||
{ | |||||
fImgBackground.draw(); | |||||
fNeko.draw(); | |||||
} | |||||
// ----------------------------------------------------------------------- | |||||
UI* createUI() | |||||
{ | |||||
return new DistrhoUINekobi(); | |||||
} | |||||
// ----------------------------------------------------------------------- | |||||
END_NAMESPACE_DISTRHO |
@@ -0,0 +1,89 @@ | |||||
/* | |||||
* DISTRHO Nekobi Plugin, based on Nekobee by Sean Bolton and others. | |||||
* Copyright (C) 2013-2015 Filipe Coelho <falktx@falktx.com> | |||||
* | |||||
* This program is free software; you can redistribute it and/or | |||||
* modify it under the terms of the GNU General Public License as | |||||
* published by the Free Software Foundation; either version 2 of | |||||
* the License, or any later version. | |||||
* | |||||
* This program is distributed in the hope that it will be useful, | |||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
* GNU General Public License for more details. | |||||
* | |||||
* For a full copy of the GNU General Public License see the LICENSE file. | |||||
*/ | |||||
#ifndef DISTRHO_UI_NEKOBI_HPP_INCLUDED | |||||
#define DISTRHO_UI_NEKOBI_HPP_INCLUDED | |||||
#include "DistrhoUI.hpp" | |||||
#include "ImageAboutWindow.hpp" | |||||
#include "ImageButton.hpp" | |||||
#include "ImageKnob.hpp" | |||||
#include "ImageSlider.hpp" | |||||
#include "DistrhoArtworkNekobi.hpp" | |||||
#include "NekoWidget.hpp" | |||||
using DGL::ImageAboutWindow; | |||||
using DGL::ImageButton; | |||||
using DGL::ImageKnob; | |||||
using DGL::ImageSlider; | |||||
START_NAMESPACE_DISTRHO | |||||
// ----------------------------------------------------------------------- | |||||
class DistrhoUINekobi : public UI, | |||||
public ImageButton::Callback, | |||||
public ImageKnob::Callback, | |||||
public ImageSlider::Callback | |||||
{ | |||||
public: | |||||
DistrhoUINekobi(); | |||||
protected: | |||||
// ------------------------------------------------------------------- | |||||
// DSP Callbacks | |||||
void parameterChanged(uint32_t index, float value) override; | |||||
// ------------------------------------------------------------------- | |||||
// UI Callbacks | |||||
void uiIdle() override; | |||||
// ------------------------------------------------------------------- | |||||
// Widget Callbacks | |||||
void imageButtonClicked(ImageButton* button, int) override; | |||||
void imageKnobDragStarted(ImageKnob* knob) override; | |||||
void imageKnobDragFinished(ImageKnob* knob) override; | |||||
void imageKnobValueChanged(ImageKnob* knob, float value) override; | |||||
void imageSliderDragStarted(ImageSlider* slider) override; | |||||
void imageSliderDragFinished(ImageSlider* slider) override; | |||||
void imageSliderValueChanged(ImageSlider* slider, float value) override; | |||||
void onDisplay() override; | |||||
private: | |||||
Image fImgBackground; | |||||
ImageAboutWindow fAboutWindow; | |||||
NekoWidget fNeko; | |||||
ScopedPointer<ImageButton> fButtonAbout; | |||||
ScopedPointer<ImageSlider> fSliderWaveform; | |||||
ScopedPointer<ImageKnob> fKnobTuning, fKnobCutoff, fKnobResonance; | |||||
ScopedPointer<ImageKnob> fKnobEnvMod, fKnobDecay, fKnobAccent, fKnobVolume; | |||||
DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(DistrhoUINekobi) | |||||
}; | |||||
// ----------------------------------------------------------------------- | |||||
END_NAMESPACE_DISTRHO | |||||
#endif // DISTRHO_UI_NEKOBI_HPP_INCLUDED |