summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Zammit <damien@zamaudio.com>2017-10-25 21:38:08 +1100
committerDamien Zammit <damien@zamaudio.com>2017-10-25 21:42:59 +1100
commit33e6a73d4eb684f6a43c059c5087f2e7fbee7700 (patch)
tree54a04d6fc2140ecbdb25b8dc618037d3b0b9b8bd
parent4976cf204074c1dfaf344821e83e8d896b35107d (diff)
ZamSynth: Port to modern style DPF
Signed-off-by: Damien Zammit <damien@zamaudio.com>
-rw-r--r--Makefile2
-rw-r--r--plugins/ZamSynth/ZamSynthArtwork.cpp24
-rw-r--r--plugins/ZamSynth/ZamSynthPlugin.cpp18
-rw-r--r--plugins/ZamSynth/ZamSynthPlugin.hpp3
-rw-r--r--plugins/ZamSynth/ZamSynthUI.cpp22
-rw-r--r--plugins/ZamSynth/ZamSynthUI.hpp23
6 files changed, 43 insertions, 49 deletions
diff --git a/Makefile b/Makefile
index 7665af7..429c557 100644
--- a/Makefile
+++ b/Makefile
@@ -6,7 +6,7 @@ NAME = zam-plugins
VERSION = $(shell cat .version)
PLUGINS=ZamComp ZamCompX2 ZaMultiComp ZamTube ZamEQ2 ZamAutoSat ZamGEQ31 ZaMultiCompX2 ZamGate ZamGateX2 ZamHeadX2 ZaMaximX2 ZamDelay ZamDynamicEQ ZamPhono
-#ZamPiano ZamSFZ ZamChild670
+#ZamPiano ZamSFZ ZamChild670 ZamSynth
include Makefile.mk
diff --git a/plugins/ZamSynth/ZamSynthArtwork.cpp b/plugins/ZamSynth/ZamSynthArtwork.cpp
index c3e3892..2ba6bbd 100644
--- a/plugins/ZamSynth/ZamSynthArtwork.cpp
+++ b/plugins/ZamSynth/ZamSynthArtwork.cpp
@@ -2,7 +2,7 @@
#include "ZamSynthArtwork.hpp"
-static const unsigned char temp1[] = {
+static const unsigned char temp_knob_1[] = {
255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 0, 0, 0, 2, 0, 0, 0, 66, 0, 0, 0, 146, 0, 0, 0, 206, 3, 3, 3, 237, 5, 5, 5, 243, 6, 6, 6, 246,
6, 6, 6, 249, 5, 5, 5, 249, 3, 3, 3, 230, 0, 0, 0, 193, 0, 0, 0, 140, 0, 0, 0, 77, 0, 0, 0, 4, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0,
255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 0, 0, 0, 38, 0, 0, 0, 175, 5, 5, 5, 247, 14, 14, 14, 255, 20, 20, 20, 255, 25, 25, 25, 255, 29, 29, 29, 255, 31, 31, 31, 255, 33, 33, 33, 255,
@@ -88,9 +88,9 @@ static const unsigned char temp1[] = {
255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 0, 0, 0, 4, 0, 0, 0, 82, 0, 0, 0, 148, 0, 0, 0, 200, 1, 1, 1, 228, 3, 3, 3, 242, 3, 3, 3, 241,
3, 3, 3, 236, 2, 2, 2, 232, 1, 1, 1, 226, 0, 0, 0, 202, 0, 0, 0, 141, 0, 0, 0, 60, 0, 0, 0, 2, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0,
};
-const char* ZamSynthArtwork::knobData = (const char*)temp1;
+const char* ZamSynthArtwork::knobData = (const char*)temp_knob_1;
-static const unsigned char temp2[] = {
+static const unsigned char temp_smoothr_2[] = {
255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 0, 0, 0, 18, 0, 0, 0, 93, 0, 0, 0, 147, 0, 0, 0, 200, 0, 0, 0, 248, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255,
0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255,
0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255,
@@ -173,9 +173,9 @@ static const unsigned char temp2[] = {
0, 0, 0, 248, 0, 0, 0, 248, 0, 0, 0, 248, 0, 0, 0, 248, 0, 0, 0, 248, 0, 0, 0, 248, 0, 0, 0, 248, 0, 0, 0, 248, 0, 0, 0, 248, 0, 0, 0, 248, 0, 0, 0, 248, 0, 0, 0, 248, 0, 0, 0, 248, 0, 0, 0, 248, 0, 0, 0, 248, 0, 0, 0, 248, 0, 0, 0, 248, 0, 0, 0, 248, 0, 0, 0, 248, 0, 0, 0, 248, 0, 0, 0, 248,
0, 0, 0, 248, 0, 0, 0, 248, 0, 0, 0, 248, 0, 0, 0, 248, 0, 0, 0, 248, 0, 0, 0, 248, 0, 0, 0, 248, 0, 0, 0, 248, 0, 0, 0, 248, 0, 0, 0, 248, 0, 0, 0, 248, 0, 0, 0, 248, 0, 0, 0, 248, 0, 0, 0, 248, 0, 0, 0, 248, 0, 0, 0, 248, 0, 0, 0, 248, 0, 0, 0, 248, 0, 0, 0, 248, 0, 0, 0, 248, 0, 0, 0, 248,
0, 0, 0, 248, 0, 0, 0, 248, 0, 0, 0, 248, 0, 0, 0, 248, 0, 0, 0, 248, 0, 0, 0, 240, 0, 0, 0, 192, 0, 0, 0, 139, 0, 0, 0, 85, 0, 0, 0, 15, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0,};
-const char* ZamSynthArtwork::smoothrData = (const char*)temp2;
+const char* ZamSynthArtwork::smoothrData = (const char*)temp_smoothr_2;
-static const unsigned char temp3[] = {
+static const unsigned char temp_smoothy_3[] = {
255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 0, 0, 0, 18, 0, 0, 0, 93, 0, 0, 0, 147, 0, 0, 0, 200, 0, 0, 0, 248, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255,
0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255,
0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255,
@@ -258,9 +258,9 @@ static const unsigned char temp3[] = {
0, 0, 0, 248, 0, 0, 0, 248, 0, 0, 0, 248, 0, 0, 0, 248, 0, 0, 0, 248, 0, 0, 0, 248, 0, 0, 0, 248, 0, 0, 0, 248, 0, 0, 0, 248, 0, 0, 0, 248, 0, 0, 0, 248, 0, 0, 0, 248, 0, 0, 0, 248, 0, 0, 0, 248, 0, 0, 0, 248, 0, 0, 0, 248, 0, 0, 0, 248, 0, 0, 0, 248, 0, 0, 0, 248, 0, 0, 0, 248, 0, 0, 0, 248,
0, 0, 0, 248, 0, 0, 0, 248, 0, 0, 0, 248, 0, 0, 0, 248, 0, 0, 0, 248, 0, 0, 0, 248, 0, 0, 0, 248, 0, 0, 0, 248, 0, 0, 0, 248, 0, 0, 0, 248, 0, 0, 0, 248, 0, 0, 0, 248, 0, 0, 0, 248, 0, 0, 0, 248, 0, 0, 0, 248, 0, 0, 0, 248, 0, 0, 0, 248, 0, 0, 0, 248, 0, 0, 0, 248, 0, 0, 0, 248, 0, 0, 0, 248,
0, 0, 0, 248, 0, 0, 0, 248, 0, 0, 0, 248, 0, 0, 0, 248, 0, 0, 0, 248, 0, 0, 0, 240, 0, 0, 0, 192, 0, 0, 0, 139, 0, 0, 0, 85, 0, 0, 0, 15, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0,};
-const char* ZamSynthArtwork::smoothyData = (const char*)temp3;
+const char* ZamSynthArtwork::smoothyData = (const char*)temp_smoothy_3;
-static const unsigned char temp4[] = {
+static const unsigned char temp_toggleoff_4[] = {
0, 0, 0, 61, 0, 0, 0, 199, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 199, 0, 0, 0, 61, 0, 0, 0, 203, 0, 0, 0, 255, 0, 0, 0, 223, 0, 0, 0, 216, 0, 0, 0, 216, 0, 0, 0, 216, 0, 0, 0, 216, 0, 0, 0, 216, 0, 0, 0, 216,
0, 0, 0, 223, 0, 0, 0, 255, 0, 0, 0, 203, 0, 0, 0, 255, 0, 0, 0, 224, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 0, 0, 0, 224, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 216, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0,
255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 0, 0, 0, 216, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 216, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 0, 0, 0, 216, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 216, 255, 255, 255, 0,
@@ -274,9 +274,9 @@ static const unsigned char temp4[] = {
0, 0, 180, 190, 0, 0, 180, 190, 0, 0, 180, 190, 0, 0, 180, 190, 0, 0, 29, 221, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 33, 222, 0, 0, 180, 215, 0, 0, 180, 215, 0, 0, 180, 215, 0, 0, 180, 215, 0, 0, 180, 215, 0, 0, 180, 215, 0, 0, 180, 215, 0, 0, 180, 215, 0, 0, 33, 222, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 36, 228, 0, 0, 180, 241,
0, 0, 180, 241, 0, 0, 180, 241, 0, 0, 180, 241, 0, 0, 180, 241, 0, 0, 180, 241, 0, 0, 180, 241, 0, 0, 180, 241, 0, 0, 36, 228, 0, 0, 0, 255, 0, 0, 0, 203, 0, 0, 6, 255, 0, 0, 38, 227, 0, 0, 39, 223, 0, 0, 39, 223, 0, 0, 39, 223, 0, 0, 39, 223, 0, 0, 39, 223, 0, 0, 39, 223, 0, 0, 38, 227, 0, 0, 6, 255, 0, 0, 0, 203,
0, 0, 0, 61, 0, 0, 0, 203, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 203, 0, 0, 0, 61,};
-const char* ZamSynthArtwork::toggleoffData = (const char*)temp4;
+const char* ZamSynthArtwork::toggleoffData = (const char*)temp_toggleoff_4;
-static const unsigned char temp5[] = {
+static const unsigned char temp_toggleon_5[] = {
0, 0, 0, 81, 0, 0, 0, 222, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 222, 0, 0, 0, 81, 0, 0, 0, 225, 0, 6, 0, 254, 0, 39, 0, 224, 0, 39, 0, 223, 0, 39, 0, 223, 0, 39, 0, 223, 0, 39, 0, 223, 0, 39, 0, 223, 0, 39, 0, 223,
0, 39, 0, 224, 0, 6, 0, 254, 0, 0, 0, 225, 0, 0, 0, 255, 0, 36, 0, 224, 0, 180, 0, 238, 0, 180, 0, 238, 0, 180, 0, 238, 0, 180, 0, 238, 0, 180, 0, 238, 0, 180, 0, 238, 0, 180, 0, 238, 0, 180, 0, 238, 0, 36, 0, 224, 0, 0, 0, 255, 0, 0, 0, 255, 0, 32, 0, 222, 0, 180, 0, 214, 0, 180, 0, 214, 0, 180, 0, 214, 0, 180, 0, 214,
0, 180, 0, 214, 0, 180, 0, 214, 0, 180, 0, 214, 0, 180, 0, 214, 0, 32, 0, 222, 0, 0, 0, 255, 0, 0, 0, 255, 0, 29, 0, 221, 0, 179, 0, 189, 0, 179, 0, 189, 0, 179, 0, 189, 0, 179, 0, 189, 0, 179, 0, 189, 0, 179, 0, 189, 0, 179, 0, 189, 0, 179, 0, 189, 0, 29, 0, 221, 0, 0, 0, 255, 0, 0, 0, 255, 0, 25, 0, 221, 0, 180, 0, 164,
@@ -290,9 +290,9 @@ static const unsigned char temp5[] = {
255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 0, 0, 0, 216, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 216, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 0, 0, 0, 216, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 217, 255, 255, 255, 0,
255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 0, 0, 0, 217, 0, 0, 0, 255, 0, 0, 0, 225, 0, 0, 0, 254, 0, 0, 0, 217, 0, 0, 0, 216, 0, 0, 0, 216, 0, 0, 0, 216, 0, 0, 0, 216, 0, 0, 0, 216, 0, 0, 0, 216, 0, 0, 0, 217, 0, 0, 0, 254, 0, 0, 0, 225,
0, 0, 0, 83, 0, 0, 0, 225, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 225, 0, 0, 0, 83,};
-const char* ZamSynthArtwork::toggleonData = (const char*)temp5;
+const char* ZamSynthArtwork::toggleonData = (const char*)temp_toggleon_5;
-static const unsigned char temp6[] = {
+static const unsigned char temp_zamsynth_6[] = {
220, 220, 220, 189, 189, 189, 163, 163, 163, 150, 150, 150, 146, 146, 146, 146, 146, 146, 145, 145, 145, 145, 145, 145, 144, 144, 144, 142, 142, 142, 141, 141, 141, 141, 141, 141, 140, 140, 140, 138, 138, 138, 138, 138, 138, 138, 138, 138, 133, 133, 133, 133, 133, 133, 135, 135, 135, 134, 134, 134, 133, 133, 133,
131, 131, 131, 130, 130, 130, 130, 130, 130, 130, 130, 130, 128, 128, 128, 125, 125, 125, 124, 124, 124, 123, 123, 123, 123, 123, 123, 123, 123, 123, 121, 121, 121, 119, 119, 119, 118, 118, 118, 118, 118, 118, 115, 115, 115, 113, 113, 113, 114, 114, 114, 114, 114, 114, 112, 112, 112, 112, 112, 112, 107, 107, 107,
106, 106, 106, 107, 107, 107, 105, 105, 105, 105, 105, 105, 104, 104, 104, 102, 102, 102, 102, 102, 102, 104, 104, 104, 103, 103, 103, 100, 100, 100, 99, 99, 99, 100, 100, 100, 99, 99, 99, 99, 99, 99, 98, 98, 98, 100, 100, 100, 99, 99, 99, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
@@ -5294,5 +5294,5 @@ static const unsigned char temp6[] = {
107, 107, 107, 106, 106, 106, 107, 107, 107, 107, 107, 107, 106, 106, 106, 106, 106, 106, 105, 105, 105, 106, 106, 106, 109, 109, 109, 110, 110, 110, 111, 111, 111, 112, 112, 112, 111, 111, 111, 113, 113, 113, 115, 115, 115, 116, 116, 116, 115, 115, 115, 117, 117, 117, 119, 119, 119, 123, 123, 123, 123, 123, 123,
123, 123, 123, 123, 123, 123, 127, 127, 127, 126, 126, 126, 127, 127, 127, 129, 129, 129, 131, 131, 131, 133, 133, 133, 133, 133, 133, 135, 135, 135, 137, 137, 137, 137, 137, 137, 139, 139, 139, 139, 139, 139, 142, 142, 142, 143, 143, 143, 142, 142, 142, 143, 143, 143, 143, 143, 143, 147, 147, 147, 157, 157, 157,
};
-const char* ZamSynthArtwork::zamsynthData = (const char*)temp6;
+const char* ZamSynthArtwork::zamsynthData = (const char*)temp_zamsynth_6;
diff --git a/plugins/ZamSynth/ZamSynthPlugin.cpp b/plugins/ZamSynth/ZamSynthPlugin.cpp
index 8546a7a..e81ae72 100644
--- a/plugins/ZamSynth/ZamSynthPlugin.cpp
+++ b/plugins/ZamSynth/ZamSynthPlugin.cpp
@@ -138,12 +138,17 @@ void ZamSynthPlugin::loadProgram(uint32_t index)
}
for (int i = 0; i < MAX_ENV; i++) {
- env_y[i] = (sin(i*2.*M_PI/getSampleRate()*1000./2.)) > 0.f ? sin(i*2.*M_PI/d_getSampleRate()*1000./2.) : 0.f;
+ env_y[i] = (sin(i*2.*M_PI/getSampleRate()*1000./2.)) > 0.f ? sin(i*2.*M_PI/getSampleRate()*1000./2.) : 0.f;
}
/* reset filter values */
activate();
}
+String ZamSynthPlugin::getState(const char*) const
+{
+ return String("");
+}
+
void ZamSynthPlugin::setState(const char* key, const char* value)
{
if (strcmp(key, "waveform") == 0) {
@@ -173,10 +178,11 @@ void ZamSynthPlugin::setState(const char* key, const char* value)
}
}
-void ZamSynthPlugin::initStateKey(unsigned int index, String& key)
+void ZamSynthPlugin::initState(unsigned int index, String& key, String& defvalue)
{
if (index == 0) key = "waveform";
if (index == 1) key = "envelope";
+ defvalue = "";
}
// -----------------------------------------------------------------------
@@ -202,10 +208,10 @@ void ZamSynthPlugin::run(const float**, float** outputs, uint32_t frames,
float RD_0;
for (i = 0; i < midicount; i++) {
- int type = midievent[i].buf[0] & 0xF0;
- int chan = midievent[i].buf[0] & 0x0F;
- int num = midievent[i].buf[1];
- int vel = midievent[i].buf[2];
+ int type = midievent[i].data[0] & 0xF0;
+ int chan = midievent[i].data[0] & 0x0F;
+ int num = midievent[i].data[1];
+ int vel = midievent[i].data[2];
if (type == 0x90 && chan == 0x0) {
// NOTE ON
int newvoice = -1;
diff --git a/plugins/ZamSynth/ZamSynthPlugin.hpp b/plugins/ZamSynth/ZamSynthPlugin.hpp
index 9131e9d..e4163bc 100644
--- a/plugins/ZamSynth/ZamSynthPlugin.hpp
+++ b/plugins/ZamSynth/ZamSynthPlugin.hpp
@@ -118,7 +118,8 @@ protected:
void run(const float** inputs, float** outputs, uint32_t frames,
const MidiEvent* midievent, uint32_t midicount) override;
void setState(const char* key, const char* value) override;
- void initStateKey(unsigned int key, String& val) override;
+ String getState(const char* key) const override;
+ void initState(unsigned int index, String& key, String& defval) override;
// -------------------------------------------------------------------
private:
diff --git a/plugins/ZamSynth/ZamSynthUI.cpp b/plugins/ZamSynth/ZamSynthUI.cpp
index 6933d5d..702ef1f 100644
--- a/plugins/ZamSynth/ZamSynthUI.cpp
+++ b/plugins/ZamSynth/ZamSynthUI.cpp
@@ -25,6 +25,8 @@ START_NAMESPACE_DISTRHO
ZamSynthUI::ZamSynthUI()
: UI()
{
+ setSize(ZamSynthArtwork::zamsynthWidth, ZamSynthArtwork::zamsynthHeight);
+
// background
fImgBackground = Image(ZamSynthArtwork::zamsynthData, ZamSynthArtwork::zamsynthWidth, ZamSynthArtwork::zamsynthHeight, GL_BGR);
@@ -73,10 +75,10 @@ ZamSynthUI::ZamSynthUI()
}
// toggle
- fToggleGraph = new ImageToggle(this, toggleonImage, toggleoffImage);
+ fToggleGraph = new ImageSwitch(this, toggleonImage, toggleoffImage);
fToggleGraph->setAbsolutePos(300, 33);
fToggleGraph->setCallback(this);
- fToggleGraph->setValue(0.f);
+ fToggleGraph->setDown(false);
// set default values
programLoaded(0);
@@ -125,7 +127,7 @@ void ZamSynthUI::parameterChanged(uint32_t index, float value)
fKnobSpeed->setValue(value);
break;
case ZamSynthPlugin::paramGraph:
- fToggleGraph->setValue(value);
+ fToggleGraph->setDown(value > 0.5);
break;
}
}
@@ -176,7 +178,7 @@ void ZamSynthUI::imageButtonClicked(ImageButton*, int)
}
float *gr;
- gr = (fToggleGraph->getValue() == 1.f) ? env_y : wave_y;
+ gr = fToggleGraph->isDown() ? env_y : wave_y;
gaussiansmooth(wavesmooth, xs, gr, AREAHEIGHT, 4);
memcpy(gr, wavesmooth, AREAHEIGHT*sizeof(float));
@@ -188,17 +190,15 @@ void ZamSynthUI::imageButtonClicked(ImageButton*, int)
strcat(tmp, wavestr);
}
- if (fToggleGraph->getValue() == 1.f)
+ if (fToggleGraph->isDown())
setState("envelope", tmp);
else
setState("waveform", tmp);
}
-void ZamSynthUI::imageToggleClicked(ImageToggle*, int)
+void ZamSynthUI::imageSwitchClicked(ImageSwitch* tog, bool down)
{
- float toggle = fToggleGraph->getValue();
- fToggleGraph->setValue(toggle);
- setParameterValue(ZamSynthPlugin::paramGraph, toggle);
+ setParameterValue(tog->getId(), down ? 1.f : 0.f);
}
void ZamSynthUI::gaussiansmooth(float* smoothed, float* xs, float* ys, int n, int radius)
@@ -262,7 +262,7 @@ bool ZamSynthUI::onMotion(const MotionEvent& ev)
if (y < 10) y = 10;
float *gr;
- if (fToggleGraph->getValue() == 0.f) {
+ if (!fToggleGraph->isDown()) {
gr = wave_y;
if (y > fCanvasArea.getHeight()+10)
y = fCanvasArea.getHeight()+10;
@@ -306,7 +306,7 @@ void ZamSynthUI::onDisplay()
glLineWidth(2);
float *gr;
- gr = (fToggleGraph->getValue() == 1.f) ? env_y : wave_y;
+ gr = fToggleGraph->isDown() ? env_y : wave_y;
int i;
glColor4f(0.235f, 1.f, 0.235f, 1.0f);
diff --git a/plugins/ZamSynth/ZamSynthUI.hpp b/plugins/ZamSynth/ZamSynthUI.hpp
index dcae528..5c2368e 100644
--- a/plugins/ZamSynth/ZamSynthUI.hpp
+++ b/plugins/ZamSynth/ZamSynthUI.hpp
@@ -20,10 +20,7 @@
#include "DistrhoUI.hpp"
-#include "ImageButton.hpp"
-#include "ImageKnob.hpp"
-#include "ImageToggle.hpp"
-
+#include "ImageWidgets.hpp"
#include "ZamSynthArtwork.hpp"
#define AREAHEIGHT 250
@@ -31,7 +28,7 @@
using DGL::Image;
using DGL::ImageButton;
using DGL::ImageKnob;
-using DGL::ImageToggle;
+using DGL::ImageSwitch;
START_NAMESPACE_DISTRHO
@@ -40,7 +37,7 @@ START_NAMESPACE_DISTRHO
class ZamSynthUI : public UI,
public ImageButton::Callback,
public ImageKnob::Callback,
- public ImageToggle::Callback
+ public ImageSwitch::Callback
{
public:
ZamSynthUI();
@@ -49,16 +46,6 @@ protected:
// -------------------------------------------------------------------
// Information
- uint d_getWidth() const noexcept override
- {
- return ZamSynthArtwork::zamsynthWidth;
- }
-
- uint d_getHeight() const noexcept override
- {
- return ZamSynthArtwork::zamsynthHeight;
- }
-
void gaussiansmooth(float* smoothed, float* xs, float* ys, int n, int radius);
// -------------------------------------------------------------------
@@ -76,7 +63,7 @@ protected:
void imageKnobValueChanged(ImageKnob* knob, float value) override;
void imageButtonClicked(ImageButton* button, int) override;
- void imageToggleClicked(ImageToggle* toggle, int) override;
+ void imageSwitchClicked(ImageSwitch* tog, bool down) override;
void onDisplay() override;
bool onMouse(const MouseEvent&) override;
@@ -86,7 +73,7 @@ private:
Image fImgBackground;
ScopedPointer<ImageKnob> fKnobGain, fKnobSpeed;
ScopedPointer<ImageButton> fButtonSmooth;
- ScopedPointer<ImageToggle> fToggleGraph;
+ ScopedPointer<ImageSwitch> fToggleGraph;
float wave_y[AREAHEIGHT];
float env_y[AREAHEIGHT];
bool fGraph;