@@ -0,0 +1,19 @@ | |||
*.a | |||
*.o | |||
*.exe | |||
*.dll | |||
*.dylib | |||
*.so | |||
.kdev_include_paths | |||
.kdev4/ | |||
bin/*-dssi/ | |||
bin/*.lv2/ | |||
bin/PowerJuice | |||
bin/PowerJuiceX2 | |||
bin/StutterJuice | |||
bin/TriggerJuice | |||
bin/VectorJuice | |||
bin/WobbleJuice |
@@ -0,0 +1,280 @@ | |||
GNU GENERAL PUBLIC LICENSE | |||
Version 2, June 1991 | |||
Copyright (C) 1989, 1991 Free Software Foundation, Inc., | |||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |||
Everyone is permitted to copy and distribute verbatim copies | |||
of this license document, but changing it is not allowed. | |||
Preamble | |||
The licenses for most software are designed to take away your | |||
freedom to share and change it. By contrast, the GNU General Public | |||
License is intended to guarantee your freedom to share and change free | |||
software--to make sure the software is free for all its users. This | |||
General Public License applies to most of the Free Software | |||
Foundation's software and to any other program whose authors commit to | |||
using it. (Some other Free Software Foundation software is covered by | |||
the GNU Lesser General Public License instead.) You can apply it to | |||
your programs, too. | |||
When we speak of free software, we are referring to freedom, not | |||
price. Our General Public Licenses are designed to make sure that you | |||
have the freedom to distribute copies of free software (and charge for | |||
this service if you wish), that you receive source code or can get it | |||
if you want it, that you can change the software or use pieces of it | |||
in new free programs; and that you know you can do these things. | |||
To protect your rights, we need to make restrictions that forbid | |||
anyone to deny you these rights or to ask you to surrender the rights. | |||
These restrictions translate to certain responsibilities for you if you | |||
distribute copies of the software, or if you modify it. | |||
For example, if you distribute copies of such a program, whether | |||
gratis or for a fee, you must give the recipients all the rights that | |||
you have. You must make sure that they, too, receive or can get the | |||
source code. And you must show them these terms so they know their | |||
rights. | |||
We protect your rights with two steps: (1) copyright the software, and | |||
(2) offer you this license which gives you legal permission to copy, | |||
distribute and/or modify the software. | |||
Also, for each author's protection and ours, we want to make certain | |||
that everyone understands that there is no warranty for this free | |||
software. If the software is modified by someone else and passed on, we | |||
want its recipients to know that what they have is not the original, so | |||
that any problems introduced by others will not reflect on the original | |||
authors' reputations. | |||
Finally, any free program is threatened constantly by software | |||
patents. We wish to avoid the danger that redistributors of a free | |||
program will individually obtain patent licenses, in effect making the | |||
program proprietary. To prevent this, we have made it clear that any | |||
patent must be licensed for everyone's free use or not licensed at all. | |||
The precise terms and conditions for copying, distribution and | |||
modification follow. | |||
GNU GENERAL PUBLIC LICENSE | |||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION | |||
0. This License applies to any program or other work which contains | |||
a notice placed by the copyright holder saying it may be distributed | |||
under the terms of this General Public License. The "Program", below, | |||
refers to any such program or work, and a "work based on the Program" | |||
means either the Program or any derivative work under copyright law: | |||
that is to say, a work containing the Program or a portion of it, | |||
either verbatim or with modifications and/or translated into another | |||
language. (Hereinafter, translation is included without limitation in | |||
the term "modification".) Each licensee is addressed as "you". | |||
Activities other than copying, distribution and modification are not | |||
covered by this License; they are outside its scope. The act of | |||
running the Program is not restricted, and the output from the Program | |||
is covered only if its contents constitute a work based on the | |||
Program (independent of having been made by running the Program). | |||
Whether that is true depends on what the Program does. | |||
1. You may copy and distribute verbatim copies of the Program's | |||
source code as you receive it, in any medium, provided that you | |||
conspicuously and appropriately publish on each copy an appropriate | |||
copyright notice and disclaimer of warranty; keep intact all the | |||
notices that refer to this License and to the absence of any warranty; | |||
and give any other recipients of the Program a copy of this License | |||
along with the Program. | |||
You may charge a fee for the physical act of transferring a copy, and | |||
you may at your option offer warranty protection in exchange for a fee. | |||
2. You may modify your copy or copies of the Program or any portion | |||
of it, thus forming a work based on the Program, and copy and | |||
distribute such modifications or work under the terms of Section 1 | |||
above, provided that you also meet all of these conditions: | |||
a) You must cause the modified files to carry prominent notices | |||
stating that you changed the files and the date of any change. | |||
b) You must cause any work that you distribute or publish, that in | |||
whole or in part contains or is derived from the Program or any | |||
part thereof, to be licensed as a whole at no charge to all third | |||
parties under the terms of this License. | |||
c) If the modified program normally reads commands interactively | |||
when run, you must cause it, when started running for such | |||
interactive use in the most ordinary way, to print or display an | |||
announcement including an appropriate copyright notice and a | |||
notice that there is no warranty (or else, saying that you provide | |||
a warranty) and that users may redistribute the program under | |||
these conditions, and telling the user how to view a copy of this | |||
License. (Exception: if the Program itself is interactive but | |||
does not normally print such an announcement, your work based on | |||
the Program is not required to print an announcement.) | |||
These requirements apply to the modified work as a whole. If | |||
identifiable sections of that work are not derived from the Program, | |||
and can be reasonably considered independent and separate works in | |||
themselves, then this License, and its terms, do not apply to those | |||
sections when you distribute them as separate works. But when you | |||
distribute the same sections as part of a whole which is a work based | |||
on the Program, the distribution of the whole must be on the terms of | |||
this License, whose permissions for other licensees extend to the | |||
entire whole, and thus to each and every part regardless of who wrote it. | |||
Thus, it is not the intent of this section to claim rights or contest | |||
your rights to work written entirely by you; rather, the intent is to | |||
exercise the right to control the distribution of derivative or | |||
collective works based on the Program. | |||
In addition, mere aggregation of another work not based on the Program | |||
with the Program (or with a work based on the Program) on a volume of | |||
a storage or distribution medium does not bring the other work under | |||
the scope of this License. | |||
3. You may copy and distribute the Program (or a work based on it, | |||
under Section 2) in object code or executable form under the terms of | |||
Sections 1 and 2 above provided that you also do one of the following: | |||
a) Accompany it with the complete corresponding machine-readable | |||
source code, which must be distributed under the terms of Sections | |||
1 and 2 above on a medium customarily used for software interchange; or, | |||
b) Accompany it with a written offer, valid for at least three | |||
years, to give any third party, for a charge no more than your | |||
cost of physically performing source distribution, a complete | |||
machine-readable copy of the corresponding source code, to be | |||
distributed under the terms of Sections 1 and 2 above on a medium | |||
customarily used for software interchange; or, | |||
c) Accompany it with the information you received as to the offer | |||
to distribute corresponding source code. (This alternative is | |||
allowed only for noncommercial distribution and only if you | |||
received the program in object code or executable form with such | |||
an offer, in accord with Subsection b above.) | |||
The source code for a work means the preferred form of the work for | |||
making modifications to it. For an executable work, complete source | |||
code means all the source code for all modules it contains, plus any | |||
associated interface definition files, plus the scripts used to | |||
control compilation and installation of the executable. However, as a | |||
special exception, the source code distributed need not include | |||
anything that is normally distributed (in either source or binary | |||
form) with the major components (compiler, kernel, and so on) of the | |||
operating system on which the executable runs, unless that component | |||
itself accompanies the executable. | |||
If distribution of executable or object code is made by offering | |||
access to copy from a designated place, then offering equivalent | |||
access to copy the source code from the same place counts as | |||
distribution of the source code, even though third parties are not | |||
compelled to copy the source along with the object code. | |||
4. You may not copy, modify, sublicense, or distribute the Program | |||
except as expressly provided under this License. Any attempt | |||
otherwise to copy, modify, sublicense or distribute the Program is | |||
void, and will automatically terminate your rights under this License. | |||
However, parties who have received copies, or rights, from you under | |||
this License will not have their licenses terminated so long as such | |||
parties remain in full compliance. | |||
5. You are not required to accept this License, since you have not | |||
signed it. However, nothing else grants you permission to modify or | |||
distribute the Program or its derivative works. These actions are | |||
prohibited by law if you do not accept this License. Therefore, by | |||
modifying or distributing the Program (or any work based on the | |||
Program), you indicate your acceptance of this License to do so, and | |||
all its terms and conditions for copying, distributing or modifying | |||
the Program or works based on it. | |||
6. Each time you redistribute the Program (or any work based on the | |||
Program), the recipient automatically receives a license from the | |||
original licensor to copy, distribute or modify the Program subject to | |||
these terms and conditions. You may not impose any further | |||
restrictions on the recipients' exercise of the rights granted herein. | |||
You are not responsible for enforcing compliance by third parties to | |||
this License. | |||
7. If, as a consequence of a court judgment or allegation of patent | |||
infringement or for any other reason (not limited to patent issues), | |||
conditions are imposed on you (whether by court order, agreement or | |||
otherwise) that contradict the conditions of this License, they do not | |||
excuse you from the conditions of this License. If you cannot | |||
distribute so as to satisfy simultaneously your obligations under this | |||
License and any other pertinent obligations, then as a consequence you | |||
may not distribute the Program at all. For example, if a patent | |||
license would not permit royalty-free redistribution of the Program by | |||
all those who receive copies directly or indirectly through you, then | |||
the only way you could satisfy both it and this License would be to | |||
refrain entirely from distribution of the Program. | |||
If any portion of this section is held invalid or unenforceable under | |||
any particular circumstance, the balance of the section is intended to | |||
apply and the section as a whole is intended to apply in other | |||
circumstances. | |||
It is not the purpose of this section to induce you to infringe any | |||
patents or other property right claims or to contest validity of any | |||
such claims; this section has the sole purpose of protecting the | |||
integrity of the free software distribution system, which is | |||
implemented by public license practices. Many people have made | |||
generous contributions to the wide range of software distributed | |||
through that system in reliance on consistent application of that | |||
system; it is up to the author/donor to decide if he or she is willing | |||
to distribute software through any other system and a licensee cannot | |||
impose that choice. | |||
This section is intended to make thoroughly clear what is believed to | |||
be a consequence of the rest of this License. | |||
8. If the distribution and/or use of the Program is restricted in | |||
certain countries either by patents or by copyrighted interfaces, the | |||
original copyright holder who places the Program under this License | |||
may add an explicit geographical distribution limitation excluding | |||
those countries, so that distribution is permitted only in or among | |||
countries not thus excluded. In such case, this License incorporates | |||
the limitation as if written in the body of this License. | |||
9. The Free Software Foundation may publish revised and/or new versions | |||
of the General Public License from time to time. Such new versions will | |||
be similar in spirit to the present version, but may differ in detail to | |||
address new problems or concerns. | |||
Each version is given a distinguishing version number. If the Program | |||
specifies a version number of this License which applies to it and "any | |||
later version", you have the option of following the terms and conditions | |||
either of that version or of any later version published by the Free | |||
Software Foundation. If the Program does not specify a version number of | |||
this License, you may choose any version ever published by the Free Software | |||
Foundation. | |||
10. If you wish to incorporate parts of the Program into other free | |||
programs whose distribution conditions are different, write to the author | |||
to ask for permission. For software which is copyrighted by the Free | |||
Software Foundation, write to the Free Software Foundation; we sometimes | |||
make exceptions for this. Our decision will be guided by the two goals | |||
of preserving the free status of all derivatives of our free software and | |||
of promoting the sharing and reuse of software generally. | |||
NO WARRANTY | |||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY | |||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN | |||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES | |||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED | |||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | |||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS | |||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE | |||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, | |||
REPAIR OR CORRECTION. | |||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING | |||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR | |||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, | |||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING | |||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED | |||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY | |||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER | |||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE | |||
POSSIBILITY OF SUCH DAMAGES. | |||
END OF TERMS AND CONDITIONS |
@@ -0,0 +1,42 @@ | |||
#!/usr/bin/make -f | |||
# Makefile for DISTRHO Plugins # | |||
# ---------------------------- # | |||
# Created by falkTX | |||
# | |||
all: libs plugins gen | |||
# -------------------------------------------------------------- | |||
libs: | |||
$(MAKE) -C dpf/dgl | |||
plugins: libs | |||
$(MAKE) all -C plugins/PowerJuice | |||
$(MAKE) all -C plugins/PowerJuiceX2 | |||
$(MAKE) all -C plugins/StutterJuice | |||
$(MAKE) all -C plugins/TriggerJuice | |||
$(MAKE) all -C plugins/VectorJuice | |||
$(MAKE) all -C plugins/WobbleJuice | |||
gen: plugins dpf/utils/lv2_ttl_generator | |||
@$(CURDIR)/dpf/utils/generate-ttl.sh | |||
dpf/utils/lv2_ttl_generator: | |||
$(MAKE) -C dpf/utils/lv2-ttl-generator | |||
# -------------------------------------------------------------- | |||
clean: | |||
$(MAKE) clean -C dpf/dgl | |||
$(MAKE) clean -C dpf/utils/lv2-ttl-generator | |||
$(MAKE) clean -C plugins/PowerJuice | |||
$(MAKE) clean -C plugins/PowerJuiceX2 | |||
$(MAKE) clean -C plugins/StutterJuice | |||
$(MAKE) clean -C plugins/TriggerJuice | |||
$(MAKE) clean -C plugins/VectorJuice | |||
$(MAKE) clean -C plugins/WobbleJuice | |||
# -------------------------------------------------------------- | |||
.PHONY: plugins |
@@ -0,0 +1,134 @@ | |||
#!/usr/bin/make -f | |||
# Makefile for DISTRHO Plugins # | |||
# ---------------------------- # | |||
# Created by falkTX | |||
# | |||
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 | |||
# -------------------------------------------------------------- | |||
# Common build and link flags | |||
BASE_FLAGS = -Wall -Wextra -pipe | |||
BASE_OPTS = -O2 -ffast-math -fdata-sections -ffunction-sections | |||
ifneq ($(NOOPT),true) | |||
BASE_OPTS += -mtune=generic -msse -msse2 -mfpmath=sse | |||
endif | |||
LINK_OPTS = -fdata-sections -ffunction-sections -Wl,-O1 -Wl,--as-needed -Wl,--gc-sections -Wl,--strip-all | |||
ifeq ($(MACOS),true) | |||
# MacOS linker flags | |||
LINK_OPTS = -fdata-sections -ffunction-sections -Wl,-dead_strip -Wl,-dead_strip_dylibs | |||
endif | |||
ifeq ($(RASPPI),true) | |||
# Raspberry-Pi flags | |||
BASE_OPTS = -O2 -ffast-math | |||
ifneq ($(NOOPT),true) | |||
BASE_OPTS += -march=armv6 -mfpu=vfp -mfloat-abi=hard | |||
endif | |||
LINK_OPTS = -Wl,-O1 -Wl,--as-needed -Wl,--strip-all | |||
endif | |||
ifeq ($(PANDORA),true) | |||
# OpenPandora flags | |||
BASE_OPTS = -O2 -ffast-math | |||
ifneq ($(NOOPT),true) | |||
BASE_OPTS += -march=armv7-a -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp | |||
endif | |||
LINK_OPTS = -Wl,-O1 -Wl,--as-needed -Wl,--strip-all | |||
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 required libs | |||
ifeq ($(LINUX),true) | |||
ifneq ($(shell pkg-config --exists jack && echo true),true) | |||
$(error JACK missing, cannot continue) | |||
endif | |||
ifneq ($(shell pkg-config --exists gl && echo true),true) | |||
$(error OpenGL missing, cannot continue) | |||
endif | |||
ifneq ($(shell pkg-config --exists x11 && echo true),true) | |||
$(error X11 missing, cannot continue) | |||
endif | |||
endif | |||
ifneq ($(shell pkg-config --exists liblo && echo true),true) | |||
$(error liblo missing, cannot continue) | |||
endif | |||
# -------------------------------------------------------------- | |||
# Set libs stuff | |||
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 | |||
# -------------------------------------------------------------- | |||
# Set extension | |||
EXT = so | |||
ifeq ($(MACOS),true) | |||
EXT = dylib | |||
endif | |||
ifeq ($(WIN32),true) | |||
EXT = dll | |||
endif | |||
# -------------------------------------------------------------- | |||
# Set shared library CLI arg | |||
SHARED = -shared | |||
ifeq ($(MACOS),true) | |||
SHARED = -dynamiclib | |||
endif | |||
# -------------------------------------------------------------- |
@@ -0,0 +1,3 @@ | |||
# DISTRHO Juice Plugins | |||
TODO... |
@@ -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,130 @@ | |||
#!/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 | |||
# -------------------------------------------------------------- | |||
# Set plugin binary file targets | |||
jack = $(TARGET_DIR)/$(NAME) | |||
ladspa_dsp = $(TARGET_DIR)/$(NAME)-ladspa.$(EXT) | |||
dssi_dsp = $(TARGET_DIR)/$(NAME)-dssi.$(EXT) | |||
dssi_ui = $(TARGET_DIR)/$(NAME)-dssi/$(NAME)_ui | |||
lv2 = $(TARGET_DIR)/$(NAME).lv2/$(NAME).$(EXT) | |||
lv2_dsp = $(TARGET_DIR)/$(NAME).lv2/$(NAME)_dsp.$(EXT) | |||
lv2_ui = $(TARGET_DIR)/$(NAME).lv2/$(NAME)_ui.$(EXT) | |||
vst = $(TARGET_DIR)/$(NAME)-vst.$(EXT) | |||
ifeq ($(WIN32),true) | |||
dssi_ui += .exe | |||
endif | |||
# TODO: MacOS VST bundle | |||
# -------------------------------------------------------------- | |||
# Set distrho code files | |||
DISTRHO_PLUGIN_FILES = ../../dpf/distrho/DistrhoPluginMain.cpp | |||
DISTRHO_UI_FILES = ../../dpf/distrho/DistrhoUIMain.cpp ../../dpf/libdgl.a | |||
# -------------------------------------------------------------- | |||
# Handle plugins without UI | |||
ifeq ($(TARGET_NOUI),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) -c -o $@ | |||
%.cpp.o: %.cpp | |||
$(CXX) $< $(BUILD_CXX_FLAGS) -c -o $@ | |||
clean: | |||
rm -f *.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): $(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_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 $@ | |||
# -------------------------------------------------------------- |
@@ -0,0 +1,39 @@ | |||
/* | |||
* Power Juice Plugin | |||
* Copyright (C) 2014 Andre Sklenar <andre.sklenar@gmail.com>, www.juicelab.cz | |||
* | |||
* 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 doc/GPL.txt file. | |||
*/ | |||
#ifndef DISTRHO_PLUGIN_INFO_H_INCLUDED | |||
#define DISTRHO_PLUGIN_INFO_H_INCLUDED | |||
#define DISTRHO_PLUGIN_NAME "PowerJuice" | |||
#define DISTRHO_PLUGIN_HAS_UI 1 | |||
#define DISTRHO_PLUGIN_IS_SYNTH 0 | |||
#define DISTRHO_PLUGIN_NUM_INPUTS 1 | |||
#define DISTRHO_PLUGIN_NUM_OUTPUTS 1 | |||
#define DISTRHO_PLUGIN_WANT_LATENCY 0 | |||
#define DISTRHO_PLUGIN_WANT_PROGRAMS 1 | |||
#define DISTRHO_PLUGIN_WANT_STATE 0 | |||
#define DISTRHO_PLUGIN_WANT_TIMEPOS 0 | |||
// needed for spectrum | |||
#define DISTRHO_PLUGIN_WANT_DIRECT_ACCESS 1 | |||
#define DISTRHO_PLUGIN_URI "urn:distrho:PowerJuice" | |||
#endif // DISTRHO_PLUGIN_INFO_H_INCLUDED |
@@ -0,0 +1,36 @@ | |||
#!/usr/bin/make -f | |||
# Makefile for DISTRHO Plugins # | |||
# ---------------------------- # | |||
# Created by falkTX | |||
# | |||
# -------------------------------------------------------------- | |||
# Project name, used for binaries | |||
NAME = PowerJuice | |||
# -------------------------------------------------------------- | |||
# Files to build | |||
OBJS_DSP = \ | |||
PowerJuicePlugin.cpp.o | |||
OBJS_UI = \ | |||
PowerJuiceArtwork.cpp.o \ | |||
PowerJuiceUI.cpp.o | |||
# -------------------------------------------------------------- | |||
# Do some magic | |||
include ../Makefile.mk | |||
# -------------------------------------------------------------- | |||
# Enable all possible plugin types | |||
ifeq ($(LINUX),true) | |||
all: jack lv2_one vst | |||
else | |||
all: lv2_one vst | |||
endif | |||
# -------------------------------------------------------------- |
@@ -0,0 +1,35 @@ | |||
/* (Auto-generated binary data file). */ | |||
#ifndef BINARY_POWERJUICEARTWORK_HPP | |||
#define BINARY_POWERJUICEARTWORK_HPP | |||
namespace PowerJuiceArtwork | |||
{ | |||
extern const char* aboutData; | |||
const unsigned int aboutDataSize = 180000; | |||
const unsigned int aboutWidth = 300; | |||
const unsigned int aboutHeight = 200; | |||
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 = 571956; | |||
const unsigned int backgroundWidth = 619; | |||
const unsigned int backgroundHeight = 308; | |||
extern const char* knobData; | |||
const unsigned int knobDataSize = 10404; | |||
const unsigned int knobWidth = 51; | |||
const unsigned int knobHeight = 51; | |||
} | |||
#endif // BINARY_POWERJUICEARTWORK_HPP | |||
@@ -0,0 +1,379 @@ | |||
/* | |||
* Power Juice Plugin | |||
* Copyright (C) 2014 Andre Sklenar <andre.sklenar@gmail.com>, www.juicelab.cz | |||
* | |||
* 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 doc/GPL.txt file. | |||
*/ | |||
#include "PowerJuicePlugin.hpp" | |||
//#include <cstring> | |||
#include <cstdlib> | |||
START_NAMESPACE_DISTRHO | |||
// ----------------------------------------------------------------------- | |||
PowerJuicePlugin::PowerJuicePlugin() | |||
: Plugin(paramCount, 1, 0) // 1 program, 0 states | |||
{ | |||
// set default values | |||
d_setProgram(0); | |||
// reset | |||
d_deactivate(); | |||
} | |||
PowerJuicePlugin::~PowerJuicePlugin() | |||
{ | |||
free(lookaheadStack.data); | |||
free(RMSStack.data); | |||
} | |||
// ----------------------------------------------------------------------- | |||
// Init | |||
void PowerJuicePlugin::d_initParameter(uint32_t index, Parameter& parameter) | |||
{ | |||
switch (index) | |||
{ | |||
case paramAttack: | |||
parameter.hints = PARAMETER_IS_AUTOMABLE; | |||
parameter.name = "Attack"; | |||
parameter.symbol = "att"; | |||
parameter.unit = "ms"; | |||
parameter.ranges.def = 20.0f; | |||
parameter.ranges.min = 0.1f; | |||
parameter.ranges.max = 1000.0f; | |||
break; | |||
case paramRelease: | |||
parameter.hints = PARAMETER_IS_AUTOMABLE; | |||
parameter.name = "Release"; | |||
parameter.symbol = "rel"; | |||
parameter.unit = "ms"; | |||
parameter.ranges.def = 200.0f; | |||
parameter.ranges.min = 0.1f; | |||
parameter.ranges.max = 1000.0f; | |||
break; | |||
case paramThreshold: | |||
parameter.hints = PARAMETER_IS_AUTOMABLE; | |||
parameter.name = "Threshold"; | |||
parameter.symbol = "thr"; | |||
parameter.unit = "dB"; | |||
parameter.ranges.def = 0.0f; | |||
parameter.ranges.min = -60.0f; | |||
parameter.ranges.max = 0.0f; | |||
break; | |||
case paramRatio: | |||
parameter.hints = PARAMETER_IS_AUTOMABLE; | |||
parameter.name = "Ratio"; | |||
parameter.symbol = "rat"; | |||
parameter.unit = ""; | |||
parameter.ranges.def = 1.0f; | |||
parameter.ranges.min = 1.0f; | |||
parameter.ranges.max = 10.0f; | |||
break; | |||
case paramMakeup: | |||
parameter.hints = PARAMETER_IS_AUTOMABLE; | |||
parameter.name = "Make-Up"; | |||
parameter.symbol = "mak"; | |||
parameter.unit = ""; | |||
parameter.ranges.def = 0.0f; | |||
parameter.ranges.min = 0.0f; | |||
parameter.ranges.max = 20.0f; | |||
break; | |||
case paramMix: | |||
parameter.hints = PARAMETER_IS_AUTOMABLE; | |||
parameter.name = "Mix"; | |||
parameter.symbol = "Mix"; | |||
parameter.unit = ""; | |||
parameter.ranges.def = 1.0f; | |||
parameter.ranges.min = 0.0f; | |||
parameter.ranges.max = 1.0f; | |||
break; | |||
} | |||
} | |||
void PowerJuicePlugin::d_initProgramName(uint32_t index, d_string& programName) | |||
{ | |||
if (index != 0) | |||
return; | |||
programName = "Default"; | |||
} | |||
// ----------------------------------------------------------------------- | |||
// Internal data | |||
float PowerJuicePlugin::d_getParameterValue(uint32_t index) const | |||
{ | |||
switch (index) | |||
{ | |||
case paramAttack: | |||
return attack; | |||
case paramRelease: | |||
return release; | |||
case paramThreshold: | |||
return threshold; | |||
case paramRatio: | |||
return ratio; | |||
case paramMakeup: | |||
return makeup; | |||
case paramMix: | |||
return mix; | |||
default: | |||
return 0.0f; | |||
} | |||
} | |||
void PowerJuicePlugin::d_setParameterValue(uint32_t index, float value) | |||
{ | |||
switch (index) | |||
{ | |||
case paramAttack: | |||
attack = value; | |||
attackSamples = d_getSampleRate()*(attack/1000.0f); | |||
break; | |||
case paramRelease: | |||
release = value; | |||
releaseSamples = d_getSampleRate()*(release/1000.0f); | |||
break; | |||
case paramThreshold: | |||
threshold = value; | |||
break; | |||
case paramRatio: | |||
ratio = value; | |||
break; | |||
case paramMakeup: | |||
makeup = value; | |||
makeupFloat = fromDB(makeup); | |||
break; | |||
case paramMix: | |||
mix = value; | |||
break; | |||
} | |||
} | |||
void PowerJuicePlugin::d_setProgram(uint32_t index) | |||
{ | |||
if (index != 0) | |||
return; | |||
/* Default parameter values */ | |||
attack = 20.0f; | |||
release = 200.0f; | |||
threshold = 0.0f; | |||
ratio = 1.0f; | |||
makeup = 0.0f; | |||
mix = 1.0f; | |||
makeupFloat = fromDB(makeup); | |||
attackSamples = d_getSampleRate()*(attack/1000.0f); | |||
releaseSamples = d_getSampleRate()*(release/1000.0f); | |||
w = 563; //waveform plane size, size of the plane in pixels; | |||
w2 = 1126; //wavefowm array | |||
h = 121; //waveform plane height | |||
x = 27; //waveform plane positions | |||
y = 53; | |||
dc = 113; //0DC line y position | |||
/* Default variable values */ | |||
averageCounter = 0; | |||
inputMax = 0.0f; | |||
balancer = 1.0f; | |||
GR = 1.0f; | |||
newRepaint = false; | |||
input.start = 0; | |||
rms.start = 0; | |||
gainReduction.start = 0; | |||
RMSStack.start = 0; | |||
lookaheadStack.start = 0; | |||
repaintSkip = 0; | |||
kFloatRMSStackCount = 400.0f/44100.0f*d_getSampleRate(); | |||
RMSStack.data = (float*) calloc(kFloatRMSStackCount, sizeof(float)); | |||
kFloatLookaheadStackCount = 800.0f/44100.0f*d_getSampleRate(); | |||
lookaheadStack.data = (float*) calloc(kFloatLookaheadStackCount, sizeof(float)); | |||
refreshSkip= 300.0f/44100.0f*d_getSampleRate(); | |||
std::memset(rms.data, 0, sizeof(float)*kFloatStackCount); | |||
std::memset(gainReduction.data, 0, sizeof(float)*kFloatStackCount); | |||
std::memset(RMSStack.data, 0, sizeof(float)*kFloatRMSStackCount); | |||
std::memset(lookaheadStack.data, 0, sizeof(float)*kFloatLookaheadStackCount); | |||
for (int j=0; j < kFloatStackCount; ++j) | |||
history.rms[j] = h +y; | |||
for (int j=0; j < kFloatStackCount; ++j) | |||
history.gainReduction[j] = h +y; | |||
d_activate(); | |||
} | |||
float PowerJuicePlugin::getRMSHistory(int n) { | |||
return history.rms[n]; | |||
} | |||
bool PowerJuicePlugin::repaintNeeded() { | |||
return newRepaint; | |||
} | |||
float PowerJuicePlugin::getGainReductionHistory(int n) { | |||
if (n == kFloatStackCount-1) { | |||
newRepaint = false; | |||
//printf("falsing!\n"); | |||
} | |||
return history.gainReduction[n]; | |||
} | |||
// ----------------------------------------------------------------------- | |||
// Process | |||
void PowerJuicePlugin::d_activate() | |||
{ | |||
} | |||
void PowerJuicePlugin::d_deactivate() | |||
{ | |||
// all values to zero | |||
} | |||
void PowerJuicePlugin::d_run(const float** inputs, float** outputs, uint32_t frames) | |||
{ | |||
const float* in = inputs[0]; | |||
float* out = outputs[0]; | |||
float sum; | |||
float data; | |||
float difference; | |||
for (uint32_t i=0; i < frames; i++) { | |||
sum = 0.0f; | |||
data = 0.0f; | |||
difference = 0; | |||
//sanitizeDenormal(in[i]); // FIXME - you cannot modify inputs | |||
/* compute last RMS */ | |||
//store audio samples in an RMS buffer line | |||
RMSStack.data[RMSStack.start++] = in[i]; | |||
if (RMSStack.start == kFloatRMSStackCount) | |||
RMSStack.start = 0; | |||
//compute RMS over last kFloatRMSStackCount samples | |||
for (int j=0; j < kFloatRMSStackCount; ++j) { | |||
data = RMSStack.data[(RMSStack.start+j) % kFloatRMSStackCount]; | |||
sum += data * data; | |||
} | |||
//root mean SQUARE | |||
float RMS = sqrt(sum / kFloatRMSStackCount); | |||
sanitizeDenormal(RMS); | |||
/* compute gain reduction if needed */ | |||
float RMSDB = toDB(RMS); | |||
if (RMSDB>threshold) { | |||
//attack stage | |||
float difference = (RMSDB-threshold); | |||
//sanitizeDenormal(difference); | |||
targetGR = difference - difference/ratio; | |||
if (targetGR>difference/(ratio/4.0f)) { | |||
targetGR = difference - difference/(ratio*1.5f); | |||
//more power! | |||
} | |||
// | |||
if (GR<targetGR) { | |||
//approach targetGR at attackSamples rate | |||
GR -= (GR-targetGR)/(attackSamples); | |||
} else { | |||
//approach targetGR at releaseSamples rate | |||
GR -= (GR-targetGR)/releaseSamples; | |||
} | |||
sanitizeDenormal(GR); | |||
} else { | |||
//release stage | |||
//approach targetGR at releaseSamples rate, targetGR = 0.0f | |||
GR -= GR/releaseSamples; | |||
} | |||
//store audio in lookahead buffer | |||
lookaheadStack.data[lookaheadStack.start++] = in[i]; | |||
//printf("rms\n"); | |||
if (lookaheadStack.start == kFloatLookaheadStackCount) | |||
lookaheadStack.start = 0; | |||
if (++averageCounter >= refreshSkip) { | |||
//add relevant values to the shared memory | |||
rms.data[rms.start++] = RMSDB; | |||
gainReduction.data[gainReduction.start++] = GR; | |||
//rewind stack reading heads if needed | |||
if (rms.start == kFloatStackCount) | |||
rms.start = 0; | |||
if (gainReduction.start == kFloatStackCount) | |||
gainReduction.start = 0; | |||
//saving in gfx format, for speed | |||
//share memory | |||
for (int j=0; j < kFloatStackCount; ++j) | |||
history.rms[j] = -toIEC(rms.data[(rms.start+j) % kFloatStackCount])/200*h +h +y; | |||
for (int j=0; j < kFloatStackCount; ++j) { | |||
history.gainReduction[j] = -toIEC(-gainReduction.data[(gainReduction.start+j) % kFloatStackCount])/200*h +h +y; | |||
} | |||
repaintSkip++; | |||
if (repaintSkip>5) { | |||
repaintSkip = 0; | |||
newRepaint = true; | |||
} | |||
averageCounter = 0; | |||
inputMax = 0.0f; | |||
} | |||
/* compress, mix, done. */ | |||
float compressedSignal = in[i]*fromDB(-GR); | |||
out[i] = (compressedSignal*makeupFloat*mix)+in[i]*(1-mix); | |||
} | |||
} | |||
// ----------------------------------------------------------------------- | |||
Plugin* createPlugin() | |||
{ | |||
return new PowerJuicePlugin(); | |||
} | |||
// ----------------------------------------------------------------------- | |||
END_NAMESPACE_DISTRHO |
@@ -0,0 +1,212 @@ | |||
/* | |||
* Power Juice Plugin | |||
* Copyright (C) 2014 Andre Sklenar <andre.sklenar@gmail.com>, www.juicelab.cz | |||
* | |||
* 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 doc/GPL.txt file. | |||
*/ | |||
#ifndef POWERJUICEPLUGIN_HPP_INCLUDED | |||
#define POWERJUICEPLUGIN_HPP_INCLUDED | |||
#include "DistrhoPlugin.hpp" | |||
#include <cmath> | |||
static const int kFloatStackCount = 563; | |||
struct FloatStack { //history for GUI! | |||
int32_t start; | |||
float data[kFloatStackCount]; | |||
}; | |||
struct FloatRMSStack { //rms, sr-dependent | |||
int32_t start; | |||
float* data; | |||
}; | |||
struct LookaheadStack { //lookahead buffer, sr-dependent | |||
int32_t start; | |||
float* data; | |||
}; | |||
struct SharedMemData { //history for the GUI ! | |||
float rms[kFloatStackCount]; | |||
float gainReduction[kFloatStackCount]; | |||
}; | |||
START_NAMESPACE_DISTRHO | |||
// ----------------------------------------------------------------------- | |||
class PowerJuicePlugin : public Plugin | |||
{ | |||
public: | |||
enum Parameters | |||
{ | |||
paramAttack = 0, | |||
paramRelease, | |||
paramThreshold, | |||
paramRatio, | |||
paramMakeup, | |||
paramMix, | |||
paramCount | |||
}; | |||
PowerJuicePlugin(); | |||
~PowerJuicePlugin() override; | |||
protected: | |||
// ------------------------------------------------------------------- | |||
// Information | |||
const char* d_getLabel() const noexcept override | |||
{ | |||
return "PowerJuice"; | |||
} | |||
const char* d_getMaker() const noexcept override | |||
{ | |||
return "Andre Sklenar"; | |||
} | |||
const char* d_getLicense() const noexcept override | |||
{ | |||
return "GPL v2+"; | |||
} | |||
uint32_t d_getVersion() const noexcept override | |||
{ | |||
return 0x1000; | |||
} | |||
long d_getUniqueId() const noexcept override | |||
{ | |||
return d_cconst('P', 'w', 'r', 'J'); | |||
} | |||
// ------------------------------------------------------------------- | |||
// Init | |||
void d_initParameter(uint32_t index, Parameter& parameter) override; | |||
void d_initProgramName(uint32_t index, d_string& programName) override; | |||
// ------------------------------------------------------------------- | |||
// Internal data | |||
float d_getParameterValue(uint32_t index) const override; | |||
void d_setParameterValue(uint32_t index, float value) override; | |||
void d_setProgram(uint32_t index) override; | |||
// ------------------------------------------------------------------- | |||
// Process | |||
void d_activate() override; | |||
void d_deactivate() override; | |||
void d_run(const float** inputs, float** outputs, uint32_t frames) override; | |||
// ------------------------------------------------------------------- | |||
private: | |||
// params | |||
float attack, release, threshold, ratio, makeup, mix; | |||
float attackSamples, releaseSamples, makeupFloat; | |||
float balancer; | |||
float targetGR; | |||
float GR; | |||
SharedMemData history; | |||
float sum; | |||
float data; | |||
float difference; | |||
int w; //waveform plane size, size of the plane in pixels; | |||
int w2; //wavefowm array | |||
int h; //waveform plane height | |||
int x; //waveform plane positions | |||
int y; | |||
int dc; //0DC line y position | |||
int kFloatRMSStackCount; | |||
int kFloatLookaheadStackCount; | |||
float refreshSkip; | |||
int averageCounter; | |||
float inputMax; | |||
FloatStack input, rms, gainReduction; | |||
struct FloatRMSStack RMSStack; | |||
struct LookaheadStack lookaheadStack; | |||
bool newRepaint; | |||
int repaintSkip; | |||
float fromDB(float gdb) { | |||
return (std::exp(gdb/20.f*std::log(10.f))); | |||
}; | |||
float toDB(float g) { | |||
return (20.f*std::log10(g)); | |||
} | |||
float toIEC(float db) { | |||
float def = 0.0f; /* Meter deflection %age */ | |||
if (db < -70.0f) { | |||
def = 0.0f; | |||
} else if (db < -60.0f) { | |||
def = (db + 70.0f) * 0.25f; | |||
} else if (db < -50.0f) { | |||
def = (db + 60.0f) * 0.5f + 5.0f; | |||
} else if (db < -40.0f) { | |||
def = (db + 50.0f) * 0.75f + 7.5; | |||
} else if (db < -30.0f) { | |||
def = (db + 40.0f) * 1.5f + 15.0f; | |||
} else if (db < -20.0f) { | |||
def = (db + 30.0f) * 2.0f + 30.0f; | |||
} else if (db < 0.0f) { | |||
def = (db + 20.0f) * 2.5f + 50.0f; | |||
} else { | |||
def = 100.0f; | |||
} | |||
return (def * 2.0f); | |||
} | |||
bool isNan(float& value ) { | |||
if (((*(uint32_t *) &value) & 0x7fffffff) > 0x7f800000) { | |||
return true; | |||
} | |||
return false; | |||
} | |||
void sanitizeDenormal(float& value) { | |||
if (isNan(value)) { | |||
//std::printf("Booo!\n"); | |||
value = 0.f; | |||
} | |||
} | |||
public: | |||
//methods | |||
float getRMSHistory(int n); | |||
float getGainReductionHistory(int n); | |||
bool repaintNeeded(); | |||
}; | |||
// ----------------------------------------------------------------------- | |||
END_NAMESPACE_DISTRHO | |||
#endif // POWERJUICE_HPP_INCLUDED |
@@ -0,0 +1,307 @@ | |||
/* | |||
* Power Juice Plugin | |||
* Copyright (C) 2014 Andre Sklenar <andre.sklenar@gmail.com>, www.juicelab.cz | |||
* | |||
* 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 doc/GPL.txt file. | |||
*/ | |||
#include "PowerJuiceUI.hpp" | |||
#include <cstdlib> | |||
#include <ctime> | |||
using DGL::Point; | |||
START_NAMESPACE_DISTRHO | |||
// ----------------------------------------------------------------------- | |||
PowerJuiceUI::PowerJuiceUI() | |||
: UI(), | |||
fAboutWindow(this), | |||
dsp((PowerJuicePlugin*)d_getPluginInstancePointer()) | |||
{ | |||
DISTRHO_SAFE_ASSERT(dsp != nullptr); | |||
// background | |||
fImgBackground = Image(PowerJuiceArtwork::backgroundData, PowerJuiceArtwork::backgroundWidth, PowerJuiceArtwork::backgroundHeight, GL_BGR); | |||
// about | |||
Image imageAbout(PowerJuiceArtwork::aboutData, PowerJuiceArtwork::aboutWidth, PowerJuiceArtwork::aboutHeight, GL_BGR); | |||
fAboutWindow.setImage(imageAbout); | |||
// knobs | |||
Image knobImage(PowerJuiceArtwork::knobData, PowerJuiceArtwork::knobWidth, PowerJuiceArtwork::knobHeight); | |||
// knob Attack | |||
fKnobAttack = new ImageKnob(this, knobImage); | |||
fKnobAttack->setAbsolutePos(37, 213); | |||
fKnobAttack->setRange(0.1f, 1000.0f); | |||
fKnobAttack->setStep(0.1f); | |||
fKnobAttack->setValue(20.0f); | |||
fKnobAttack->setRotationAngle(270); | |||
fKnobAttack->setCallback(this); | |||
// knob Release | |||
fKnobRelease = new ImageKnob(this, knobImage); | |||
fKnobRelease->setAbsolutePos(136, 213); | |||
fKnobRelease->setRange(0.1f, 1000.0f); | |||
fKnobRelease->setValue(0.1f); | |||
fKnobRelease->setRotationAngle(270); | |||
fKnobRelease->setCallback(this); | |||
// knob Threshold | |||
fKnobThreshold = new ImageKnob(this, knobImage); | |||
fKnobThreshold->setAbsolutePos(235, 213); | |||
fKnobThreshold->setRange(-60.0f, 0.0f); | |||
fKnobThreshold->setValue(0.0f); | |||
fKnobThreshold->setRotationAngle(270); | |||
fKnobThreshold->setCallback(this); | |||
// knob Ratio | |||
fKnobRatio = new ImageKnob(this, knobImage); | |||
fKnobRatio->setAbsolutePos(334, 213); | |||
fKnobRatio->setRange(1.0f, 10.0f); | |||
fKnobRatio->setValue(1.0f); | |||
fKnobRatio->setRotationAngle(270); | |||
fKnobRatio->setCallback(this); | |||
// knob Make-Up | |||
fKnobMakeup = new ImageKnob(this, knobImage); | |||
fKnobMakeup->setAbsolutePos(433, 213); | |||
fKnobMakeup->setRange(0.0f, 20.0f); | |||
fKnobMakeup->setValue(0.0f); | |||
fKnobMakeup->setRotationAngle(270); | |||
fKnobMakeup->setCallback(this); | |||
// knob Mix | |||
fKnobMix = new ImageKnob(this, knobImage); | |||
fKnobMix->setAbsolutePos(532, 213); | |||
fKnobMix->setRange(0.0f, 1.0f); | |||
fKnobMix->setValue(1.0f); | |||
fKnobMix->setRotationAngle(270); | |||
fKnobMix->setCallback(this); | |||
// about button | |||
Image aboutImageNormal(PowerJuiceArtwork::aboutButtonNormalData, PowerJuiceArtwork::aboutButtonNormalWidth, PowerJuiceArtwork::aboutButtonNormalHeight); | |||
Image aboutImageHover(PowerJuiceArtwork::aboutButtonHoverData, PowerJuiceArtwork::aboutButtonHoverWidth, PowerJuiceArtwork::aboutButtonHoverHeight); | |||
fButtonAbout = new ImageButton(this, aboutImageNormal, aboutImageHover, aboutImageHover); | |||
fButtonAbout->setAbsolutePos(502, 17); | |||
fButtonAbout->setCallback(this); | |||
// set default values | |||
d_programChanged(0); | |||
} | |||
// ----------------------------------------------------------------------- | |||
// DSP Callbacks | |||
void PowerJuiceUI::d_parameterChanged(uint32_t index, float value) | |||
{ | |||
switch (index) | |||
{ | |||
case PowerJuicePlugin::paramAttack: | |||
fKnobAttack->setValue(value); | |||
break; | |||
case PowerJuicePlugin::paramRelease: | |||
fKnobRelease->setValue(value); | |||
break; | |||
case PowerJuicePlugin::paramThreshold: | |||
fKnobThreshold->setValue(value); | |||
break; | |||
case PowerJuicePlugin::paramRatio: | |||
fKnobRatio->setValue(value); | |||
break; | |||
case PowerJuicePlugin::paramMakeup: | |||
fKnobMakeup->setValue(value); | |||
break; | |||
case PowerJuicePlugin::paramMix: | |||
fKnobMix->setValue(value); | |||
break; | |||
} | |||
} | |||
void PowerJuiceUI::d_programChanged(uint32_t index) | |||
{ | |||
if (index != 0) | |||
return; | |||
// Default values | |||
fKnobAttack->setValue(20.0f); | |||
fKnobRelease->setValue(200.0f); | |||
fKnobThreshold->setValue(0.0f); | |||
fKnobRatio->setValue(1.0f); | |||
fKnobMakeup->setValue(0.0f); | |||
fKnobMix->setValue(1.0f); | |||
} | |||
// ----------------------------------------------------------------------- | |||
// Widget Callbacks | |||
void PowerJuiceUI::imageButtonClicked(ImageButton* button, int) | |||
{ | |||
if (button != fButtonAbout) | |||
return; | |||
fAboutWindow.exec(); | |||
} | |||
void PowerJuiceUI::imageKnobDragStarted(ImageKnob* knob) | |||
{ | |||
if (knob == fKnobAttack) | |||
d_editParameter(PowerJuicePlugin::paramAttack, true); | |||
else if (knob == fKnobRelease) | |||
d_editParameter(PowerJuicePlugin::paramRelease, true); | |||
else if (knob == fKnobThreshold) | |||
d_editParameter(PowerJuicePlugin::paramThreshold, true); | |||
else if (knob == fKnobRatio) | |||
d_editParameter(PowerJuicePlugin::paramRatio, true); | |||
else if (knob == fKnobMakeup) | |||
d_editParameter(PowerJuicePlugin::paramMakeup, true); | |||
else if (knob == fKnobMix) | |||
d_editParameter(PowerJuicePlugin::paramMix, true); | |||
} | |||
void PowerJuiceUI::imageKnobDragFinished(ImageKnob* knob) | |||
{ | |||
if (knob == fKnobAttack) | |||
d_editParameter(PowerJuicePlugin::paramAttack, false); | |||
else if (knob == fKnobRelease) | |||
d_editParameter(PowerJuicePlugin::paramRelease, false); | |||
else if (knob == fKnobThreshold) | |||
d_editParameter(PowerJuicePlugin::paramThreshold, false); | |||
else if (knob == fKnobRatio) | |||
d_editParameter(PowerJuicePlugin::paramRatio, false); | |||
else if (knob == fKnobMakeup) | |||
d_editParameter(PowerJuicePlugin::paramMakeup, false); | |||
else if (knob == fKnobMix) | |||
d_editParameter(PowerJuicePlugin::paramMix, false); | |||
} | |||
void PowerJuiceUI::imageKnobValueChanged(ImageKnob* knob, float value) | |||
{ | |||
if (knob == fKnobAttack) | |||
d_setParameterValue(PowerJuicePlugin::paramAttack, value); | |||
else if (knob == fKnobRelease) | |||
d_setParameterValue(PowerJuicePlugin::paramRelease, value); | |||
else if (knob == fKnobThreshold) | |||
d_setParameterValue(PowerJuicePlugin::paramThreshold, value); | |||
else if (knob == fKnobRatio) | |||
d_setParameterValue(PowerJuicePlugin::paramRatio, value); | |||
else if (knob == fKnobMakeup) | |||
d_setParameterValue(PowerJuicePlugin::paramMakeup, value); | |||
else if (knob == fKnobMix) | |||
d_setParameterValue(PowerJuicePlugin::paramMix, value); | |||
} | |||
void PowerJuiceUI::d_uiIdle() | |||
{ | |||
if (dsp != nullptr && dsp->repaintNeeded()) | |||
repaint(); | |||
} | |||
void PowerJuiceUI::onDisplay() | |||
{ | |||
fImgBackground.draw(); | |||
if (dsp == nullptr) | |||
return; | |||
int w = 563; //waveform plane size, size of the plane in pixels; | |||
int w2 = 1126; //wavefowm array | |||
int h = 121; //waveform plane height | |||
int x = 27; //waveform plane positions | |||
int y = 53; | |||
int dc = 113; //0DC line y position | |||
glEnable(GL_BLEND); | |||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); | |||
glEnable(GL_LINE_SMOOTH); | |||
glHint(GL_LINE_SMOOTH_HINT, GL_NICEST); | |||
float thresholdPosition = (-toIEC(fKnobThreshold->getValue()))/200*h+h+y; | |||
//draw waveform | |||
/* | |||
glColor4f(0.0f, 1.0f, 0.0f, 0.4f); | |||
glLineWidth(1.2f); | |||
for (int i=0; i<w; i++) { | |||
glBegin(GL_LINES); | |||
glVertex2i(x+i, -toIEC(shmData->input[i])/200*h+h+y); | |||
glVertex2i(x+i, y+h); | |||
glEnd(); | |||
} | |||
*/ | |||
//draw RMS | |||
glColor4f(0.0f, 0.0f, 1.0f, 1.0f); | |||
glLineWidth(2.0f); | |||
glBegin(GL_LINE_STRIP); | |||
for (int i=2; i<w; i++) { | |||
float value = dsp->getRMSHistory(i); | |||
if (value<thresholdPosition) { | |||
glColor4f(0.0f, 0.5f, 0.0f, 1.0f); | |||
} else { | |||
glColor4f(0.0f, 0.5f, 0.2f, 1.0f); | |||
} | |||
glVertex2i(x+i, value); | |||
} | |||
glEnd(); | |||
//draw gain reduction | |||
glColor4f(1.0f, 1.0f, 1.0f, 0.3f); | |||
glLineWidth(3.0f); | |||
glBegin(GL_LINES); | |||
for (int i=2; i<w; i++) { | |||
glColor4f(1.0f, 1.0f, 1.0f, 0.3f); | |||
float value = dsp->getGainReductionHistory(i); | |||
glVertex2i(x+i, value); | |||
glVertex2i(x+i, y); | |||
value = dsp->getRMSHistory(i); | |||
glColor4f(0.0f, 0.5f, 0.2f, 0.1f); | |||
glVertex2i(x+i, value); | |||
glVertex2i(x+i, y+h); | |||
} | |||
glEnd(); | |||
//draw Threshold | |||
glLineWidth(2.0f); | |||
glColor4f(0.4f, 0.4f, 1.0f, 0.8f); | |||
//float thresholdPosition = ((60-fKnobThreshold->getValue())/60); | |||
glBegin(GL_LINES); | |||
glVertex2i(x, thresholdPosition); | |||
glVertex2i(x+w, thresholdPosition); | |||
glEnd(); | |||
// reset color | |||
glColor4f(1.0f, 1.0f, 1.0f, 1.0f); | |||
} | |||
// ----------------------------------------------------------------------- | |||
UI* createUI() | |||
{ | |||
return new PowerJuiceUI(); | |||
} | |||
// ----------------------------------------------------------------------- | |||
END_NAMESPACE_DISTRHO |
@@ -0,0 +1,130 @@ | |||
/* | |||
* Power Juice Plugin | |||
* Copyright (C) 2014 Andre Sklenar <andre.sklenar@gmail.com>, www.juicelab.cz | |||
* | |||
* 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 doc/GPL.txt file. | |||
*/ | |||
#ifndef POWERJUICEUI_HPP_INCLUDED | |||
#define POWERJUICEUI_HPP_INCLUDED | |||
#include "DistrhoUI.hpp" | |||
#include "ImageAboutWindow.hpp" | |||
#include "ImageButton.hpp" | |||
#include "ImageKnob.hpp" | |||
#include "ImageSlider.hpp" | |||
#include "PowerJuiceArtwork.hpp" | |||
#include "PowerJuicePlugin.hpp" | |||
#include <cmath> | |||
using DGL::Image; | |||
using DGL::ImageAboutWindow; | |||
using DGL::ImageButton; | |||
using DGL::ImageKnob; | |||
START_NAMESPACE_DISTRHO | |||
// ----------------------------------------------------------------------- | |||
class PowerJuiceUI : public UI, | |||
public ImageButton::Callback, | |||
public ImageKnob::Callback | |||
{ | |||
public: | |||
PowerJuiceUI(); | |||
protected: | |||
// ------------------------------------------------------------------- | |||
// Information | |||
uint d_getWidth() const noexcept override | |||
{ | |||
return PowerJuiceArtwork::backgroundWidth; | |||
} | |||
uint d_getHeight() const noexcept override | |||
{ | |||
return PowerJuiceArtwork::backgroundHeight; | |||
} | |||
// ------------------------------------------------------------------- | |||
// DSP Callbacks | |||
void d_parameterChanged(uint32_t index, float value) override; | |||
void d_programChanged(uint32_t index) override; | |||
// ------------------------------------------------------------------- | |||
// UI Callbacks | |||
void d_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 onDisplay() override; | |||
private: | |||
Image fImgBackground; | |||
ImageAboutWindow fAboutWindow; | |||
ScopedPointer<ImageKnob> fKnobAttack, fKnobRelease, fKnobThreshold; | |||
ScopedPointer<ImageKnob> fKnobRatio, fKnobMakeup, fKnobMix; | |||
ScopedPointer<ImageButton> fButtonAbout; | |||
PowerJuicePlugin* const dsp; | |||
float fromDB(float gdb) { | |||
return (std::exp(gdb/20.f*std::log(10.f))); | |||
}; | |||
float toDB(float g) { | |||
return (20.f*std::log10(g)); | |||
} | |||
float toIEC(float db) { | |||
float def = 0.0f; /* Meter deflection %age */ | |||
if (db < -70.0f) { | |||
def = 0.0f; | |||
} else if (db < -60.0f) { | |||
def = (db + 70.0f) * 0.25f; | |||
} else if (db < -50.0f) { | |||
def = (db + 60.0f) * 0.5f + 5.0f; | |||
} else if (db < -40.0f) { | |||
def = (db + 50.0f) * 0.75f + 7.5; | |||
} else if (db < -30.0f) { | |||
def = (db + 40.0f) * 1.5f + 15.0f; | |||
} else if (db < -20.0f) { | |||
def = (db + 30.0f) * 2.0f + 30.0f; | |||
} else if (db < 0.0f) { | |||
def = (db + 20.0f) * 2.5f + 50.0f; | |||
} else { | |||
def = 100.0f; | |||
} | |||
return (def * 2.0f); | |||
} | |||
}; | |||
// ----------------------------------------------------------------------- | |||
END_NAMESPACE_DISTRHO | |||
#endif // POWERJUICEUI_HPP_INCLUDED |
@@ -0,0 +1,39 @@ | |||
/* | |||
* Power Juice Plugin | |||
* Copyright (C) 2014 Andre Sklenar <andre.sklenar@gmail.com>, www.juicelab.cz | |||
* | |||
* 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 doc/GPL.txt file. | |||
*/ | |||
#ifndef DISTRHO_PLUGIN_INFO_H_INCLUDED | |||
#define DISTRHO_PLUGIN_INFO_H_INCLUDED | |||
#define DISTRHO_PLUGIN_NAME "PowerJuiceX2" | |||
#define DISTRHO_PLUGIN_HAS_UI 1 | |||
#define DISTRHO_PLUGIN_IS_SYNTH 0 | |||
#define DISTRHO_PLUGIN_NUM_INPUTS 2 | |||
#define DISTRHO_PLUGIN_NUM_OUTPUTS 2 | |||
#define DISTRHO_PLUGIN_WANT_LATENCY 0 | |||
#define DISTRHO_PLUGIN_WANT_PROGRAMS 1 | |||
#define DISTRHO_PLUGIN_WANT_STATE 0 | |||
#define DISTRHO_PLUGIN_WANT_TIMEPOS 0 | |||
// needed for spectrum | |||
#define DISTRHO_PLUGIN_WANT_DIRECT_ACCESS 1 | |||
#define DISTRHO_PLUGIN_URI "urn:distrho:PowerJuiceX2" | |||
#endif // DISTRHO_PLUGIN_INFO_H_INCLUDED |
@@ -0,0 +1,36 @@ | |||
#!/usr/bin/make -f | |||
# Makefile for DISTRHO Plugins # | |||
# ---------------------------- # | |||
# Created by falkTX | |||
# | |||
# -------------------------------------------------------------- | |||
# Project name, used for binaries | |||
NAME = PowerJuiceX2 | |||
# -------------------------------------------------------------- | |||
# Files to build | |||
OBJS_DSP = \ | |||
PowerJuiceX2Plugin.cpp.o | |||
OBJS_UI = \ | |||
PowerJuiceX2Artwork.cpp.o \ | |||
PowerJuiceX2UI.cpp.o | |||
# -------------------------------------------------------------- | |||
# Do some magic | |||
include ../Makefile.mk | |||
# -------------------------------------------------------------- | |||
# Enable all possible plugin types | |||
ifeq ($(LINUX),true) | |||
all: jack lv2_one vst | |||
else | |||
all: lv2_one vst | |||
endif | |||
# -------------------------------------------------------------- |
@@ -0,0 +1,35 @@ | |||
/* (Auto-generated binary data file). */ | |||
#ifndef BINARY_POWERJUICEX2ARTWORK_HPP | |||
#define BINARY_POWERJUICEX2ARTWORK_HPP | |||
namespace PowerJuiceX2Artwork | |||
{ | |||
extern const char* aboutData; | |||
const unsigned int aboutDataSize = 180000; | |||
const unsigned int aboutWidth = 300; | |||
const unsigned int aboutHeight = 200; | |||
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 = 571956; | |||
const unsigned int backgroundWidth = 619; | |||
const unsigned int backgroundHeight = 308; | |||
extern const char* knobData; | |||
const unsigned int knobDataSize = 10404; | |||
const unsigned int knobWidth = 51; | |||
const unsigned int knobHeight = 51; | |||
} | |||
#endif // BINARY_POWERJUICEX2ARTWORK_HPP | |||
@@ -0,0 +1,385 @@ | |||
/* | |||
* Power Juice Plugin | |||
* Copyright (C) 2014 Andre Sklenar <andre.sklenar@gmail.com>, www.juicelab.cz | |||
* | |||
* 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 doc/GPL.txt file. | |||
*/ | |||
#include "PowerJuiceX2Plugin.hpp" | |||
#include <cstdlib> | |||
#include <algorithm> | |||
START_NAMESPACE_DISTRHO | |||
// ----------------------------------------------------------------------- | |||
PowerJuiceX2Plugin::PowerJuiceX2Plugin() | |||
: Plugin(paramCount, 1, 0) // 1 program, 0 states | |||
{ | |||
// set default values | |||
d_setProgram(0); | |||
// reset | |||
d_deactivate(); | |||
} | |||
PowerJuiceX2Plugin::~PowerJuiceX2Plugin() | |||
{ | |||
free(lookaheadStack.data); | |||
free(RMSStack.data); | |||
} | |||
// ----------------------------------------------------------------------- | |||
// Init | |||
void PowerJuiceX2Plugin::d_initParameter(uint32_t index, Parameter& parameter) | |||
{ | |||
switch (index) | |||
{ | |||
case paramAttack: | |||
parameter.hints = PARAMETER_IS_AUTOMABLE; | |||
parameter.name = "Attack"; | |||
parameter.symbol = "att"; | |||
parameter.unit = "ms"; | |||
parameter.ranges.def = 20.0f; | |||
parameter.ranges.min = 0.1f; | |||
parameter.ranges.max = 1000.0f; | |||
break; | |||
case paramRelease: | |||
parameter.hints = PARAMETER_IS_AUTOMABLE; | |||
parameter.name = "Release"; | |||
parameter.symbol = "rel"; | |||
parameter.unit = "ms"; | |||
parameter.ranges.def = 200.0f; | |||
parameter.ranges.min = 0.1f; | |||
parameter.ranges.max = 1000.0f; | |||
break; | |||
case paramThreshold: | |||
parameter.hints = PARAMETER_IS_AUTOMABLE; | |||
parameter.name = "Threshold"; | |||
parameter.symbol = "thr"; | |||
parameter.unit = "dB"; | |||
parameter.ranges.def = 0.0f; | |||
parameter.ranges.min = -60.0f; | |||
parameter.ranges.max = 0.0f; | |||
break; | |||
case paramRatio: | |||
parameter.hints = PARAMETER_IS_AUTOMABLE; | |||
parameter.name = "Ratio"; | |||
parameter.symbol = "rat"; | |||
parameter.unit = ""; | |||
parameter.ranges.def = 1.0f; | |||
parameter.ranges.min = 1.0f; | |||
parameter.ranges.max = 10.0f; | |||
break; | |||
case paramMakeup: | |||
parameter.hints = PARAMETER_IS_AUTOMABLE; | |||
parameter.name = "Make-Up"; | |||
parameter.symbol = "mak"; | |||
parameter.unit = ""; | |||
parameter.ranges.def = 0.0f; | |||
parameter.ranges.min = 0.0f; | |||
parameter.ranges.max = 20.0f; | |||
break; | |||
case paramMix: | |||
parameter.hints = PARAMETER_IS_AUTOMABLE; | |||
parameter.name = "Mix"; | |||
parameter.symbol = "Mix"; | |||
parameter.unit = ""; | |||
parameter.ranges.def = 1.0f; | |||
parameter.ranges.min = 0.0f; | |||
parameter.ranges.max = 1.0f; | |||
break; | |||
} | |||
} | |||
void PowerJuiceX2Plugin::d_initProgramName(uint32_t index, d_string& programName) | |||
{ | |||
if (index != 0) | |||
return; | |||
programName = "Default"; | |||
} | |||
// ----------------------------------------------------------------------- | |||
// Internal data | |||
float PowerJuiceX2Plugin::d_getParameterValue(uint32_t index) const | |||
{ | |||
switch (index) | |||
{ | |||
case paramAttack: | |||
return attack; | |||
case paramRelease: | |||
return release; | |||
case paramThreshold: | |||
return threshold; | |||
case paramRatio: | |||
return ratio; | |||
case paramMakeup: | |||
return makeup; | |||
case paramMix: | |||
return mix; | |||
default: | |||
return 0.0f; | |||
} | |||
} | |||
void PowerJuiceX2Plugin::d_setParameterValue(uint32_t index, float value) | |||
{ | |||
switch (index) | |||
{ | |||
case paramAttack: | |||
attack = value; | |||
attackSamples = d_getSampleRate()*(attack/1000.0f); | |||
break; | |||
case paramRelease: | |||
release = value; | |||
releaseSamples = d_getSampleRate()*(release/1000.0f); | |||
break; | |||
case paramThreshold: | |||
threshold = value; | |||
break; | |||
case paramRatio: | |||
ratio = value; | |||
break; | |||
case paramMakeup: | |||
makeup = value; | |||
makeupFloat = fromDB(makeup); | |||
break; | |||
case paramMix: | |||
mix = value; | |||
break; | |||
} | |||