Browse Source

First commit, full plugin upload

pull/5/head
falkTX 9 years ago
commit
29ba76c73d
43 changed files with 11798 additions and 0 deletions
  1. +13
    -0
      .gitignore
  2. +3
    -0
      .gitmodules
  3. +280
    -0
      LICENSE
  4. +32
    -0
      Makefile
  5. +113
    -0
      Makefile.mk
  6. +6
    -0
      README.md
  7. +3
    -0
      bin/README
  8. +1
    -0
      dpf
  9. +105
    -0
      plugins/Makefile.mk
  10. +6890
    -0
      plugins/Nekobi/DistrhoArtworkNekobi.cpp
  11. +90
    -0
      plugins/Nekobi/DistrhoArtworkNekobi.hpp
  12. +36
    -0
      plugins/Nekobi/DistrhoPluginInfo.h
  13. +401
    -0
      plugins/Nekobi/DistrhoPluginNekobi.cpp
  14. +121
    -0
      plugins/Nekobi/DistrhoPluginNekobi.hpp
  15. +265
    -0
      plugins/Nekobi/DistrhoUINekobi.cpp
  16. +102
    -0
      plugins/Nekobi/DistrhoUINekobi.hpp
  17. +27
    -0
      plugins/Nekobi/Makefile
  18. +202
    -0
      plugins/Nekobi/NekoWidget.hpp
  19. BIN
      plugins/Nekobi/Screenshot.png
  20. BIN
      plugins/Nekobi/artwork/about.png
  21. BIN
      plugins/Nekobi/artwork/aboutButtonHover.png
  22. BIN
      plugins/Nekobi/artwork/aboutButtonNormal.png
  23. BIN
      plugins/Nekobi/artwork/background.png
  24. BIN
      plugins/Nekobi/artwork/claw1.png
  25. BIN
      plugins/Nekobi/artwork/claw2.png
  26. BIN
      plugins/Nekobi/artwork/knob.png
  27. BIN
      plugins/Nekobi/artwork/run1.png
  28. BIN
      plugins/Nekobi/artwork/run2.png
  29. BIN
      plugins/Nekobi/artwork/run3.png
  30. BIN
      plugins/Nekobi/artwork/run4.png
  31. BIN
      plugins/Nekobi/artwork/scratch1.png
  32. BIN
      plugins/Nekobi/artwork/scratch2.png
  33. BIN
      plugins/Nekobi/artwork/sit.png
  34. BIN
      plugins/Nekobi/artwork/slider.png
  35. BIN
      plugins/Nekobi/artwork/tail.png
  36. +1779
    -0
      plugins/Nekobi/nekobee-src/minblep_tables.c
  37. +77
    -0
      plugins/Nekobi/nekobee-src/nekobee.h
  38. +237
    -0
      plugins/Nekobi/nekobee-src/nekobee_synth.c
  39. +132
    -0
      plugins/Nekobi/nekobee-src/nekobee_synth.h
  40. +30
    -0
      plugins/Nekobi/nekobee-src/nekobee_types.h
  41. +256
    -0
      plugins/Nekobi/nekobee-src/nekobee_voice.c
  42. +183
    -0
      plugins/Nekobi/nekobee-src/nekobee_voice.h
  43. +414
    -0
      plugins/Nekobi/nekobee-src/nekobee_voice_render.c

+ 13
- 0
.gitignore View File

@@ -0,0 +1,13 @@
*.a
*.o

*.exe
*.dll
*.dylib
*.so

.kdev_include_paths
.kdev4/

bin/*-dssi/
bin/*.lv2/

+ 3
- 0
.gitmodules View File

@@ -0,0 +1,3 @@
[submodule "dpf"]
path = dpf
url = git://github.com/DISTRHO/DPF

+ 280
- 0
LICENSE View File

@@ -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

+ 32
- 0
Makefile View File

@@ -0,0 +1,32 @@
#!/usr/bin/make -f
# Makefile for DISTRHO Plugins #
# ---------------------------- #
# Created by falkTX
#

all: libs plugins gen

# --------------------------------------------------------------

libs:
$(MAKE) -C dpf/dgl

plugins: libs
$(MAKE) -C plugins/Nekobi

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/Nekobi

# --------------------------------------------------------------

.PHONY: libs plugins

+ 113
- 0
Makefile.mk View File

@@ -0,0 +1,113 @@
#!/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 -mtune=generic -msse -msse2 -mfpmath=sse -fdata-sections -ffunction-sections
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 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

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
LINK_OPTS += -Wl,--strip-all
endif

BUILD_C_FLAGS = $(BASE_FLAGS) -std=c99 -std=gnu99 $(CFLAGS)
BUILD_CXX_FLAGS = $(BASE_FLAGS) -std=c++0x -std=gnu++0x $(CXXFLAGS)
LINK_FLAGS = $(LINK_OPTS) -Wl,--no-undefined $(LDFLAGS)

ifeq ($(MACOS),true)
# No C++11 support
BUILD_CXX_FLAGS = $(BASE_FLAGS) $(CXXFLAGS)
LINK_FLAGS = $(LINK_OPTS) $(LDFLAGS)
endif

# --------------------------------------------------------------
# Check for required libs

ifeq ($(LINUX),true)
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

# --------------------------------------------------------------
# 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

# --------------------------------------------------------------

+ 6
- 0
README.md View File

@@ -0,0 +1,6 @@
# DISTRHO Nekobi

TODO...

## Screenshot
![Nekobi](https://raw.githubusercontent.com/DISTRHO/nekobi/master/plugins/Nekobi/Screenshot.png "Nekobi")<br/>

+ 3
- 0
bin/README View File

@@ -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.

+ 1
- 0
dpf

@@ -0,0 +1 @@
Subproject commit 642b7866dd97429bfa2c2ddb1da57c4902fc40eb

+ 105
- 0
plugins/Makefile.mk View File

@@ -0,0 +1,105 @@
#!/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

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

all: dssi lv2 vst

# --------------------------------------------------------------
# Set plugin binary file targets

ladspa_dsp = $(TARGET_DIR)/$(NAME)-ladspa.$(EXT)
dssi_dsp = $(TARGET_DIR)/$(NAME)-dssi.$(EXT)
dssi_ui = $(TARGET_DIR)/$(NAME)-dssi/$(NAME)_ui
lv2_dsp = $(TARGET_DIR)/$(NAME).lv2/$(NAME).$(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

# --------------------------------------------------------------
# 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).lv2/

# --------------------------------------------------------------
# DSSI

dssi: $(dssi_dsp) $(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: $(lv2_dsp) $(lv2_ui)

$(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) $(DGL_LIBS) -lpthread $(SHARED) -DDISTRHO_PLUGIN_TARGET_VST -o $@

# --------------------------------------------------------------

+ 6890
- 0
plugins/Nekobi/DistrhoArtworkNekobi.cpp
File diff suppressed because it is too large
View File


+ 90
- 0
plugins/Nekobi/DistrhoArtworkNekobi.hpp View File

@@ -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


+ 36
- 0
plugins/Nekobi/DistrhoPluginInfo.h View File

@@ -0,0 +1,36 @@
/*
* DISTRHO Nekobi Plugin, based on Nekobee by Sean Bolton and others.
* Copyright (C) 2013-2014 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_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

+ 401
- 0
plugins/Nekobi/DistrhoPluginNekobi.cpp View File

@@ -0,0 +1,401 @@
/*
* DISTRHO Nekobi Plugin, based on Nekobee by Sean Bolton and others.
* Copyright (C) 2004 Sean Bolton and others
* Copyright (C) 2013-2014 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_lock(nekobee_synth_t* const synth)
{
return (pthread_mutex_lock(&synth->voicelist_mutex) == 0);
}
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 = d_getSampleRate();
fSynth.deltat = 1.0f / (float)d_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
d_deactivate();
}
DistrhoPluginNekobi::~DistrhoPluginNekobi()
{
std::free(fSynth.voice);
}
// -----------------------------------------------------------------------
// Init
void DistrhoPluginNekobi::d_initParameter(uint32_t index, Parameter& parameter)
{
switch (index)
{
case paramWaveform:
parameter.hints = PARAMETER_IS_AUTOMABLE|PARAMETER_IS_BOOLEAN;
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 = PARAMETER_IS_AUTOMABLE; // 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 = PARAMETER_IS_AUTOMABLE; // 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 = PARAMETER_IS_AUTOMABLE; // 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 = PARAMETER_IS_AUTOMABLE; // 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 = PARAMETER_IS_AUTOMABLE; // 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 = PARAMETER_IS_AUTOMABLE; // 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 = PARAMETER_IS_AUTOMABLE; // 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::d_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::d_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::d_activate()
{
fSynth.nugget_remains = 0;
fSynth.note_id = 0;
if (fSynth.voice != nullptr)
nekobee_synth_all_voices_off(&fSynth);
}
void DistrhoPluginNekobi::d_deactivate()
{
if (fSynth.voice != nullptr)
nekobee_synth_all_voices_off(&fSynth);
}
void DistrhoPluginNekobi::d_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)
{
nekobee_handle_raw_event(&fSynth, midiEvents[curEventIndex].size, midiEvents[curEventIndex].buf);
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

+ 121
- 0
plugins/Nekobi/DistrhoPluginNekobi.hpp View File

@@ -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-2014 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* d_getLabel() const noexcept override
{
return "Nekobi";
}
const char* d_getMaker() const noexcept override
{
return "DISTRHO";
}
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('D', 'N', 'e', 'k');
}
// -------------------------------------------------------------------
// Init
void d_initParameter(uint32_t index, Parameter& parameter) override;
// -------------------------------------------------------------------
// Internal data
float d_getParameterValue(uint32_t index) const override;
void d_setParameterValue(uint32_t index, float value) override;
// -------------------------------------------------------------------
// Process
void d_activate() override;
void d_deactivate() override;
void d_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

+ 265
- 0
plugins/Nekobi/DistrhoUINekobi.cpp View File

@@ -0,0 +1,265 @@
/*
* DISTRHO Nekobi Plugin, based on Nekobee by Sean Bolton and others.
* Copyright (C) 2013-2014 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"

using DGL::Point;

START_NAMESPACE_DISTRHO

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

DistrhoUINekobi::DistrhoUINekobi()
: UI(),
fAboutWindow(this)
{
// FIXME
fNeko.setTimerSpeed(4);

// background
fImgBackground = Image(DistrhoArtworkNekobi::backgroundData, DistrhoArtworkNekobi::backgroundWidth, DistrhoArtworkNekobi::backgroundHeight, GL_BGR);

Image aboutImage(DistrhoArtworkNekobi::aboutData, DistrhoArtworkNekobi::aboutWidth, DistrhoArtworkNekobi::aboutHeight, GL_BGR);
fAboutWindow.setImage(aboutImage);

// slider
Image sliderImage(DistrhoArtworkNekobi::sliderData, DistrhoArtworkNekobi::sliderWidth, DistrhoArtworkNekobi::sliderHeight);

fSliderWaveform = new ImageSlider(this, sliderImage);
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(DistrhoArtworkNekobi::knobData, DistrhoArtworkNekobi::knobWidth, DistrhoArtworkNekobi::knobHeight);

// knob Tuning
fKnobTuning = new ImageKnob(this, knobImage);
fKnobTuning->setPos(41, 43);
fKnobTuning->setRange(-12.0f, 12.0f);
fKnobTuning->setValue(0.0f);
fKnobTuning->setRotationAngle(305);
fKnobTuning->setCallback(this);

// knob Cutoff
fKnobCutoff = new ImageKnob(this, knobImage);
fKnobCutoff->setPos(185, 43);
fKnobCutoff->setRange(0.0f, 100.0f);
fKnobCutoff->setValue(25.0f);
fKnobCutoff->setRotationAngle(305);
fKnobCutoff->setCallback(this);

// knob Resonance
fKnobResonance = new ImageKnob(this, knobImage);
fKnobResonance->setPos(257, 43);
fKnobResonance->setRange(0.0f, 95.0f);
fKnobResonance->setValue(25.0f);
fKnobResonance->setRotationAngle(305);
fKnobResonance->setCallback(this);

// knob Env Mod
fKnobEnvMod = new ImageKnob(this, knobImage);
fKnobEnvMod->setPos(329, 43);
fKnobEnvMod->setRange(0.0f, 100.0f);
fKnobEnvMod->setValue(50.0f);
fKnobEnvMod->setRotationAngle(305);
fKnobEnvMod->setCallback(this);

// knob Decay
fKnobDecay = new ImageKnob(this, knobImage);
fKnobDecay->setPos(400, 43);
fKnobDecay->setRange(0.0f, 100.0f);
fKnobDecay->setValue(75.0f);
fKnobDecay->setRotationAngle(305);
fKnobDecay->setCallback(this);

// knob Accent
fKnobAccent = new ImageKnob(this, knobImage);
fKnobAccent->setPos(473, 43);
fKnobAccent->setRange(0.0f, 100.0f);
fKnobAccent->setValue(25.0f);
fKnobAccent->setRotationAngle(305);
fKnobAccent->setCallback(this);

// knob Volume
fKnobVolume = new ImageKnob(this, knobImage);
fKnobVolume->setPos(545, 43);
fKnobVolume->setRange(0.0f, 100.0f);
fKnobVolume->setValue(75.0f);
fKnobVolume->setRotationAngle(305);
fKnobVolume->setCallback(this);

// about button
Image aboutImageNormal(DistrhoArtworkNekobi::aboutButtonNormalData, DistrhoArtworkNekobi::aboutButtonNormalWidth, DistrhoArtworkNekobi::aboutButtonNormalHeight);
Image aboutImageHover(DistrhoArtworkNekobi::aboutButtonHoverData, DistrhoArtworkNekobi::aboutButtonHoverWidth, DistrhoArtworkNekobi::aboutButtonHoverHeight);
fButtonAbout = new ImageButton(this, aboutImageNormal, aboutImageHover, aboutImageHover);
fButtonAbout->setPos(505, 5);
fButtonAbout->setCallback(this);
}

// -----------------------------------------------------------------------
// DSP Callbacks

void DistrhoUINekobi::d_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::d_uiIdle()
{
if (fNeko.idle())
repaint();
}

// -----------------------------------------------------------------------
// Widget Callbacks

void DistrhoUINekobi::imageButtonClicked(ImageButton* button, int)
{
if (button != fButtonAbout)
return;

fAboutWindow.exec();
}

void DistrhoUINekobi::imageKnobDragStarted(ImageKnob* knob)
{
if (knob == fKnobTuning)
d_editParameter(DistrhoPluginNekobi::paramTuning, true);
else if (knob == fKnobCutoff)
d_editParameter(DistrhoPluginNekobi::paramCutoff, true);
else if (knob == fKnobResonance)
d_editParameter(DistrhoPluginNekobi::paramResonance, true);
else if (knob == fKnobEnvMod)
d_editParameter(DistrhoPluginNekobi::paramEnvMod, true);
else if (knob == fKnobDecay)
d_editParameter(DistrhoPluginNekobi::paramDecay, true);
else if (knob == fKnobAccent)
d_editParameter(DistrhoPluginNekobi::paramAccent, true);
else if (knob == fKnobVolume)
d_editParameter(DistrhoPluginNekobi::paramVolume, true);
}

void DistrhoUINekobi::imageKnobDragFinished(ImageKnob* knob)
{
if (knob == fKnobTuning)
d_editParameter(DistrhoPluginNekobi::paramTuning, false);
else if (knob == fKnobCutoff)
d_editParameter(DistrhoPluginNekobi::paramCutoff, false);
else if (knob == fKnobResonance)
d_editParameter(DistrhoPluginNekobi::paramResonance, false);
else if (knob == fKnobEnvMod)
d_editParameter(DistrhoPluginNekobi::paramEnvMod, false);
else if (knob == fKnobDecay)
d_editParameter(DistrhoPluginNekobi::paramDecay, false);
else if (knob == fKnobAccent)
d_editParameter(DistrhoPluginNekobi::paramAccent, false);
else if (knob == fKnobVolume)
d_editParameter(DistrhoPluginNekobi::paramVolume, false);
}

void DistrhoUINekobi::imageKnobValueChanged(ImageKnob* knob, float value)
{
if (knob == fKnobTuning)
d_setParameterValue(DistrhoPluginNekobi::paramTuning, value);
else if (knob == fKnobCutoff)
d_setParameterValue(DistrhoPluginNekobi::paramCutoff, value);
else if (knob == fKnobResonance)
d_setParameterValue(DistrhoPluginNekobi::paramResonance, value);
else if (knob == fKnobEnvMod)
d_setParameterValue(DistrhoPluginNekobi::paramEnvMod, value);
else if (knob == fKnobDecay)
d_setParameterValue(DistrhoPluginNekobi::paramDecay, value);
else if (knob == fKnobAccent)
d_setParameterValue(DistrhoPluginNekobi::paramAccent, value);
else if (knob == fKnobVolume)
d_setParameterValue(DistrhoPluginNekobi::paramVolume, value);
}

void DistrhoUINekobi::imageSliderDragStarted(ImageSlider* slider)
{
if (slider != fSliderWaveform)
return;

d_editParameter(DistrhoPluginNekobi::paramWaveform, true);
}

void DistrhoUINekobi::imageSliderDragFinished(ImageSlider* slider)
{
if (slider != fSliderWaveform)
return;

d_editParameter(DistrhoPluginNekobi::paramWaveform, false);
}

void DistrhoUINekobi::imageSliderValueChanged(ImageSlider* slider, float value)
{
if (slider != fSliderWaveform)
return;

d_setParameterValue(DistrhoPluginNekobi::paramWaveform, value);
}

void DistrhoUINekobi::onDisplay()
{
fImgBackground.draw();
fNeko.draw();
}

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

UI* createUI()
{
return new DistrhoUINekobi();
}

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

END_NAMESPACE_DISTRHO

+ 102
- 0
plugins/Nekobi/DistrhoUINekobi.hpp View File

@@ -0,0 +1,102 @@
/*
* DISTRHO Nekobi Plugin, based on Nekobee by Sean Bolton and others.
* Copyright (C) 2013-2014 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:
// -------------------------------------------------------------------
// Information

uint d_getWidth() const noexcept override
{
return DistrhoArtworkNekobi::backgroundWidth;
}

uint d_getHeight() const noexcept override
{
return DistrhoArtworkNekobi::backgroundHeight;
}

// -------------------------------------------------------------------
// DSP Callbacks

void d_parameterChanged(uint32_t index, float value) 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 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

+ 27
- 0
plugins/Nekobi/Makefile View File

@@ -0,0 +1,27 @@
#!/usr/bin/make -f
# Makefile for DISTRHO Plugins #
# ---------------------------- #
# Created by falkTX
#

# --------------------------------------------------------------
# Project name, used for binaries

NAME = Nekobi

# --------------------------------------------------------------
# Files to build

OBJS_DSP = \
DistrhoPluginNekobi.cpp.o

OBJS_UI = \
DistrhoArtworkNekobi.cpp.o \
DistrhoUINekobi.cpp.o

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

include ../Makefile.mk

# --------------------------------------------------------------

+ 202
- 0
plugins/Nekobi/NekoWidget.hpp View File

@@ -0,0 +1,202 @@
/*
* Neko widget animation
* Copyright (C) 2013-2014 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 NEKO_WIDGET_HPP_INCLUDED
#define NEKO_WIDGET_HPP_INCLUDED

#include "DistrhoArtworkNekobi.hpp"

#include "Image.hpp"
#include "Widget.hpp"

#include <cstdlib> // rand

using DGL::Image;

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

class NekoWidget
{
public:
NekoWidget()
: fPos(0),
fTimer(0),
fTimerSpeed(20),
fCurAction(kActionNone),
fCurImage(&fImages.sit)
{
// load images
{
using namespace DistrhoArtworkNekobi;

#define JOIN(a, b) a ## b
#define LOAD_IMAGE(NAME) fImages.NAME.loadFromMemory(JOIN(NAME, Data), JOIN(NAME, Width), JOIN(NAME, Height));

LOAD_IMAGE(sit)
LOAD_IMAGE(tail)
LOAD_IMAGE(claw1)
LOAD_IMAGE(claw2)
LOAD_IMAGE(scratch1)
LOAD_IMAGE(scratch2)
LOAD_IMAGE(run1)
LOAD_IMAGE(run2)
LOAD_IMAGE(run3)
LOAD_IMAGE(run4)

#undef JOIN
#undef LOAD_IMAGE
}
}

void draw()
{
int x = fPos+108;
int y = -2;

if (fCurImage == &fImages.claw1 || fCurImage == &fImages.claw2)
{
x += 2;
y += 12;
}

fCurImage->drawAt(x, y);
}

// returns true if needs repaint
bool idle()
{
if (++fTimer % fTimerSpeed != 0) // target is 20ms
return false;

if (fTimer == fTimerSpeed*9)
{
if (fCurAction == kActionNone)
fCurAction = static_cast<Action>(std::rand() % kActionCount);
else
fCurAction = kActionNone;

fTimer = 0;
}

switch (fCurAction)
{
case kActionNone:
if (fCurImage == &fImages.sit)
fCurImage = &fImages.tail;
else
fCurImage = &fImages.sit;
break;

case kActionClaw:
if (fCurImage == &fImages.claw1)
fCurImage = &fImages.claw2;
else
fCurImage = &fImages.claw1;
break;

case kActionScratch:
if (fCurImage == &fImages.scratch1)
fCurImage = &fImages.scratch2;
else
fCurImage = &fImages.scratch1;
break;

case kActionRunRight:
if (fTimer == 0 && fPos > 20*9)
{
// run the other way
--fTimer;
fCurAction = kActionRunLeft;
idle();
break;
}

fPos += 20;

if (fCurImage == &fImages.run1)
fCurImage = &fImages.run2;
else
fCurImage = &fImages.run1;
break;

case kActionRunLeft:
if (fTimer == 0 && fPos < 20*9)
{
// run the other way
--fTimer;
fCurAction = kActionRunRight;
idle();
break;
}

fPos -= 20;

if (fCurImage == &fImages.run3)
fCurImage = &fImages.run4;
else
fCurImage = &fImages.run3;
break;

case kActionCount:
break;
}

return true;
}

void setTimerSpeed(int speed)
{
fTimer = 0;
fTimerSpeed = speed;
}

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

private:
enum Action {
kActionNone, // bounce tail
kActionClaw,
kActionScratch,
kActionRunRight,
kActionRunLeft,
kActionCount
};

struct Images {
Image sit;
Image tail;
Image claw1;
Image claw2;
Image scratch1;
Image scratch2;
Image run1;
Image run2;
Image run3;
Image run4;
} fImages;

int fPos;
int fTimer;
int fTimerSpeed;

Action fCurAction;
Image* fCurImage;
};

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

#endif // NEKO_WIDGET_HPP_INCLUDED

BIN
plugins/Nekobi/Screenshot.png View File

Before After
Width: 636  |  Height: 108  |  Size: 49KB

BIN
plugins/Nekobi/artwork/about.png View File

Before After
Width: 303  |  Height: 190  |  Size: 60KB

BIN
plugins/Nekobi/artwork/aboutButtonHover.png View File

Before After
Width: 92  |  Height: 16  |  Size: 4.0KB

BIN
plugins/Nekobi/artwork/aboutButtonNormal.png View File

Before After
Width: 92  |  Height: 16  |  Size: 4.1KB

BIN
plugins/Nekobi/artwork/background.png View File

Before After
Width: 636  |  Height: 108  |  Size: 43KB

BIN
plugins/Nekobi/artwork/claw1.png View File

Before After
Width: 32  |  Height: 32  |  Size: 359B

BIN
plugins/Nekobi/artwork/claw2.png View File

Before After
Width: 32  |  Height: 32  |  Size: 354B

BIN
plugins/Nekobi/artwork/knob.png View File

Before After
Width: 50  |  Height: 50  |  Size: 2.9KB

BIN
plugins/Nekobi/artwork/run1.png View File

Before After
Width: 32  |  Height: 32  |  Size: 383B

BIN
plugins/Nekobi/artwork/run2.png View File

Before After
Width: 32  |  Height: 32  |  Size: 370B

BIN
plugins/Nekobi/artwork/run3.png View File

Before After
Width: 32  |  Height: 32  |  Size: 383B

BIN
plugins/Nekobi/artwork/run4.png View File

Before After
Width: 32  |  Height: 32  |  Size: 369B

BIN
plugins/Nekobi/artwork/scratch1.png View File

Before After
Width: 32  |  Height: 32  |  Size: 375B

BIN
plugins/Nekobi/artwork/scratch2.png View File

Before After
Width: 32  |  Height: 32  |  Size: 348B

BIN
plugins/Nekobi/artwork/sit.png View File

Before After
Width: 32  |  Height: 32  |  Size: 347B

BIN
plugins/Nekobi/artwork/slider.png View File

Before After
Width: 39  |  Height: 39  |  Size: 4.1KB

BIN
plugins/Nekobi/artwork/tail.png View File

Before After
Width: 32  |  Height: 32  |  Size: 353B

+ 1779
- 0
plugins/Nekobi/nekobee-src/minblep_tables.c
File diff suppressed because it is too large
View File


+ 77
- 0
plugins/Nekobi/nekobee-src/nekobee.h View File

@@ -0,0 +1,77 @@
/* nekobee DSSI software synthesizer plugin
*
* Copyright (C) 2004 Sean Bolton and others.
*
* Portions of this file may have come from Chris Cannam and Steve
* Harris's public domain DSSI example code.
*
* 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 (at your option) 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.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307, USA.
*/

#ifndef _XSYNTH_H
#define _XSYNTH_H

/* ==== debugging ==== */

/* XSYNTH_DEBUG bits */
#define XDB_DSSI 1 /* DSSI interface */
#define XDB_AUDIO 2 /* audio output */
#define XDB_NOTE 4 /* note on/off, voice allocation */
#define XDB_DATA 8 /* plugin patchbank handling */
#define GDB_MAIN 16 /* GUI main program flow */
#define GDB_OSC 32 /* GUI OSC handling */
#define GDB_IO 64 /* GUI patch file input/output */
#define GDB_GUI 128 /* GUI GUI callbacks, updating, etc. */

/* If you want debug information, define XSYNTH_DEBUG to the XDB_* bits you're
* interested in getting debug information about, bitwise-ORed together.
* Otherwise, leave it undefined. */
// #define XSYNTH_DEBUG (1+8+16+32+64)

//#define XSYNTH_DEBUG GDB_GUI + GDB_OSC

// #define XSYNTH_DEBUG XDB_DSSI
#ifdef XSYNTH_DEBUG

#include <stdio.h>
#define XSYNTH_DEBUG_INIT(x)
#define XDB_MESSAGE(type, fmt...) { if (XSYNTH_DEBUG & type) fprintf(stderr, "nekobee-dssi.so" fmt); }
#define GDB_MESSAGE(type, fmt...) { if (XSYNTH_DEBUG & type) fprintf(stderr, "nekobee_gtk" fmt); }
// -FIX-:
// #include "message_buffer.h"
// #define XSYNTH_DEBUG_INIT(x) mb_init(x)
// #define XDB_MESSAGE(type, fmt...) { \-
// if (XSYNTH_DEBUG & type) { \-
// char _m[256]; \-
// snprintf(_m, 255, fmt); \-
// add_message(_m); \-
// } \-
// }

#else /* !XSYNTH_DEBUG */

#define XDB_MESSAGE(type, fmt...)
#define GDB_MESSAGE(type, fmt...)
#define XSYNTH_DEBUG_INIT(x)

#endif /* XSYNTH_DEBUG */

/* ==== end of debugging ==== */

#define XSYNTH_MAX_POLYPHONY 1
#define XSYNTH_DEFAULT_POLYPHONY 1

#endif /* _XSYNTH_H */

+ 237
- 0
plugins/Nekobi/nekobee-src/nekobee_synth.c View File

@@ -0,0 +1,237 @@
/* nekobee DSSI software synthesizer plugin
*
* Copyright (C) 2004 Sean Bolton and others.
*
* Portions of this file may have come from Steve Brookes'
* nekobee, copyright (C) 1999 S. J. Brookes.
* Portions of this file may have come from Peter Hanappe's
* Fluidsynth, copyright (C) 2003 Peter Hanappe and others.
* Portions of this file may have come from Chris Cannam and Steve
* Harris's public domain DSSI example code.
*
* 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 (at your option) 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.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307, USA.
*/

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <pthread.h>

#include "nekobee.h"
#include "nekobee_synth.h"
#include "nekobee_voice.h"

/*
* nekobee_synth_all_voices_off
*
* stop processing all notes immediately
*/
void
nekobee_synth_all_voices_off(nekobee_synth_t *synth)
{
int i;
nekobee_voice_t *voice;

for (i = 0; i < synth->voices; i++) {
//voice = synth->voice[i];
voice = synth->voice;
if (_PLAYING(voice)) {
nekobee_voice_off(voice);
}
}
for (i = 0; i < 8; i++) synth->held_keys[i] = -1;
}

/*
* nekobee_synth_note_off
*
* handle a note off message
*/
void
nekobee_synth_note_off(nekobee_synth_t *synth, unsigned char key, unsigned char rvelocity)
{
int i, count = 0;
nekobee_voice_t *voice;

for (i = 0; i < synth->voices; i++) {
voice = synth->voice;
if (_PLAYING(voice)) {
XDB_MESSAGE(XDB_NOTE, " nekobee_synth_note_off: key %d rvel %d voice %d note id %d\n", key, rvelocity, i, voice->note_id);
nekobee_voice_note_off(synth, voice, key, 64);
count++;
}
}

if (!count)
nekobee_voice_remove_held_key(synth, key);

return;
(void)rvelocity;
}

/*
* nekobee_synth_all_notes_off
*
* put all notes into the released state
*/
void
nekobee_synth_all_notes_off(nekobee_synth_t* synth)
{
int i;
nekobee_voice_t *voice;

/* reset the sustain controller */
synth->cc[MIDI_CTL_SUSTAIN] = 0;
for (i = 0; i < synth->voices; i++) {
//voice = synth->voice[i];
voice = synth->voice;
if (_ON(voice) || _SUSTAINED(voice)) {
nekobee_voice_release_note(synth, voice);
}
}
}

/*
* nekobee_synth_note_on
*/
void
nekobee_synth_note_on(nekobee_synth_t *synth, unsigned char key, unsigned char velocity)
{
nekobee_voice_t* voice;

voice = synth->voice;
if (_PLAYING(synth->voice)) {
XDB_MESSAGE(XDB_NOTE, " nekobee_synth_note_on: retriggering mono voice on new key %d\n", key);
}

voice->note_id = synth->note_id++;

nekobee_voice_note_on(synth, voice, key, velocity);
}

/*
* nekobee_synth_update_volume
*/
void
nekobee_synth_update_volume(nekobee_synth_t* synth)
{
synth->cc_volume = (float)(synth->cc[MIDI_CTL_MSB_MAIN_VOLUME] * 128 +
synth->cc[MIDI_CTL_LSB_MAIN_VOLUME]) / 16256.0f;
if (synth->cc_volume > 1.0f)
synth->cc_volume = 1.0f;
/* don't need to check if any playing voices need updating, because it's global */
}

/*
* nekobee_synth_control_change
*/
void
nekobee_synth_control_change(nekobee_synth_t *synth, unsigned int param, signed int value)
{
synth->cc[param] = value;

switch (param) {

case MIDI_CTL_MSB_MAIN_VOLUME:
case MIDI_CTL_LSB_MAIN_VOLUME:
nekobee_synth_update_volume(synth);
break;

case MIDI_CTL_ALL_SOUNDS_OFF:
nekobee_synth_all_voices_off(synth);
break;