Compare commits
178 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eadaf198ba | ||
|
|
97547476e4 | ||
|
|
35e42dc653 | ||
|
|
ce296d2698 | ||
|
|
fd0369dc7c | ||
|
|
2c921df204 | ||
|
|
ee2fcd181e | ||
|
|
2eb4e97810 | ||
|
|
907a3d0ed9 | ||
|
|
5dc5f0652f | ||
|
|
5a44076e4f | ||
|
|
0bb0f6db71 | ||
|
|
dcf66adfa9 | ||
|
|
0886ba00c1 | ||
|
|
e12de97fab | ||
|
|
59753a61dc | ||
|
|
ff0be8230e | ||
|
|
07cfd70941 | ||
|
|
2523b27205 | ||
|
|
530dd397c5 | ||
|
|
158fd081a5 | ||
|
|
a8bac07f68 | ||
|
|
87bb59f43a | ||
|
|
cdeb821deb | ||
|
|
ce463b29d8 | ||
|
|
159bca158e | ||
|
|
6ae750c4fb | ||
|
|
5f21c62a2f | ||
|
|
08b20b398f | ||
|
|
1be664e82f | ||
|
|
3ab55054c1 | ||
|
|
97b8c9fd6d | ||
|
|
211df27cf8 | ||
|
|
dfe28ac81d | ||
|
|
3da458d370 | ||
|
|
ba04930133 | ||
|
|
18f137636d | ||
|
|
eba8bbe5aa | ||
|
|
7a6e3b159c | ||
|
|
cc85da9c71 | ||
|
|
9586f6cd31 | ||
|
|
4a7ab848e7 | ||
|
|
2703e79d39 | ||
|
|
dbab804d52 | ||
|
|
c3f82416f5 | ||
|
|
145b41cb6c | ||
|
|
26d1db9e4f | ||
|
|
cc311f4f18 | ||
|
|
d85e83c89e | ||
|
|
55b9b08230 | ||
|
|
400e221a4f | ||
|
|
5b93c91bfe | ||
|
|
cbd07a9709 | ||
|
|
def4917a07 | ||
|
|
e9c0ed8b38 | ||
|
|
400a7d41f8 | ||
|
|
40a9d06e4c | ||
|
|
e820ce0cc4 | ||
|
|
ebc603143e | ||
|
|
c74290d8e1 | ||
|
|
295e932bf1 | ||
|
|
1a65deb8d5 | ||
|
|
4509c14bbc | ||
|
|
d7f10eb509 | ||
|
|
b1a8d69dba | ||
|
|
20769ace01 | ||
|
|
2633bac5d8 | ||
|
|
af1d3a2906 | ||
|
|
06fd3eee66 | ||
|
|
acb1c1e273 | ||
|
|
7bf55352b8 | ||
|
|
6a1d1de390 | ||
|
|
b798d6ee39 | ||
|
|
ba810bf4f8 | ||
|
|
24a1c2718b | ||
|
|
31a635839a | ||
|
|
d7b3f7a3d6 | ||
|
|
6512696240 | ||
|
|
f1359d18e4 | ||
|
|
85ce157bb8 | ||
|
|
6daaf47cd8 | ||
|
|
3a849de954 | ||
|
|
a06c5dc07e | ||
|
|
29124043ba | ||
|
|
e93e6bd16b | ||
|
|
f7ddd5e0d6 | ||
|
|
6a082acc53 | ||
|
|
1abcc82829 | ||
|
|
c964d38c17 | ||
|
|
12c2ccc87f | ||
|
|
a6d07fd802 | ||
|
|
215683b167 | ||
|
|
741482afd4 | ||
|
|
991527418a | ||
|
|
96317d5ac5 | ||
|
|
d24cc97f5d | ||
|
|
cac7e74d71 | ||
|
|
74583e9a7c | ||
|
|
03c3c48ecf | ||
|
|
aa2cc7bbb1 | ||
|
|
ec14a41869 | ||
|
|
9778dc47c3 | ||
|
|
71c3a1e66f | ||
|
|
bdb35ddf54 | ||
|
|
4ca140ab48 | ||
|
|
d2f821eee1 | ||
|
|
e607c6cf37 | ||
|
|
dc66db841a | ||
|
|
e80683aea2 | ||
|
|
b7d2d7d1c5 | ||
|
|
cd5d7387f3 | ||
|
|
8a39a178c6 | ||
|
|
40ebcfaf16 | ||
|
|
de68d0449f | ||
|
|
d280bf1ca6 | ||
|
|
b245e1bac6 | ||
|
|
8d7fffb6d1 | ||
|
|
f8e35ff685 | ||
|
|
3f717a51cd | ||
|
|
90df427200 | ||
|
|
322c59032e | ||
|
|
1b1919649e | ||
|
|
e7c7efe857 | ||
|
|
17b067f853 | ||
|
|
8ec3d6579c | ||
|
|
5bd6f8fc2c | ||
|
|
c61c2372ae | ||
|
|
49b7f42012 | ||
|
|
157fba0380 | ||
|
|
904a30bb38 | ||
|
|
8e445bb408 | ||
|
|
eb48d0b9d2 | ||
|
|
baa3829263 | ||
|
|
79554a99ce | ||
|
|
4740bef10f | ||
|
|
968d2947a7 | ||
|
|
e2cb03ab32 | ||
|
|
ce5fe3fe0c | ||
|
|
966fc748af | ||
|
|
709406f3ef | ||
|
|
ce522227c7 | ||
|
|
7d13b2a7ea | ||
|
|
d4c86b3a60 | ||
|
|
ca23f2c94c | ||
|
|
bfc285ad0f | ||
|
|
4e5f2438d3 | ||
|
|
10aac46dde | ||
|
|
e802d05ad3 | ||
|
|
95f4ad698a | ||
|
|
9f3bdd002d | ||
|
|
0cfcd806b1 | ||
|
|
c0ac97d4e2 | ||
|
|
84e9ab0e01 | ||
|
|
2c6afe730d | ||
|
|
79912510b4 | ||
|
|
8bdeea7728 | ||
|
|
22de8a00ab | ||
|
|
5cf9c021d8 | ||
|
|
2d4798abf7 | ||
|
|
e427e6f4d3 | ||
|
|
886f01c1e4 | ||
|
|
1c4ff62baa | ||
|
|
edbea6ff43 | ||
|
|
c4b1fbff77 | ||
|
|
68d05bd1db | ||
|
|
73f9a21a02 | ||
|
|
66c5a966a6 | ||
|
|
e7ce11164b | ||
|
|
f95804026c | ||
|
|
5c5d0b3709 | ||
|
|
146745829f | ||
|
|
a207b8ec62 | ||
|
|
a38ab64870 | ||
|
|
93ebb6b65c | ||
|
|
87908f7c9f | ||
|
|
f9d24bc6b9 | ||
|
|
48100b42e1 | ||
|
|
0816a4d0ce |
@@ -6,3 +6,7 @@ syntax: glob
|
|||||||
*.o
|
*.o
|
||||||
*.patch
|
*.patch
|
||||||
*.diff
|
*.diff
|
||||||
|
*.m
|
||||||
|
*.orig
|
||||||
|
knob.h
|
||||||
|
gdigi
|
||||||
|
|||||||
10
AUTHORS
10
AUTHORS
@@ -1 +1,11 @@
|
|||||||
Tomasz Moń <desowin@gmail.com>
|
Tomasz Moń <desowin@gmail.com>
|
||||||
|
Stephen Rigler <riglersc@gmail.com>
|
||||||
|
Jaco Kroon <jaco@kroon.co.za>
|
||||||
|
Rafael Moreno <laocanfei@yahoo.com>
|
||||||
|
Andrew O. Shadoura <bugzilla@tut.by>
|
||||||
|
Andreas Karajannis <aakara13@googlemail.com>
|
||||||
|
Miklos Aubert <miklos.aubert@gmail.com>
|
||||||
|
Jonathan A. Tice <jonandtice@gmail.com>
|
||||||
|
John Hammen <jhammen@gmail.com>
|
||||||
|
Ahmed Toulan <thelinuxer@gmail.com>
|
||||||
|
Tim LaBerge <tlaberge@visi.com>
|
||||||
|
|||||||
92
HACKING
Normal file
92
HACKING
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
In general everything brings down to figure out:
|
||||||
|
-ID
|
||||||
|
-Position
|
||||||
|
-Possible value range
|
||||||
|
|
||||||
|
There seems to be three possible ways to figure that out.
|
||||||
|
1) Use USB sniffer together with X-Edit
|
||||||
|
Once you set up X-Edit and usb sniffer, set some option.
|
||||||
|
USB sniffer should report something like this being sent to device:
|
||||||
|
(all numbers here are hex)
|
||||||
|
04 F0 00 00 04 10 00 5E 04 02 41 00 04 30 09 00 07 00 34 F7
|
||||||
|
|
||||||
|
MIDI data is transferred over USB using 32-bit USB-MIDI Event Packets.
|
||||||
|
Byte 0 is Cable Number (high nibble) and Code Index Number (low nibble).
|
||||||
|
Bytes 1, 2 and 3 are data.
|
||||||
|
Every bulk transfer on USB MIDI endpoint contains atleast one such packet
|
||||||
|
(those are sent one after each other).
|
||||||
|
In case of Digitech devices, the Cable Number seems to be 0 (correct me,
|
||||||
|
if I'm wrong).
|
||||||
|
There are three different Code Index Numbers that are being used in this
|
||||||
|
particular case:
|
||||||
|
0x4 - SysEx starts or continues (Byte 1, 2 and 3 from this packet are
|
||||||
|
part of our MIDI message)
|
||||||
|
0x5 - SysEx ends with following single byte (we just need to take Byte 1
|
||||||
|
from this packet)
|
||||||
|
0x6 - SysEx ends with following two bytes (we just need to take Byte 1 and 2
|
||||||
|
from this packet)
|
||||||
|
0x7 - SysEx ends with following three bytes (we need to take Byte 1, 2 and 3
|
||||||
|
from this packet)
|
||||||
|
|
||||||
|
Unused bytes in USB-MIDI packets are supposed to be 0.
|
||||||
|
|
||||||
|
To get SysEx command out of it, apply above rules, so we have:
|
||||||
|
F0 00 00 10 00 5E 02 41 00 30 09 00 00 34 F7
|
||||||
|
|
||||||
|
SysEx message format seems to be formed like this:
|
||||||
|
SysEx start byte - F0
|
||||||
|
Manufacturer ID - 00 00 10
|
||||||
|
Device ID - 00
|
||||||
|
Family ID - 5E (RP)
|
||||||
|
Product ID - 02 (RP250)
|
||||||
|
Procedure - 41 (see MessageID in gdigi.h)
|
||||||
|
|
||||||
|
As MIDI messages must not contain bytes with MSB bit set, Digitech
|
||||||
|
devices use packing system.
|
||||||
|
First byte contains MSB bits from following 7 bytes (this scheme
|
||||||
|
continues as many times as needed) (see pack_data() and unpack_message() in
|
||||||
|
gdigi.c for details).
|
||||||
|
|
||||||
|
Assuming message has been unpacked, the meaning of next bytes:
|
||||||
|
ID - in this example 30 09
|
||||||
|
Position - in this example 00
|
||||||
|
Value - in this example 00 (can be more bytes long, see below)
|
||||||
|
Checksum - to calculate it, XOR all bytes (of packed message)
|
||||||
|
Every message ends with F7
|
||||||
|
|
||||||
|
So for above example:
|
||||||
|
ID = 3009 (hex) = 12297 (decimal)
|
||||||
|
Position = 0
|
||||||
|
One of possible values is 0. Usually value range is 0 to 99,
|
||||||
|
albeit in some cases it's different - you have to check what values can
|
||||||
|
X-Edit assign (there doesn't seem to be any sanity check in firmware)
|
||||||
|
This is especially needed for IDs that set some effect type.
|
||||||
|
|
||||||
|
2) Save preset patch
|
||||||
|
Patches seem to be simple XML files.
|
||||||
|
Every parameter is written like this:
|
||||||
|
<Param>
|
||||||
|
<ID>65</ID>
|
||||||
|
<Position>2</Position>
|
||||||
|
<Value>0</Value>
|
||||||
|
<Name>Pickup Enable</Name>
|
||||||
|
<Text>Off</Text>
|
||||||
|
</Param>
|
||||||
|
ID is ID, Position is Position and Value is one of possible values.
|
||||||
|
To get all possible values you can:
|
||||||
|
do
|
||||||
|
change value to next one possible in X-Edit
|
||||||
|
(for example next effect type)
|
||||||
|
save new patch
|
||||||
|
check patch file and note the change
|
||||||
|
while you don't have all possible values
|
||||||
|
3) Use gdigi
|
||||||
|
After starting gdigi turn the knobs on your device.
|
||||||
|
Check out console output, you should notice something like this:
|
||||||
|
** Message: Received parameter change ID: 210 Position: 4 Value: 0
|
||||||
|
ID is ID, Position is Position and Value is one of possible values.
|
||||||
|
To get all possible values keep turning knobs and watch the output.
|
||||||
|
If you change effect type usually there's more messages - where,
|
||||||
|
usually the first one is type change, and rest are default values.
|
||||||
|
This way you *CANNOT* gather all information (there're X-Edit only
|
||||||
|
controlled values, check device manual for more information).
|
||||||
48
Makefile
48
Makefile
@@ -1,24 +1,44 @@
|
|||||||
CC = gcc
|
CC = gcc
|
||||||
CFLAGS = `pkg-config --cflags glib-2.0 gtk+-2.0` -Wall -g
|
EXTRA_CFLAGS ?=
|
||||||
OFLAG = -o
|
EXTRA_LDFLAGS ?=
|
||||||
LIBS = `pkg-config --libs glib-2.0 gtk+-2.0 libusb`
|
CFLAGS := $(shell pkg-config --cflags glib-2.0 gio-2.0 gtk+-3.0 libxml-2.0) -Wall -g -ansi -std=c99 $(EXTRA_CFLAGS)
|
||||||
|
LDFLAGS = $(EXTRA_LDFLAGS) -Wl,--as-needed
|
||||||
|
LDADD := $(shell pkg-config --libs glib-2.0 gio-2.0 gtk+-3.0 gthread-2.0 alsa libxml-2.0) -lexpat
|
||||||
|
OBJECTS = gdigi.o gui.o effects.o preset.o gtkknob.o preset_xml.o
|
||||||
|
DEPFILES = $(foreach m,$(OBJECTS:.o=),.$(m).m)
|
||||||
|
|
||||||
.SUFFIXES : .o .c
|
.PHONY : clean distclean all
|
||||||
.c.o :
|
%.o : %.c
|
||||||
$(CC) $(CFLAGS) -c $<
|
$(CC) $(CFLAGS) -c $<
|
||||||
|
|
||||||
|
.%.m : %.c
|
||||||
|
$(CC) $(CFLAGS) -M -MF $@ -MG $<
|
||||||
|
|
||||||
all: gdigi
|
all: gdigi
|
||||||
|
|
||||||
gdigi: gdigi.o tests.o gui.o
|
gdigi: $(OBJECTS)
|
||||||
$(CC) $(LIBS) $(OFLAG) gdigi gdigi.o tests.o gui.o
|
$(CC) $(LDFLAGS) -o $@ $+ $(LDADD)
|
||||||
|
|
||||||
gdigi.o: gdigi.c
|
|
||||||
|
|
||||||
tests.o: tests.c
|
|
||||||
|
|
||||||
gui.o: gui.c
|
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm *.o
|
rm -f *.o
|
||||||
|
|
||||||
|
distclean : clean
|
||||||
|
rm -f .*.m
|
||||||
|
rm -f gdigi
|
||||||
|
|
||||||
|
install: gdigi
|
||||||
|
install gdigi $(DESTDIR)/usr/bin
|
||||||
|
install gdigi.desktop $(DESTDIR)/usr/share/applications/
|
||||||
|
|
||||||
|
NODEP_TARGETS := clean distclean
|
||||||
|
depinc := 1
|
||||||
|
ifneq (,$(filter $(NODEP_TARGETS),$(MAKECMDGOALS)))
|
||||||
|
depinc := 0
|
||||||
|
endif
|
||||||
|
ifneq (,$(fitler-out $(NODEP_TARGETS),$(MAKECMDGOALS)))
|
||||||
|
depinc := 1
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(depinc),1)
|
||||||
|
-include $(DEPFILES)
|
||||||
|
endif
|
||||||
|
|||||||
13
README
13
README
@@ -1,5 +1,12 @@
|
|||||||
Requirments: libusb, gtk+, glib
|
Requirments: alsa, gtk+, glib, expat, libxml-2
|
||||||
|
|
||||||
Getting started guide:
|
Getting started guide:
|
||||||
-disable snd_usb_audio (when it's loaded gdigi can't claim interface)
|
-to compile: make
|
||||||
-make && ./gdigi
|
-to run: ./gdigi
|
||||||
|
|
||||||
|
Commandline options:
|
||||||
|
--device (-d)
|
||||||
|
|
||||||
|
Example:
|
||||||
|
gdigi -d hw:1,0,0
|
||||||
|
gdigi --device=hw:1,0,0
|
||||||
|
|||||||
17
TODO
17
TODO
@@ -1,12 +1,5 @@
|
|||||||
-figure out all magic commands
|
-make complete gui (expression pedal settings, usb settings, effect level, preset level)
|
||||||
-fix usb handling code
|
-handling presets (saving, exporting to xml patches)
|
||||||
-make complete gui
|
-buildsystem (install knob.png to share dir, don't use inline knob pixbuf)
|
||||||
-amp/cabinet models
|
-various fixes to MIDI IN messages handling
|
||||||
-expression pedal options
|
-optimizations
|
||||||
-audio setup options
|
|
||||||
-tone library
|
|
||||||
-effects library
|
|
||||||
-effects level
|
|
||||||
-handling presets (loading, saving, exporting/importing to/from xml patches)
|
|
||||||
-buildsystem
|
|
||||||
-figure out how to get current device settings, start gui with proper values
|
|
||||||
|
|||||||
127
effects.h
Normal file
127
effects.h
Normal file
@@ -0,0 +1,127 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2009 Tomasz Moń <desowin@gmail.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; under version 3 of the License.
|
||||||
|
*
|
||||||
|
* 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, see <http://www.gnu.org/licenses>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef GDIGI_EFFECTS_H
|
||||||
|
#define GDIGI_EFFECTS_H
|
||||||
|
|
||||||
|
#include <glib.h>
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
VALUE_TYPE_PLAIN = 0, /**< value displayed directly */
|
||||||
|
VALUE_TYPE_SUFFIX = 1 << 0, /**< use suffix for displaying */
|
||||||
|
VALUE_TYPE_OFFSET = 1 << 1, /**< use value offset */
|
||||||
|
VALUE_TYPE_STEP = 1 << 2, /**< use value step different than 1 */
|
||||||
|
VALUE_TYPE_LABEL = 1 << 3, /**< use value labels (overrides any other option) */
|
||||||
|
VALUE_TYPE_EXTRA = 1 << 4, /**< use extra values */
|
||||||
|
VALUE_TYPE_DECIMAL= 1 << 5, /**< display decimal places */
|
||||||
|
VALUE_TYPE_NONE = 1 << 6, /**< no value displayed */
|
||||||
|
} ValueType;
|
||||||
|
|
||||||
|
typedef struct _EffectValues {
|
||||||
|
gdouble min; /**< Minumum value */
|
||||||
|
gdouble max; /**< Maximum value */
|
||||||
|
gint type; /**< value type bitmask (ValueType) */
|
||||||
|
|
||||||
|
GStrv labels; /**< value labels */
|
||||||
|
gint offset; /**< value offset */
|
||||||
|
gdouble step; /**< value step */
|
||||||
|
gchar *suffix; /**< value suffix */
|
||||||
|
|
||||||
|
struct _EffectValues *extra;
|
||||||
|
/**< additional value range,
|
||||||
|
use it when there're different range types */
|
||||||
|
gint decimal; /**< amount of decimal places to display */
|
||||||
|
} EffectValues;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
gchar *label; /**< Parameter name */
|
||||||
|
guint id; /**< ID (to set parameter) */
|
||||||
|
guint position; /**< position */
|
||||||
|
EffectValues *values; /**< valid parameter values */
|
||||||
|
} EffectSettings;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
guint type; /**< value (type) */
|
||||||
|
gchar *label; /**< Effect name */
|
||||||
|
EffectSettings *settings; /**< possible parameters */
|
||||||
|
gint settings_amt; /**< possible parameters length */
|
||||||
|
} EffectGroup;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
gchar *label; /**< Group label */
|
||||||
|
guint id; /**< ID to set effect on/off, or if it isn't on/off group then -1 */
|
||||||
|
guint type; /**< ID to set effect type */
|
||||||
|
guint position; /**< position */
|
||||||
|
EffectGroup *group; /**< possible effect types */
|
||||||
|
gint group_amt; /**< possible effect types length */
|
||||||
|
} Effect;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
gchar *label; /**< base effect name */
|
||||||
|
Effect *effect; /**< list of supported effects */
|
||||||
|
gint amt; /**< list of supported effects length */
|
||||||
|
} EffectList;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
guint type; /**< ID to set effect type */
|
||||||
|
guint position;
|
||||||
|
EffectGroup *group;
|
||||||
|
gint group_amt;
|
||||||
|
} ModifierGroup;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
gchar *name;
|
||||||
|
EffectList *effects;
|
||||||
|
gint n_effects;
|
||||||
|
gint n_rows;
|
||||||
|
} EffectPage;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
gchar *name;
|
||||||
|
PresetBank bank;
|
||||||
|
} Banks;
|
||||||
|
|
||||||
|
enum product_id {
|
||||||
|
RP150 = 1,
|
||||||
|
RP250 = 2,
|
||||||
|
GNX4 = 3,
|
||||||
|
GNX3000 = 4,
|
||||||
|
RP500 = 5,
|
||||||
|
RP1000 = 6,
|
||||||
|
RP155 = 7,
|
||||||
|
RP255 = 8,
|
||||||
|
RP355 = 9,
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
gchar *name;
|
||||||
|
unsigned char family_id;
|
||||||
|
unsigned char product_id;
|
||||||
|
EffectPage *pages;
|
||||||
|
gint n_pages;
|
||||||
|
Banks *banks;
|
||||||
|
gint n_banks;
|
||||||
|
} Device;
|
||||||
|
|
||||||
|
ModifierGroup *modifier_linkable_list();
|
||||||
|
void modifier_group_free(ModifierGroup *modifier_group);
|
||||||
|
void get_values_info(EffectValues *values,
|
||||||
|
gdouble *min, gdouble *max, gboolean *custom);
|
||||||
|
gboolean get_device_info(unsigned char device_id, unsigned char family_id,
|
||||||
|
unsigned char product_id,
|
||||||
|
Device **device);
|
||||||
|
|
||||||
|
#endif /* GDIGI_EFFECTS_H */
|
||||||
74
gdigi.1
Normal file
74
gdigi.1
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
.\" Hey, EMACS: -*- nroff -*-
|
||||||
|
.\" First parameter, NAME, should be all caps
|
||||||
|
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
|
||||||
|
.\" other parameters are allowed: see man(7), man(1)
|
||||||
|
.TH GDIGI 1 "October 07, 2010"
|
||||||
|
.\" Please adjust this date whenever revising the manpage.
|
||||||
|
.\"
|
||||||
|
.\" Some roff macros, for reference:
|
||||||
|
.\" .nh disable hyphenation
|
||||||
|
.\" .hy enable hyphenation
|
||||||
|
.\" .ad l left justify
|
||||||
|
.\" .ad b justify to both left and right margins
|
||||||
|
.\" .nf disable filling
|
||||||
|
.\" .fi enable filling
|
||||||
|
.\" .br insert line break
|
||||||
|
.\" .sp <n> insert n+1 empty lines
|
||||||
|
.\" for manpage-specific macros, see man(7)
|
||||||
|
.SH NAME
|
||||||
|
gdigi \- utility to control DigiTech effect pedals
|
||||||
|
.SH SYNOPSIS
|
||||||
|
.B gdigi
|
||||||
|
.RI [OPTION...]
|
||||||
|
.SH DESCRIPTION
|
||||||
|
gdigi is a tool aimed to provide X-Edit functionality to Linux users
|
||||||
|
.PP
|
||||||
|
Supported devices:
|
||||||
|
.IP \(bu
|
||||||
|
RP250
|
||||||
|
.IP \(bu
|
||||||
|
RP255
|
||||||
|
.IP \(bu
|
||||||
|
RP355
|
||||||
|
.IP \(bu
|
||||||
|
RP500
|
||||||
|
.IP \(bu
|
||||||
|
RP1000
|
||||||
|
.IP \(bu
|
||||||
|
GNX3000
|
||||||
|
.IP \(bu
|
||||||
|
GNX4K
|
||||||
|
.PP
|
||||||
|
.SH OPTIONS
|
||||||
|
These programs follow the usual GNU command line syntax, with long
|
||||||
|
options starting with two dashes (`\-').
|
||||||
|
A summary of options is included below.
|
||||||
|
For a complete description, see the Info files.
|
||||||
|
.TP
|
||||||
|
.B \-?, \-\-help
|
||||||
|
Show summary of options.
|
||||||
|
.TP
|
||||||
|
.B \-\-help\-all
|
||||||
|
Show all help options.
|
||||||
|
.TP
|
||||||
|
.B \-\-help\-gtk
|
||||||
|
Show GTK+ options.
|
||||||
|
.TP
|
||||||
|
.B \-\-display=\fIDISPLAY\fR
|
||||||
|
X display to use.
|
||||||
|
.TP
|
||||||
|
.B \-d, \-\-device
|
||||||
|
MIDI device port to use.
|
||||||
|
.SH AUTHOR
|
||||||
|
gdigi was written by Tomasz Moń <desowin@gmail.com>.
|
||||||
|
.PP
|
||||||
|
Send comments, bug reports and patches to gdigi
|
||||||
|
mailinglist at Google Groups.
|
||||||
|
.PP
|
||||||
|
This manual page was written by Andrew O. Shadoura <bugzilla@tut.by>,
|
||||||
|
for the Debian project (but may be used by others).
|
||||||
|
.PP
|
||||||
|
Permission is granted to copy, distribute and/or modify this document under the
|
||||||
|
terms of the GNU General Public License as published by the Free Software
|
||||||
|
Foundation, under version 3 of the License.
|
||||||
|
|
||||||
7
gdigi.desktop
Normal file
7
gdigi.desktop
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
[Desktop Entry]
|
||||||
|
Version=1.0
|
||||||
|
Type=Application
|
||||||
|
Name=gdigi
|
||||||
|
Exec=gdigi
|
||||||
|
Categories=GNOME;Audio;AudioVideo;
|
||||||
|
|
||||||
@@ -14,16 +14,26 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses>.
|
* along with this program. If not, see <http://www.gnu.org/licenses>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "gdigi.h"
|
#ifndef GDIGI_XML_H
|
||||||
|
#define GDIGI_XML_H
|
||||||
|
|
||||||
void test_wah(struct usb_dev_handle *handle);
|
#include <glib.h>
|
||||||
void test_compressor(struct usb_dev_handle *handle);
|
#include "effects.h"
|
||||||
void test_dist(struct usb_dev_handle *handle);
|
typedef struct {
|
||||||
void test_presets(struct usb_dev_handle *handle);
|
guint type;
|
||||||
void test_pickups(struct usb_dev_handle *handle);
|
gchar *label;
|
||||||
void test_eq(struct usb_dev_handle *handle);
|
} XmlLabel;
|
||||||
void test_noisegate(struct usb_dev_handle *handle);
|
|
||||||
void test_chorusfx(struct usb_dev_handle *handle);
|
typedef struct {
|
||||||
void test_delay(struct usb_dev_handle *handle);
|
guint id;
|
||||||
void test_reverb(struct usb_dev_handle *handle);
|
guint position;
|
||||||
void test_all(struct usb_dev_handle *handle);
|
gchar *label;
|
||||||
|
EffectValues *values;
|
||||||
|
XmlLabel *xml_labels; /* 'type' id's have a label group. */
|
||||||
|
guint xml_labels_amt;
|
||||||
|
} XmlSettings;
|
||||||
|
|
||||||
|
// XmlSettings *get_xml_settings(guint id, guint position);
|
||||||
|
// gchar *get_xml_label(guint id, guint position, gint type);
|
||||||
|
|
||||||
|
#endif /* GDIGI_XML_H */
|
||||||
915
gtkknob.c
Normal file
915
gtkknob.c
Normal file
@@ -0,0 +1,915 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
*
|
||||||
|
* Most of this code comes from gAlan 0.2.0, copyright (C) 1999
|
||||||
|
* Tony Garnock-Jones, with modifications from Sean Bolton,
|
||||||
|
* copyright (C) 2004, William Weston copyright (C) 2007,
|
||||||
|
* Pete Shorthose copyright (C) 2007, and Tomasz Moń,
|
||||||
|
* copyright (C) 2009-2011
|
||||||
|
*
|
||||||
|
* 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 <math.h>
|
||||||
|
#include <gtk/gtk.h>
|
||||||
|
#include <gdk/gdkkeysyms.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include "gtkknob.h"
|
||||||
|
#include "knob.h"
|
||||||
|
|
||||||
|
#ifndef M_PI
|
||||||
|
# define M_PI 3.14159265358979323846 /* pi */
|
||||||
|
#endif
|
||||||
|
#ifndef M_1_PI
|
||||||
|
# define M_1_PI 0.31830988618379067154 /* 1/pi */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#define SCROLL_DELAY_LENGTH 250
|
||||||
|
#define KNOB_SIZE 32 /* this should really be read from the knob image */
|
||||||
|
|
||||||
|
#define STATE_IDLE 0
|
||||||
|
#define STATE_PRESSED 1
|
||||||
|
#define STATE_DRAGGING 2
|
||||||
|
|
||||||
|
static void gtk_knob_class_init(GtkKnobClass *klass);
|
||||||
|
static void gtk_knob_init(GtkKnob *knob);
|
||||||
|
static void gtk_knob_destroy(GtkWidget *object);
|
||||||
|
static void gtk_knob_realize(GtkWidget *widget);
|
||||||
|
static void gtk_knob_unrealize(GtkWidget *widget);
|
||||||
|
static void gtk_knob_map(GtkWidget *widget);
|
||||||
|
static void gtk_knob_unmap(GtkWidget *widget);
|
||||||
|
static void gtk_knob_get_preferred_width(GtkWidget *widget, gint *minimum_width, gint *natural_width);
|
||||||
|
static void gtk_knob_get_preferred_height(GtkWidget *widget, gint *minimum_height, gint *natural_height);
|
||||||
|
static void gtk_knob_size_allocate(GtkWidget *widget, GtkAllocation *allocation);
|
||||||
|
static gboolean gtk_knob_draw(GtkWidget *widget, cairo_t *cr);
|
||||||
|
static gint gtk_knob_scroll(GtkWidget *widget, GdkEventScroll *event);
|
||||||
|
static gint gtk_knob_button_press(GtkWidget *widget, GdkEventButton *event);
|
||||||
|
static gint gtk_knob_button_release(GtkWidget *widget, GdkEventButton *event);
|
||||||
|
static gint gtk_knob_key_press(GtkWidget *widget, GdkEventKey *event);
|
||||||
|
static gint gtk_knob_motion_notify(GtkWidget *widget, GdkEventMotion *event);
|
||||||
|
static gint gtk_knob_timer(GtkKnob *knob);
|
||||||
|
|
||||||
|
static void gtk_knob_update_mouse_update(GtkKnob *knob);
|
||||||
|
static void gtk_knob_update_mouse(GtkKnob *knob, gint x, gint y, gboolean step);
|
||||||
|
static void gtk_knob_update(GtkKnob *knob);
|
||||||
|
static void gtk_knob_adjustment_changed(GtkAdjustment *adjustment, gpointer data);
|
||||||
|
static void gtk_knob_adjustment_value_changed(GtkAdjustment *adjustment, gpointer data);
|
||||||
|
|
||||||
|
/* Local data */
|
||||||
|
|
||||||
|
static GtkWidgetClass *parent_class = NULL;
|
||||||
|
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
*
|
||||||
|
* gtk_knob_get_type()
|
||||||
|
*
|
||||||
|
*****************************************************************************/
|
||||||
|
GType
|
||||||
|
gtk_knob_get_type(void) {
|
||||||
|
static GType knob_type = 0;
|
||||||
|
|
||||||
|
if (!knob_type) {
|
||||||
|
static const GTypeInfo knob_info = {
|
||||||
|
sizeof (GtkKnobClass),
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
(GClassInitFunc) gtk_knob_class_init,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
sizeof (GtkKnob),
|
||||||
|
0,
|
||||||
|
(GInstanceInitFunc) gtk_knob_init,
|
||||||
|
};
|
||||||
|
knob_type = g_type_register_static (GTK_TYPE_WIDGET, "GtkKnob", &knob_info, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
return knob_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
*
|
||||||
|
* gtk_knob_class_init()
|
||||||
|
*
|
||||||
|
*****************************************************************************/
|
||||||
|
static void
|
||||||
|
gtk_knob_class_init (GtkKnobClass *klass) {
|
||||||
|
GtkWidgetClass *widget_class;
|
||||||
|
|
||||||
|
widget_class = (GtkWidgetClass*) klass;
|
||||||
|
|
||||||
|
parent_class = g_type_class_peek_parent(klass);
|
||||||
|
|
||||||
|
widget_class->destroy = gtk_knob_destroy;
|
||||||
|
|
||||||
|
widget_class->realize = gtk_knob_realize;
|
||||||
|
widget_class->unrealize = gtk_knob_unrealize;
|
||||||
|
widget_class->draw = gtk_knob_draw;
|
||||||
|
widget_class->get_preferred_width = gtk_knob_get_preferred_width;
|
||||||
|
widget_class->get_preferred_height = gtk_knob_get_preferred_height;
|
||||||
|
widget_class->size_allocate = gtk_knob_size_allocate;
|
||||||
|
widget_class->scroll_event = gtk_knob_scroll;
|
||||||
|
widget_class->button_press_event = gtk_knob_button_press;
|
||||||
|
widget_class->button_release_event = gtk_knob_button_release;
|
||||||
|
widget_class->key_press_event = gtk_knob_key_press;
|
||||||
|
widget_class->motion_notify_event = gtk_knob_motion_notify;
|
||||||
|
widget_class->map = gtk_knob_map;
|
||||||
|
widget_class->unmap = gtk_knob_unmap;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
*
|
||||||
|
* gtk_knob_init()
|
||||||
|
*
|
||||||
|
*****************************************************************************/
|
||||||
|
static void
|
||||||
|
gtk_knob_init (GtkKnob *knob) {
|
||||||
|
knob->policy = GTK_KNOB_UPDATE_CONTINUOUS;
|
||||||
|
knob->state = STATE_IDLE;
|
||||||
|
knob->saved_x = 0;
|
||||||
|
knob->saved_y = 0;
|
||||||
|
knob->timer = 0;
|
||||||
|
knob->anim = NULL;
|
||||||
|
knob->old_value = 0.0;
|
||||||
|
knob->old_lower = 0.0;
|
||||||
|
knob->old_upper = 0.0;
|
||||||
|
knob->adjustment = NULL;
|
||||||
|
|
||||||
|
gtk_widget_set_can_focus(GTK_WIDGET(knob), TRUE);
|
||||||
|
gtk_widget_set_has_window(GTK_WIDGET(knob), FALSE);
|
||||||
|
gtk_widget_set_hexpand(GTK_WIDGET(knob), FALSE);
|
||||||
|
gtk_widget_set_vexpand(GTK_WIDGET(knob), FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
*
|
||||||
|
* gtk_knob_new()
|
||||||
|
*
|
||||||
|
*****************************************************************************/
|
||||||
|
GtkWidget *
|
||||||
|
gtk_knob_new(GtkAdjustment *adjustment, GtkKnobAnim *anim) {
|
||||||
|
GtkKnob *knob;
|
||||||
|
|
||||||
|
g_return_val_if_fail (anim != NULL, NULL);
|
||||||
|
|
||||||
|
knob = g_object_new (gtk_knob_get_type (), NULL);
|
||||||
|
|
||||||
|
gtk_knob_set_animation (knob, anim);
|
||||||
|
|
||||||
|
if (!adjustment) {
|
||||||
|
adjustment = (GtkAdjustment*) gtk_adjustment_new (0.0, 0.0, 0.0,
|
||||||
|
0.0, 0.0, 0.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
gtk_knob_set_adjustment (knob, adjustment);
|
||||||
|
|
||||||
|
return GTK_WIDGET (knob);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
*
|
||||||
|
* gtk_knob_destroy()
|
||||||
|
*
|
||||||
|
*****************************************************************************/
|
||||||
|
static void
|
||||||
|
gtk_knob_destroy(GtkWidget *object) {
|
||||||
|
GtkKnob *knob;
|
||||||
|
|
||||||
|
g_return_if_fail (object != NULL);
|
||||||
|
g_return_if_fail (GTK_IS_KNOB (object));
|
||||||
|
|
||||||
|
knob = GTK_KNOB (object);
|
||||||
|
|
||||||
|
gtk_knob_set_adjustment (knob, NULL);
|
||||||
|
/* FIXME: needs ref counting for automatic GtkKnobAnim cleanup
|
||||||
|
if (knob->anim) {
|
||||||
|
gtk_knob_anim_unref (knob->anim);
|
||||||
|
knob->anim = NULL;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (GTK_WIDGET_CLASS(parent_class)->destroy) {
|
||||||
|
(*GTK_WIDGET_CLASS (parent_class)->destroy) (object);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
*
|
||||||
|
* gtk_knob_get_adjustment()
|
||||||
|
*
|
||||||
|
*****************************************************************************/
|
||||||
|
GtkAdjustment*
|
||||||
|
gtk_knob_get_adjustment(GtkKnob *knob) {
|
||||||
|
|
||||||
|
g_return_val_if_fail (knob != NULL, NULL);
|
||||||
|
g_return_val_if_fail (GTK_IS_KNOB (knob), NULL);
|
||||||
|
|
||||||
|
return knob->adjustment;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
*
|
||||||
|
* gtk_knob_set_update_policy()
|
||||||
|
*
|
||||||
|
*****************************************************************************/
|
||||||
|
void
|
||||||
|
gtk_knob_set_update_policy(GtkKnob *knob, GtkKnobUpdateType policy) {
|
||||||
|
|
||||||
|
g_return_if_fail (knob != NULL);
|
||||||
|
g_return_if_fail (GTK_IS_KNOB (knob));
|
||||||
|
|
||||||
|
knob->policy = policy;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
*
|
||||||
|
* gtk_knob_set_adjustment()
|
||||||
|
*
|
||||||
|
*****************************************************************************/
|
||||||
|
void
|
||||||
|
gtk_knob_set_adjustment(GtkKnob *knob, GtkAdjustment *adjustment) {
|
||||||
|
|
||||||
|
g_return_if_fail (knob != NULL);
|
||||||
|
g_return_if_fail (GTK_IS_KNOB (knob));
|
||||||
|
|
||||||
|
if (knob->adjustment) {
|
||||||
|
g_signal_handlers_disconnect_matched(knob->adjustment,
|
||||||
|
G_SIGNAL_MATCH_DATA,
|
||||||
|
0, 0, NULL, NULL,
|
||||||
|
knob);
|
||||||
|
g_object_unref (knob->adjustment);
|
||||||
|
}
|
||||||
|
|
||||||
|
knob->adjustment = adjustment;
|
||||||
|
if (adjustment) {
|
||||||
|
g_object_ref_sink (adjustment);
|
||||||
|
|
||||||
|
g_signal_connect (adjustment, "changed",
|
||||||
|
G_CALLBACK(gtk_knob_adjustment_changed),
|
||||||
|
knob);
|
||||||
|
g_signal_connect (adjustment, "value_changed",
|
||||||
|
G_CALLBACK(gtk_knob_adjustment_value_changed),
|
||||||
|
knob);
|
||||||
|
|
||||||
|
knob->old_value = gtk_adjustment_get_value(adjustment);
|
||||||
|
knob->old_lower = gtk_adjustment_get_lower(adjustment);
|
||||||
|
knob->old_upper = gtk_adjustment_get_upper(adjustment);
|
||||||
|
|
||||||
|
gtk_knob_update (knob);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
*
|
||||||
|
* gtk_knob_realize()
|
||||||
|
*
|
||||||
|
*****************************************************************************/
|
||||||
|
static void
|
||||||
|
gtk_knob_realize(GtkWidget *widget) {
|
||||||
|
GtkKnob *knob;
|
||||||
|
GdkWindow *window;
|
||||||
|
GdkWindowAttr attributes;
|
||||||
|
GtkAllocation allocation;
|
||||||
|
|
||||||
|
gint attributes_mask;
|
||||||
|
|
||||||
|
g_return_if_fail (widget != NULL);
|
||||||
|
g_return_if_fail (GTK_IS_KNOB (widget));
|
||||||
|
|
||||||
|
gtk_widget_get_allocation (widget, &allocation);
|
||||||
|
gtk_widget_set_realized(widget, TRUE);
|
||||||
|
knob = GTK_KNOB (widget);
|
||||||
|
|
||||||
|
attributes.window_type = GDK_WINDOW_CHILD;
|
||||||
|
attributes.x = allocation.x;
|
||||||
|
attributes.y = allocation.y;
|
||||||
|
attributes.width = allocation.width;
|
||||||
|
attributes.height = allocation.height;
|
||||||
|
attributes.wclass = GDK_INPUT_ONLY;;
|
||||||
|
attributes.event_mask =
|
||||||
|
gtk_widget_get_events (widget) |
|
||||||
|
GDK_BUTTON_PRESS_MASK |
|
||||||
|
GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK |
|
||||||
|
GDK_POINTER_MOTION_HINT_MASK;
|
||||||
|
|
||||||
|
attributes_mask = GDK_WA_X | GDK_WA_Y;
|
||||||
|
|
||||||
|
window = gtk_widget_get_parent_window(widget);
|
||||||
|
gtk_widget_set_window(widget, window);
|
||||||
|
g_object_ref(window);
|
||||||
|
|
||||||
|
knob->event_window = gdk_window_new(window, &attributes, attributes_mask);
|
||||||
|
gdk_window_set_user_data(knob->event_window, knob);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_knob_unrealize(GtkWidget *widget)
|
||||||
|
{
|
||||||
|
GtkKnob *knob = GTK_KNOB(widget);
|
||||||
|
|
||||||
|
if (knob->event_window)
|
||||||
|
{
|
||||||
|
gdk_window_set_user_data(knob->event_window, NULL);
|
||||||
|
gdk_window_destroy(knob->event_window);
|
||||||
|
knob->event_window = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
GTK_WIDGET_CLASS(parent_class)->unrealize(widget);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_knob_map(GtkWidget *widget)
|
||||||
|
{
|
||||||
|
GtkKnob *knob = GTK_KNOB(widget);
|
||||||
|
|
||||||
|
GTK_WIDGET_CLASS(parent_class)->map(widget);
|
||||||
|
|
||||||
|
if (knob->event_window)
|
||||||
|
gdk_window_show(knob->event_window);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_knob_unmap(GtkWidget *widget)
|
||||||
|
{
|
||||||
|
GtkKnob *knob = GTK_KNOB(widget);
|
||||||
|
|
||||||
|
if (knob->event_window)
|
||||||
|
gdk_window_hide(knob->event_window);
|
||||||
|
|
||||||
|
GTK_WIDGET_CLASS(parent_class)->unmap(widget);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_knob_get_preferred_width(GtkWidget *widget,
|
||||||
|
gint *minimum_width,
|
||||||
|
gint *natural_width)
|
||||||
|
{
|
||||||
|
g_return_if_fail (widget != NULL);
|
||||||
|
g_return_if_fail (GTK_IS_KNOB (widget));
|
||||||
|
|
||||||
|
*minimum_width = *natural_width = GTK_KNOB(widget)->width;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_knob_get_preferred_height(GtkWidget *widget,
|
||||||
|
gint *minimum_height,
|
||||||
|
gint *natural_height)
|
||||||
|
{
|
||||||
|
g_return_if_fail (widget != NULL);
|
||||||
|
g_return_if_fail (GTK_IS_KNOB (widget));
|
||||||
|
|
||||||
|
*minimum_height = *natural_height = GTK_KNOB(widget)->height;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
*
|
||||||
|
* gtk_knob_size_allocate()
|
||||||
|
*
|
||||||
|
*****************************************************************************/
|
||||||
|
static void
|
||||||
|
gtk_knob_size_allocate (GtkWidget *widget, GtkAllocation *allocation) {
|
||||||
|
GtkKnob *knob;
|
||||||
|
|
||||||
|
g_return_if_fail (widget != NULL);
|
||||||
|
g_return_if_fail (GTK_IS_KNOB (widget));
|
||||||
|
g_return_if_fail (allocation != NULL);
|
||||||
|
|
||||||
|
gtk_widget_set_allocation(widget, allocation);
|
||||||
|
knob = GTK_KNOB (widget);
|
||||||
|
|
||||||
|
if (gtk_widget_get_realized (widget)) {
|
||||||
|
gdk_window_move_resize (knob->event_window,
|
||||||
|
allocation->x, allocation->y,
|
||||||
|
allocation->width, allocation->height);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
*
|
||||||
|
* gtk_knob_draw()
|
||||||
|
*
|
||||||
|
*****************************************************************************/
|
||||||
|
static gboolean
|
||||||
|
gtk_knob_draw(GtkWidget *widget, cairo_t *cr) {
|
||||||
|
GtkKnob *knob;
|
||||||
|
gdouble dx, dy;
|
||||||
|
gint frames;
|
||||||
|
|
||||||
|
g_return_val_if_fail (widget != NULL, FALSE);
|
||||||
|
g_return_val_if_fail (GTK_IS_KNOB (widget), FALSE);
|
||||||
|
g_return_val_if_fail (cr != NULL, FALSE);
|
||||||
|
g_return_val_if_fail (GTK_IS_ADJUSTMENT (GTK_KNOB (widget)->adjustment), FALSE);
|
||||||
|
|
||||||
|
knob = GTK_KNOB (widget);
|
||||||
|
|
||||||
|
frames = ((knob->anim->width / knob->anim->frame_width) - 1);
|
||||||
|
dx = gtk_adjustment_get_value(knob->adjustment) - gtk_adjustment_get_lower(knob->adjustment); /* value, from 0 */
|
||||||
|
dy = gtk_adjustment_get_upper(knob->adjustment) - gtk_adjustment_get_lower(knob->adjustment); /* range */
|
||||||
|
|
||||||
|
dx = (int)(frames * dx / dy) * knob->width; /* check this for height != width */
|
||||||
|
|
||||||
|
cairo_surface_t *surface =
|
||||||
|
cairo_surface_create_for_rectangle(knob->anim->image,
|
||||||
|
dx, 0.0,
|
||||||
|
(double)knob->width,
|
||||||
|
(double)knob->height);
|
||||||
|
cairo_set_source_surface(cr, surface, 0, 0);
|
||||||
|
cairo_paint(cr);
|
||||||
|
cairo_surface_destroy(surface);
|
||||||
|
|
||||||
|
if (gtk_widget_has_focus(widget)) {
|
||||||
|
GtkStyleContext *context;
|
||||||
|
|
||||||
|
context = gtk_widget_get_style_context(widget);
|
||||||
|
gtk_style_context_save(context);
|
||||||
|
gtk_style_context_set_state(context, gtk_widget_get_state_flags (widget));
|
||||||
|
cairo_save(cr);
|
||||||
|
gtk_render_focus(context, cr,
|
||||||
|
0, 0,
|
||||||
|
gtk_widget_get_allocated_width(widget),
|
||||||
|
gtk_widget_get_allocated_height(widget));
|
||||||
|
cairo_restore(cr);
|
||||||
|
gtk_style_context_restore(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
*
|
||||||
|
* gtk_knob_scroll()
|
||||||
|
*
|
||||||
|
*****************************************************************************/
|
||||||
|
static gint
|
||||||
|
gtk_knob_scroll(GtkWidget *widget, GdkEventScroll *event) {
|
||||||
|
GtkKnob *knob;
|
||||||
|
|
||||||
|
g_return_val_if_fail (widget != NULL, FALSE);
|
||||||
|
g_return_val_if_fail (GTK_IS_KNOB (widget), FALSE);
|
||||||
|
g_return_val_if_fail (event != NULL, FALSE);
|
||||||
|
g_return_val_if_fail (GTK_IS_ADJUSTMENT (GTK_KNOB (widget)->adjustment), FALSE);
|
||||||
|
|
||||||
|
knob = GTK_KNOB (widget);
|
||||||
|
|
||||||
|
switch (event->direction) {
|
||||||
|
case GDK_SCROLL_UP:
|
||||||
|
gtk_adjustment_set_value(knob->adjustment,
|
||||||
|
gtk_adjustment_get_value(knob->adjustment) +
|
||||||
|
gtk_adjustment_get_step_increment(knob->adjustment));
|
||||||
|
g_signal_emit_by_name (knob->adjustment, "value_changed");
|
||||||
|
break;
|
||||||
|
case GDK_SCROLL_DOWN:
|
||||||
|
gtk_adjustment_set_value(knob->adjustment,
|
||||||
|
gtk_adjustment_get_value(knob->adjustment) -
|
||||||
|
gtk_adjustment_get_step_increment(knob->adjustment));
|
||||||
|
g_signal_emit_by_name (knob->adjustment, "value_changed");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
*
|
||||||
|
* gtk_knob_button_press()
|
||||||
|
*
|
||||||
|
*****************************************************************************/
|
||||||
|
static gint
|
||||||
|
gtk_knob_button_press(GtkWidget *widget, GdkEventButton *event) {
|
||||||
|
GtkKnob *knob;
|
||||||
|
|
||||||
|
g_return_val_if_fail (widget != NULL, FALSE);
|
||||||
|
g_return_val_if_fail (GTK_IS_KNOB (widget), FALSE);
|
||||||
|
g_return_val_if_fail (event != NULL, FALSE);
|
||||||
|
g_return_val_if_fail (GTK_IS_ADJUSTMENT (GTK_KNOB (widget)->adjustment), FALSE);
|
||||||
|
|
||||||
|
knob = GTK_KNOB (widget);
|
||||||
|
|
||||||
|
switch (knob->state) {
|
||||||
|
case STATE_IDLE:
|
||||||
|
switch (event->button) {
|
||||||
|
case 1:
|
||||||
|
case 3:
|
||||||
|
if (!gtk_widget_has_focus(widget))
|
||||||
|
gtk_widget_grab_focus(widget);
|
||||||
|
knob->state = STATE_PRESSED;
|
||||||
|
knob->saved_x = event->x;
|
||||||
|
knob->saved_y = event->y;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
gtk_adjustment_set_value(knob->adjustment,
|
||||||
|
floor ((gtk_adjustment_get_lower(knob->adjustment) +
|
||||||
|
gtk_adjustment_get_upper(knob->adjustment) + 1.0)
|
||||||
|
* 0.5));
|
||||||
|
g_signal_emit_by_name (knob->adjustment, "value_changed");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
*
|
||||||
|
* gtk_knob_button_release()
|
||||||
|
*
|
||||||
|
*****************************************************************************/
|
||||||
|
static gint
|
||||||
|
gtk_knob_button_release(GtkWidget *widget, GdkEventButton *event) {
|
||||||
|
GtkKnob *knob;
|
||||||
|
|
||||||
|
g_return_val_if_fail (widget != NULL, FALSE);
|
||||||
|
g_return_val_if_fail (GTK_IS_KNOB (widget), FALSE);
|
||||||
|
g_return_val_if_fail (event != NULL, FALSE);
|
||||||
|
g_return_val_if_fail (GTK_IS_ADJUSTMENT (GTK_KNOB (widget)->adjustment), FALSE);
|
||||||
|
|
||||||
|
knob = GTK_KNOB (widget);
|
||||||
|
|
||||||
|
switch (knob->state) {
|
||||||
|
|
||||||
|
case STATE_PRESSED:
|
||||||
|
knob->state = STATE_IDLE;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case STATE_DRAGGING:
|
||||||
|
knob->state = STATE_IDLE;
|
||||||
|
|
||||||
|
switch (event->button) {
|
||||||
|
case 1:
|
||||||
|
case 3:
|
||||||
|
if (knob->policy != GTK_KNOB_UPDATE_CONTINUOUS
|
||||||
|
&& knob->old_value != gtk_adjustment_get_value(knob->adjustment))
|
||||||
|
{
|
||||||
|
g_signal_emit_by_name (knob->adjustment, "value_changed");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static gint gtk_knob_key_press(GtkWidget *widget, GdkEventKey *event)
|
||||||
|
{
|
||||||
|
GtkKnob *knob;
|
||||||
|
|
||||||
|
g_return_val_if_fail (widget != NULL, FALSE);
|
||||||
|
g_return_val_if_fail (GTK_IS_KNOB (widget), FALSE);
|
||||||
|
g_return_val_if_fail (event != NULL, FALSE);
|
||||||
|
g_return_val_if_fail (GTK_IS_ADJUSTMENT (GTK_KNOB (widget)->adjustment), FALSE);
|
||||||
|
|
||||||
|
knob = GTK_KNOB (widget);
|
||||||
|
|
||||||
|
switch (event->keyval) {
|
||||||
|
|
||||||
|
case GDK_KEY_Up:
|
||||||
|
if (gtk_widget_has_focus (widget))
|
||||||
|
{
|
||||||
|
gtk_adjustment_set_value (knob->adjustment,
|
||||||
|
knob->old_value + gtk_adjustment_get_step_increment(knob->adjustment));
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
case GDK_KEY_Down:
|
||||||
|
if (gtk_widget_has_focus (widget))
|
||||||
|
{
|
||||||
|
gtk_adjustment_set_value (knob->adjustment,
|
||||||
|
knob->old_value - gtk_adjustment_get_step_increment(knob->adjustment));
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
return FALSE;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return GTK_WIDGET_CLASS (parent_class)->key_press_event (widget, event);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
*
|
||||||
|
* gtk_knob_motion_notify()
|
||||||
|
*
|
||||||
|
*****************************************************************************/
|
||||||
|
static gint
|
||||||
|
gtk_knob_motion_notify(GtkWidget *widget, GdkEventMotion *event) {
|
||||||
|
GtkKnob *knob;
|
||||||
|
GdkModifierType mods;
|
||||||
|
gint x, y;
|
||||||
|
|
||||||
|
g_return_val_if_fail (widget != NULL, FALSE);
|
||||||
|
g_return_val_if_fail (GTK_IS_KNOB (widget), FALSE);
|
||||||
|
g_return_val_if_fail (event != NULL, FALSE);
|
||||||
|
|
||||||
|
knob = GTK_KNOB (widget);
|
||||||
|
|
||||||
|
x = event->x;
|
||||||
|
y = event->y;
|
||||||
|
|
||||||
|
if (event->is_hint || (event->window != gtk_widget_get_window(widget))) {
|
||||||
|
gdk_window_get_pointer(gtk_widget_get_window(widget), &x, &y, &mods);
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (knob->state) {
|
||||||
|
|
||||||
|
case STATE_PRESSED:
|
||||||
|
knob->state = STATE_DRAGGING;
|
||||||
|
/* fall through */
|
||||||
|
|
||||||
|
case STATE_DRAGGING:
|
||||||
|
if (mods & GDK_BUTTON1_MASK) {
|
||||||
|
gtk_knob_update_mouse (knob, x, y, TRUE);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
else if (mods & GDK_BUTTON3_MASK) {
|
||||||
|
gtk_knob_update_mouse (knob, x, y, FALSE);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
*
|
||||||
|
* gtk_knob_timer()
|
||||||
|
*
|
||||||
|
*****************************************************************************/
|
||||||
|
static gint
|
||||||
|
gtk_knob_timer(GtkKnob *knob) {
|
||||||
|
|
||||||
|
g_return_val_if_fail (knob != NULL, FALSE);
|
||||||
|
g_return_val_if_fail (GTK_IS_KNOB (knob), FALSE);
|
||||||
|
g_return_val_if_fail (GTK_IS_ADJUSTMENT (knob->adjustment), FALSE);
|
||||||
|
|
||||||
|
if (knob->policy == GTK_KNOB_UPDATE_DELAYED) {
|
||||||
|
g_signal_emit_by_name (knob->adjustment, "value_changed");
|
||||||
|
}
|
||||||
|
|
||||||
|
/* don't keep running this timer */
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
*
|
||||||
|
* gtk_knob_update_mouse_update()
|
||||||
|
*
|
||||||
|
*****************************************************************************/
|
||||||
|
static void
|
||||||
|
gtk_knob_update_mouse_update(GtkKnob *knob) {
|
||||||
|
g_return_if_fail(GTK_IS_ADJUSTMENT (knob->adjustment));
|
||||||
|
|
||||||
|
if (knob->policy == GTK_KNOB_UPDATE_CONTINUOUS) {
|
||||||
|
g_signal_emit_by_name (knob->adjustment, "value_changed");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
gtk_widget_queue_draw (GTK_WIDGET (knob));
|
||||||
|
|
||||||
|
if (knob->policy == GTK_KNOB_UPDATE_DELAYED) {
|
||||||
|
if (knob->timer) {
|
||||||
|
g_source_remove (knob->timer);
|
||||||
|
}
|
||||||
|
knob->timer = g_timeout_add (SCROLL_DELAY_LENGTH,
|
||||||
|
(GSourceFunc) gtk_knob_timer,
|
||||||
|
(gpointer) knob);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
*
|
||||||
|
* gtk_knob_update_mouse()
|
||||||
|
*
|
||||||
|
*****************************************************************************/
|
||||||
|
static void
|
||||||
|
gtk_knob_update_mouse(GtkKnob *knob, gint x, gint y, gboolean step) {
|
||||||
|
gdouble old_value, new_value, dv, dh;
|
||||||
|
gdouble angle;
|
||||||
|
|
||||||
|
g_return_if_fail (knob != NULL);
|
||||||
|
g_return_if_fail (GTK_IS_KNOB (knob));
|
||||||
|
g_return_if_fail (GTK_IS_ADJUSTMENT (knob->adjustment));
|
||||||
|
|
||||||
|
old_value = gtk_adjustment_get_value(knob->adjustment);
|
||||||
|
|
||||||
|
angle = atan2f (-y + (knob->height >> 1), x - (knob->width >> 1));
|
||||||
|
|
||||||
|
/* inverted cartesian graphics coordinate system */
|
||||||
|
dv = knob->saved_y - y;
|
||||||
|
dh = x - knob->saved_x;
|
||||||
|
knob->saved_x = x;
|
||||||
|
knob->saved_y = y;
|
||||||
|
|
||||||
|
if ((x >= 0) && (x <= knob->width)) {
|
||||||
|
dh = 0; /* dead zone */
|
||||||
|
} else {
|
||||||
|
angle = cosf (angle);
|
||||||
|
dh *= angle * angle;
|
||||||
|
}
|
||||||
|
|
||||||
|
new_value = gtk_adjustment_get_value(knob->adjustment) +
|
||||||
|
dv * (step ? gtk_adjustment_get_step_increment(knob->adjustment) : gtk_adjustment_get_page_increment(knob->adjustment)) +
|
||||||
|
dh * (gtk_adjustment_get_upper(knob->adjustment) -
|
||||||
|
gtk_adjustment_get_lower(knob->adjustment)) * 0.005; /* 0.005 == (1 / 200) */
|
||||||
|
|
||||||
|
new_value = MAX (MIN (new_value, gtk_adjustment_get_upper(knob->adjustment)),
|
||||||
|
gtk_adjustment_get_lower(knob->adjustment));
|
||||||
|
|
||||||
|
gtk_adjustment_set_value(knob->adjustment, new_value);
|
||||||
|
|
||||||
|
if (gtk_adjustment_get_value(knob->adjustment) != old_value) {
|
||||||
|
gtk_knob_update_mouse_update (knob);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
*
|
||||||
|
* gtk_knob_update()
|
||||||
|
*
|
||||||
|
*****************************************************************************/
|
||||||
|
static void
|
||||||
|
gtk_knob_update(GtkKnob *knob) {
|
||||||
|
gdouble new_value;
|
||||||
|
|
||||||
|
g_return_if_fail (knob != NULL);
|
||||||
|
g_return_if_fail (GTK_IS_KNOB (knob));
|
||||||
|
g_return_if_fail (GTK_IS_ADJUSTMENT (knob->adjustment));
|
||||||
|
|
||||||
|
if (gtk_adjustment_get_step_increment(knob->adjustment) == 1) {
|
||||||
|
new_value = floor (gtk_adjustment_get_value(knob->adjustment) + 0.5);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
new_value = gtk_adjustment_get_value(knob->adjustment);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (new_value < gtk_adjustment_get_lower(knob->adjustment)) {
|
||||||
|
new_value = gtk_adjustment_get_lower(knob->adjustment);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (new_value > gtk_adjustment_get_upper(knob->adjustment)) {
|
||||||
|
new_value = gtk_adjustment_get_upper(knob->adjustment);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (new_value != gtk_adjustment_get_value(knob->adjustment)) {
|
||||||
|
gtk_adjustment_set_value(knob->adjustment, new_value);
|
||||||
|
g_signal_emit_by_name (knob->adjustment, "value_changed");
|
||||||
|
}
|
||||||
|
|
||||||
|
gtk_widget_queue_draw (GTK_WIDGET (knob));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
*
|
||||||
|
* gtk_knob_adjustment_changed()
|
||||||
|
*
|
||||||
|
*****************************************************************************/
|
||||||
|
static void
|
||||||
|
gtk_knob_adjustment_changed(GtkAdjustment *adjustment, gpointer data) {
|
||||||
|
GtkKnob *knob;
|
||||||
|
|
||||||
|
g_return_if_fail (adjustment != NULL);
|
||||||
|
g_return_if_fail (data != NULL);
|
||||||
|
|
||||||
|
knob = GTK_KNOB (data);
|
||||||
|
|
||||||
|
if ((knob->old_value != gtk_adjustment_get_value(adjustment)) ||
|
||||||
|
(knob->old_lower != gtk_adjustment_get_lower(adjustment)) ||
|
||||||
|
(knob->old_upper != gtk_adjustment_get_upper(adjustment)))
|
||||||
|
{
|
||||||
|
gtk_knob_update (knob);
|
||||||
|
|
||||||
|
knob->old_value = gtk_adjustment_get_value(adjustment);
|
||||||
|
knob->old_lower = gtk_adjustment_get_lower(adjustment);
|
||||||
|
knob->old_upper = gtk_adjustment_get_upper(adjustment);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
*
|
||||||
|
* gtk_knob_adjustment_value_changed()
|
||||||
|
*
|
||||||
|
*****************************************************************************/
|
||||||
|
static void
|
||||||
|
gtk_knob_adjustment_value_changed (GtkAdjustment *adjustment, gpointer data) {
|
||||||
|
GtkKnob *knob;
|
||||||
|
|
||||||
|
g_return_if_fail (adjustment != NULL);
|
||||||
|
g_return_if_fail (data != NULL);
|
||||||
|
|
||||||
|
knob = GTK_KNOB (data);
|
||||||
|
|
||||||
|
if (knob->old_value != gtk_adjustment_get_value(adjustment)) {
|
||||||
|
gtk_knob_update (knob);
|
||||||
|
knob->old_value = gtk_adjustment_get_value(adjustment);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
*
|
||||||
|
* gtk_knob_set_animation()
|
||||||
|
*
|
||||||
|
*****************************************************************************/
|
||||||
|
void
|
||||||
|
gtk_knob_set_animation (GtkKnob *knob, GtkKnobAnim *anim) {
|
||||||
|
g_return_if_fail (knob != NULL);
|
||||||
|
g_return_if_fail (anim != NULL);
|
||||||
|
g_return_if_fail (GTK_IS_KNOB (knob));
|
||||||
|
|
||||||
|
knob->anim = (GtkKnobAnim *)anim;
|
||||||
|
knob->width = anim->frame_width;
|
||||||
|
knob->height = anim->height;
|
||||||
|
|
||||||
|
if (gtk_widget_get_realized (GTK_WIDGET(knob))) {
|
||||||
|
gtk_widget_queue_resize (GTK_WIDGET (knob));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reads embedded knob image
|
||||||
|
**/
|
||||||
|
static cairo_status_t
|
||||||
|
get_knob_image(void *closure, unsigned char *data, unsigned int length)
|
||||||
|
{
|
||||||
|
int *offset = (int *)closure;
|
||||||
|
|
||||||
|
if ((*offset + length) > sizeof (knob_png))
|
||||||
|
return CAIRO_STATUS_READ_ERROR;
|
||||||
|
|
||||||
|
memcpy (data, knob_png + *offset, length);
|
||||||
|
*offset = *offset + length;
|
||||||
|
|
||||||
|
return CAIRO_STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
*
|
||||||
|
* gtk_knob_animation_new_from_inline()
|
||||||
|
*
|
||||||
|
*****************************************************************************/
|
||||||
|
GtkKnobAnim *
|
||||||
|
gtk_knob_animation_new_from_inline() {
|
||||||
|
GtkKnobAnim *anim = g_new0 (GtkKnobAnim, 1);
|
||||||
|
int offset = 0;
|
||||||
|
|
||||||
|
anim->image =
|
||||||
|
cairo_image_surface_create_from_png_stream(get_knob_image, &offset);
|
||||||
|
|
||||||
|
anim->width = cairo_image_surface_get_width(anim->image);
|
||||||
|
anim->height = cairo_image_surface_get_height(anim->image);
|
||||||
|
anim->frame_width = anim->height;
|
||||||
|
|
||||||
|
return anim;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
*
|
||||||
|
* gtk_knob_animation_free()
|
||||||
|
*
|
||||||
|
*****************************************************************************/
|
||||||
|
void
|
||||||
|
gtk_knob_animation_free(GtkKnobAnim *anim) {
|
||||||
|
g_return_if_fail (anim != NULL);
|
||||||
|
|
||||||
|
if (anim->image)
|
||||||
|
cairo_surface_destroy(anim->image);
|
||||||
|
|
||||||
|
g_free (anim);
|
||||||
|
}
|
||||||
101
gtkknob.h
Normal file
101
gtkknob.h
Normal file
@@ -0,0 +1,101 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
*
|
||||||
|
* Most of this code comes from gAlan 0.2.0, copyright (C) 1999
|
||||||
|
* Tony Garnock-Jones, with modifications by Sean Bolton,
|
||||||
|
* copyright (C) 2004, and minor modifications by William Weston,
|
||||||
|
* copyright (C) 2007, Tomasz Moń, copyright (C) 2009-2011
|
||||||
|
*
|
||||||
|
* 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 __GTK_KNOB_H__
|
||||||
|
#define __GTK_KNOB_H__
|
||||||
|
|
||||||
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define GTK_KNOB(obj) G_TYPE_CHECK_INSTANCE_CAST(obj, gtk_knob_get_type(), GtkKnob)
|
||||||
|
#define GTK_KNOB_CLASS(klass) G_TYPE_CHECK_CLASS_CAST(klass, gtk_knob_get_type(), GtkKnobClass)
|
||||||
|
#define GTK_IS_KNOB(obj) G_TYPE_CHECK_INSTANCE_TYPE(obj, gtk_knob_get_type())
|
||||||
|
|
||||||
|
typedef struct _GtkKnob GtkKnob;
|
||||||
|
typedef struct _GtkKnobClass GtkKnobClass;
|
||||||
|
typedef struct _GtkKnobAnim GtkKnobAnim;
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
GTK_KNOB_UPDATE_CONTINUOUS,
|
||||||
|
GTK_KNOB_UPDATE_DISCONTINUOUS,
|
||||||
|
GTK_KNOB_UPDATE_DELAYED
|
||||||
|
} GtkKnobUpdateType;
|
||||||
|
|
||||||
|
/* better to make this an object and let widgets ref/deref it perhaps */
|
||||||
|
struct _GtkKnobAnim {
|
||||||
|
cairo_surface_t *image;
|
||||||
|
gint width; /* derived from image width */
|
||||||
|
gint height; /* derived from image height. */
|
||||||
|
gint frame_width; /* derived from pixbuf (width / height) or provided override for rectangular frames */
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _GtkKnob {
|
||||||
|
GtkWidget widget;
|
||||||
|
|
||||||
|
GdkWindow *event_window;
|
||||||
|
/* update policy (GTK_UPDATE_[CONTINUOUS/DELAYED/DISCONTINUOUS]) */
|
||||||
|
guint policy : 2;
|
||||||
|
|
||||||
|
/* State of widget (to do with user interaction) */
|
||||||
|
guint8 state;
|
||||||
|
gint saved_x, saved_y;
|
||||||
|
|
||||||
|
/* ID of update timer, or 0 if none */
|
||||||
|
guint32 timer;
|
||||||
|
|
||||||
|
/* knob animation */
|
||||||
|
GtkKnobAnim *anim;
|
||||||
|
gint width, height;
|
||||||
|
|
||||||
|
/* Old values from adjustment stored so we know when something changes */
|
||||||
|
gdouble old_value;
|
||||||
|
gdouble old_lower;
|
||||||
|
gdouble old_upper;
|
||||||
|
|
||||||
|
/* The adjustment object that stores the data for this knob */
|
||||||
|
GtkAdjustment *adjustment;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _GtkKnobClass {
|
||||||
|
GtkWidgetClass parent_class;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
extern GtkWidget *gtk_knob_new(GtkAdjustment *adjustment, GtkKnobAnim *anim);
|
||||||
|
extern GType gtk_knob_get_type(void);
|
||||||
|
extern GtkAdjustment *gtk_knob_get_adjustment(GtkKnob *knob);
|
||||||
|
extern void gtk_knob_set_update_policy(GtkKnob *knob, GtkKnobUpdateType policy);
|
||||||
|
extern void gtk_knob_set_adjustment(GtkKnob *knob, GtkAdjustment *adjustment);
|
||||||
|
|
||||||
|
GtkKnobAnim *gtk_knob_animation_new_from_inline();
|
||||||
|
|
||||||
|
void gtk_knob_set_animation (GtkKnob *knob, GtkKnobAnim *anim);
|
||||||
|
void gtk_knob_animation_free(GtkKnobAnim *anim);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
18
gui.h
18
gui.h
@@ -14,4 +14,20 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses>.
|
* along with this program. If not, see <http://www.gnu.org/licenses>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void create_window();
|
#ifndef GDIGI_GUI_H
|
||||||
|
#define GDIGI_GUI_H
|
||||||
|
|
||||||
|
#include <gtk/gtk.h>
|
||||||
|
#include <glib.h>
|
||||||
|
#include "effects.h"
|
||||||
|
|
||||||
|
gchar * get_preset_filename(int prod_id);
|
||||||
|
void show_error_message(GtkWidget *parent, gchar *message);
|
||||||
|
void apply_setting_param_to_gui(SettingParam *param);
|
||||||
|
gboolean apply_current_preset_to_gui(gpointer data);
|
||||||
|
void gui_create(Device *device);
|
||||||
|
void gui_free();
|
||||||
|
gboolean unsupported_device_dialog(Device **device);
|
||||||
|
gint select_device_dialog (GList *devices);
|
||||||
|
|
||||||
|
#endif /* GDIGI_GUI_H */
|
||||||
|
|||||||
372
preset.c
Normal file
372
preset.c
Normal file
@@ -0,0 +1,372 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2009 Tomasz Moń <desowin@gmail.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; under version 3 of the License.
|
||||||
|
*
|
||||||
|
* 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, see <http://www.gnu.org/licenses>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <gio/gio.h>
|
||||||
|
#include <expat.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include "preset.h"
|
||||||
|
#include "gdigi.h"
|
||||||
|
|
||||||
|
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||||
|
|
||||||
|
enum {
|
||||||
|
PARSER_TYPE_NOT_SET = -1,
|
||||||
|
PARSER_TYPE_PRESET_NAME = 0,
|
||||||
|
PARSER_TYPE_PARAM_ID,
|
||||||
|
PARSER_TYPE_PARAM_POSITION,
|
||||||
|
PARSER_TYPE_PARAM_VALUE,
|
||||||
|
PARSER_TYPE_PARAM_NAME,
|
||||||
|
PARSER_TYPE_PARAM_TEXT,
|
||||||
|
PARSER_TYPE_GENETX_VERSION,
|
||||||
|
PARSER_TYPE_GENETX_TYPE,
|
||||||
|
PARSER_TYPE_GENETX_CHANNEL,
|
||||||
|
PARSER_TYPE_GENETX_NAME,
|
||||||
|
PARSER_TYPE_GENETX_DATA
|
||||||
|
};
|
||||||
|
|
||||||
|
enum {
|
||||||
|
SECTION_NOT_SET = -1,
|
||||||
|
SECTION_PARAMS,
|
||||||
|
SECTION_GENETX
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int depth;
|
||||||
|
int id;
|
||||||
|
int section;
|
||||||
|
Preset *preset;
|
||||||
|
} AppData;
|
||||||
|
|
||||||
|
static void XMLCALL start(void *data, const char *el, const char **attr) {
|
||||||
|
AppData *ad = (AppData *) data;
|
||||||
|
|
||||||
|
ad->id = PARSER_TYPE_NOT_SET;
|
||||||
|
if (g_strcmp0(el, "Name") == 0) {
|
||||||
|
if (ad->depth == 1) {
|
||||||
|
ad->id = PARSER_TYPE_PRESET_NAME;
|
||||||
|
} else if (ad->depth == 3) {
|
||||||
|
if (ad->section == SECTION_PARAMS) {
|
||||||
|
ad->id = PARSER_TYPE_PARAM_NAME;
|
||||||
|
} else if (ad->section == SECTION_GENETX) {
|
||||||
|
ad->id = PARSER_TYPE_GENETX_NAME;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (g_strcmp0(el, "Params") == 0) {
|
||||||
|
ad->section = SECTION_PARAMS;
|
||||||
|
if (ad->preset->params != NULL)
|
||||||
|
g_message("Params aleady exists!");
|
||||||
|
} else if (g_strcmp0(el, "Param") == 0) {
|
||||||
|
SettingParam *param = setting_param_new();
|
||||||
|
ad->preset->params = g_list_prepend(ad->preset->params, param);
|
||||||
|
} else if (g_strcmp0(el, "ID") == 0) {
|
||||||
|
ad->id = PARSER_TYPE_PARAM_ID;
|
||||||
|
} else if (g_strcmp0(el, "Position") == 0) {
|
||||||
|
ad->id = PARSER_TYPE_PARAM_POSITION;
|
||||||
|
} else if (g_strcmp0(el, "Value") == 0) {
|
||||||
|
ad->id = PARSER_TYPE_PARAM_VALUE;
|
||||||
|
} else if (g_strcmp0(el, "Text") == 0) {
|
||||||
|
ad->id = PARSER_TYPE_PARAM_TEXT;
|
||||||
|
} else if (g_strcmp0(el, "Genetx") == 0) {
|
||||||
|
ad->section = SECTION_GENETX;
|
||||||
|
if (ad->preset->genetxs != NULL)
|
||||||
|
g_message("Genetx already exists!");
|
||||||
|
} else if (g_strcmp0(el, "GenetxModel") == 0) {
|
||||||
|
SettingGenetx *genetx = setting_genetx_new();
|
||||||
|
ad->preset->genetxs = g_list_prepend(ad->preset->genetxs, genetx);
|
||||||
|
} else if (g_strcmp0(el, "Version") == 0) {
|
||||||
|
ad->id = PARSER_TYPE_GENETX_VERSION;
|
||||||
|
} else if (g_strcmp0(el, "Type") == 0) {
|
||||||
|
ad->id = PARSER_TYPE_GENETX_TYPE;
|
||||||
|
} else if (g_strcmp0(el, "Channel") == 0) {
|
||||||
|
ad->id = PARSER_TYPE_GENETX_CHANNEL;
|
||||||
|
} else if (g_strcmp0(el, "Data") == 0) {
|
||||||
|
ad->id = PARSER_TYPE_GENETX_DATA;
|
||||||
|
}
|
||||||
|
|
||||||
|
ad->depth++;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void XMLCALL end(void *data, const char *el) {
|
||||||
|
AppData *ad = (AppData *) data;
|
||||||
|
ad->depth--;
|
||||||
|
ad->id = PARSER_TYPE_NOT_SET;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void XMLCALL text_cb(void *data, const char* text, int len)
|
||||||
|
{
|
||||||
|
AppData *ad = (AppData *) data;
|
||||||
|
|
||||||
|
if ((ad == NULL) || (ad->preset == NULL))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (ad->id == PARSER_TYPE_PRESET_NAME) {
|
||||||
|
if (ad->preset->name != NULL)
|
||||||
|
g_free(ad->preset->name);
|
||||||
|
ad->preset->name = g_strndup(text, len);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ad->section == SECTION_PARAMS) {
|
||||||
|
if (ad->preset->params == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
SettingParam *param = (SettingParam *) ad->preset->params->data;
|
||||||
|
if (param == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
gchar *value = g_strndup(text, len);
|
||||||
|
|
||||||
|
switch (ad->id) {
|
||||||
|
case PARSER_TYPE_PARAM_ID:
|
||||||
|
param->id = atoi(value);
|
||||||
|
break;
|
||||||
|
case PARSER_TYPE_PARAM_POSITION:
|
||||||
|
param->position = atoi(value);
|
||||||
|
break;
|
||||||
|
case PARSER_TYPE_PARAM_VALUE:
|
||||||
|
param->value = atoi(value);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_free(value);
|
||||||
|
} else if (ad->section == SECTION_GENETX) {
|
||||||
|
if (ad->preset->genetxs == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
SettingGenetx *genetx = (SettingGenetx *) ad->preset->genetxs->data;
|
||||||
|
if (genetx == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
gchar *value = g_strndup(text, len);
|
||||||
|
|
||||||
|
switch (ad->id) {
|
||||||
|
case PARSER_TYPE_GENETX_VERSION:
|
||||||
|
if (g_strcmp0(value, "Version1") == 0) {
|
||||||
|
genetx->version = GENETX_VERSION_1;
|
||||||
|
} else if (g_strcmp0(value, "Version2") == 0) {
|
||||||
|
genetx->version = GENETX_VERSION_2;
|
||||||
|
} else {
|
||||||
|
g_message("Unknown GeNetX version: %s", value);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case PARSER_TYPE_GENETX_TYPE:
|
||||||
|
if (g_strcmp0(value, "Amp") == 0) {
|
||||||
|
genetx->type = GENETX_TYPE_AMP;
|
||||||
|
} else if (g_strcmp0(value, "Cabinet") == 0) {
|
||||||
|
genetx->type = GENETX_TYPE_CABINET;
|
||||||
|
} else {
|
||||||
|
g_message("Unknown GeNetX type: %s", value);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case PARSER_TYPE_GENETX_CHANNEL:
|
||||||
|
if (g_strcmp0(value, "Channel1") == 0) {
|
||||||
|
genetx->channel = GENETX_CHANNEL1;
|
||||||
|
} else if (g_strcmp0(value, "Channel2") == 0) {
|
||||||
|
genetx->channel = GENETX_CHANNEL2;
|
||||||
|
} else {
|
||||||
|
g_message("Unknown GeNetX channel: %s", value);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case PARSER_TYPE_GENETX_NAME:
|
||||||
|
/* reassign pointer */
|
||||||
|
genetx->name = value;
|
||||||
|
value = NULL;
|
||||||
|
break;
|
||||||
|
case PARSER_TYPE_GENETX_DATA:
|
||||||
|
{
|
||||||
|
guchar *data = NULL;
|
||||||
|
gsize length = 0;
|
||||||
|
|
||||||
|
data = g_base64_decode(value, &length);
|
||||||
|
genetx->data = g_string_new_len((gchar *) data, length);
|
||||||
|
|
||||||
|
g_free(data);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
g_free(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \param filename valid path to file
|
||||||
|
* \param error return location for an error
|
||||||
|
*
|
||||||
|
* Tries to open file pointed by path, then parses it.
|
||||||
|
*
|
||||||
|
* \return Preset which must be freed using preset_free, or NULL on error.
|
||||||
|
**/
|
||||||
|
Preset *create_preset_from_xml_file(gchar *filename, GError **error)
|
||||||
|
{
|
||||||
|
GError *err = NULL;
|
||||||
|
gchar *contents;
|
||||||
|
|
||||||
|
if (g_file_get_contents(filename, &contents, NULL, &err) == FALSE) {
|
||||||
|
g_message("Failed to get %s contents: %s", filename, err->message);
|
||||||
|
*error = g_error_copy(err);
|
||||||
|
g_error_free(err);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
AppData *ad = g_slice_new(AppData);
|
||||||
|
ad->depth = 0;
|
||||||
|
ad->preset = g_slice_new(Preset);
|
||||||
|
ad->preset->name = NULL;
|
||||||
|
ad->preset->params = NULL;
|
||||||
|
ad->preset->genetxs = NULL;
|
||||||
|
ad->id = PARSER_TYPE_NOT_SET;
|
||||||
|
|
||||||
|
XML_Parser p;
|
||||||
|
p = XML_ParserCreate(NULL);
|
||||||
|
XML_SetUserData(p, (void *) ad);
|
||||||
|
XML_SetElementHandler(p, start, end);
|
||||||
|
XML_SetCharacterDataHandler(p, text_cb);
|
||||||
|
|
||||||
|
if (XML_Parse(p, contents, strlen(contents), XML_TRUE) != XML_STATUS_OK) {
|
||||||
|
g_set_error(error, 0, 0, "Parse error at line %d:\n%s",
|
||||||
|
(int)XML_GetCurrentLineNumber(p),
|
||||||
|
XML_ErrorString(XML_GetErrorCode(p)));
|
||||||
|
preset_free(ad->preset);
|
||||||
|
g_slice_free(AppData, ad);
|
||||||
|
g_free(contents);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
Preset *preset = ad->preset;
|
||||||
|
preset->params = g_list_reverse(preset->params);
|
||||||
|
preset->genetxs = g_list_reverse(preset->genetxs);
|
||||||
|
|
||||||
|
XML_ParserFree(p);
|
||||||
|
g_slice_free(AppData, ad);
|
||||||
|
|
||||||
|
g_free(contents);
|
||||||
|
return preset;
|
||||||
|
}
|
||||||
|
|
||||||
|
gint params_cmp(gconstpointer a, gconstpointer b)
|
||||||
|
{
|
||||||
|
const SettingParam *param_a = a;
|
||||||
|
const SettingParam *param_b = b;
|
||||||
|
|
||||||
|
if (param_a->position != param_b->position) {
|
||||||
|
return (param_a->position > param_b->position) ? 1 : -1;
|
||||||
|
}
|
||||||
|
if (param_a->id != param_b->id) {
|
||||||
|
return (param_a->id > param_b->id) ? 1 : -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \param list list containing unpacked preset SysEx messages.
|
||||||
|
*
|
||||||
|
* Parses message
|
||||||
|
*
|
||||||
|
* \return Preset which must be freed using preset_free, or NULL on error.
|
||||||
|
**/
|
||||||
|
Preset *create_preset_from_data(GList *list)
|
||||||
|
{
|
||||||
|
GString *data;
|
||||||
|
GList *iter;
|
||||||
|
gint total, n, x;
|
||||||
|
gint bank, number, modified;
|
||||||
|
gchar *name;
|
||||||
|
|
||||||
|
g_return_val_if_fail(list != NULL, NULL);
|
||||||
|
|
||||||
|
Preset *preset = g_slice_new(Preset);
|
||||||
|
preset->name = NULL;
|
||||||
|
preset->params = NULL;
|
||||||
|
preset->genetxs = NULL;
|
||||||
|
|
||||||
|
iter = list;
|
||||||
|
for (iter = list; iter; iter = g_list_next(iter)) {
|
||||||
|
data = (GString*) iter->data;
|
||||||
|
switch (get_message_id(data)) {
|
||||||
|
case RECEIVE_PRESET_START:
|
||||||
|
bank = (unsigned char)data->str[8];
|
||||||
|
number = (unsigned char)data->str[9];
|
||||||
|
name = g_strdup(&data->str[10]);
|
||||||
|
modified = (unsigned char)data->str[11+strlen(name)];
|
||||||
|
|
||||||
|
if ((bank == PRESETS_EDIT_BUFFER) && (number == 0)) {
|
||||||
|
g_message("Received current edit buffer");
|
||||||
|
} else {
|
||||||
|
g_message("Received preset %d from bank %d", number, bank);
|
||||||
|
}
|
||||||
|
|
||||||
|
g_message("Modified flag: %d Name: %s", modified, name);
|
||||||
|
preset->name = name;
|
||||||
|
break;
|
||||||
|
case RECEIVE_PRESET_PARAMETERS:
|
||||||
|
x = 0x09;
|
||||||
|
n = 0;
|
||||||
|
total = (unsigned char)data->str[x];
|
||||||
|
x++;
|
||||||
|
|
||||||
|
do {
|
||||||
|
SettingParam *param = setting_param_new_from_data(&data->str[x], &x);
|
||||||
|
n++;
|
||||||
|
preset->params = g_list_prepend(preset->params, param);
|
||||||
|
g_message("%d ID %d Position %d Value %d", n, param->id, param->position, param->value);
|
||||||
|
} while ((x < data->len) && n<total);
|
||||||
|
g_message("TOTAL %d", total);
|
||||||
|
preset->params = g_list_sort(preset->params, params_cmp);
|
||||||
|
break;
|
||||||
|
case RECEIVE_PRESET_END:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
g_message("Unhandled message in preset messages list");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return preset;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \param preset preset to be freed
|
||||||
|
*
|
||||||
|
* Frees all memory used by preset.
|
||||||
|
**/
|
||||||
|
void preset_free(Preset *preset)
|
||||||
|
{
|
||||||
|
g_return_if_fail(preset != NULL);
|
||||||
|
|
||||||
|
if (preset->params != NULL) {
|
||||||
|
GList *iter;
|
||||||
|
for (iter = preset->params; iter; iter = iter->next) {
|
||||||
|
setting_param_free((SettingParam*)iter->data);
|
||||||
|
}
|
||||||
|
g_list_free(preset->params);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (preset->genetxs != NULL) {
|
||||||
|
GList *iter;
|
||||||
|
for (iter = preset->genetxs; iter; iter = iter->next) {
|
||||||
|
setting_genetx_free((SettingGenetx*)iter->data);
|
||||||
|
}
|
||||||
|
g_list_free(preset->genetxs);
|
||||||
|
}
|
||||||
|
|
||||||
|
g_free(preset->name);
|
||||||
|
|
||||||
|
g_slice_free(Preset, preset);
|
||||||
|
}
|
||||||
32
preset.h
Normal file
32
preset.h
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2009 Tomasz Moń <desowin@gmail.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; under version 3 of the License.
|
||||||
|
*
|
||||||
|
* 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, see <http://www.gnu.org/licenses>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef GDIGI_PRESET_H
|
||||||
|
#define GDIGI_PRESET_H
|
||||||
|
|
||||||
|
#include <glib.h>
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
gchar *name;
|
||||||
|
GList *params;
|
||||||
|
GList *genetxs;
|
||||||
|
} Preset;
|
||||||
|
|
||||||
|
Preset *create_preset_from_xml_file(gchar *filename, GError **error);
|
||||||
|
Preset *create_preset_from_data(GList *list);
|
||||||
|
void preset_free(Preset *preset);
|
||||||
|
void write_preset_to_xml(Preset *preset, gchar *filename);
|
||||||
|
#endif /* GDIGI_PRESET_H */
|
||||||
262
preset_xml.c
Normal file
262
preset_xml.c
Normal file
@@ -0,0 +1,262 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2009 Tomasz Moń <desowin@gmail.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; under version 3 of the License.
|
||||||
|
*
|
||||||
|
* 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, see <http://www.gnu.org/licenses>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <gio/gio.h>
|
||||||
|
#include <expat.h>
|
||||||
|
#include <libxml/encoding.h>
|
||||||
|
#include <libxml/xmlreader.h>
|
||||||
|
#include <libxml/xmlwriter.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include "preset.h"
|
||||||
|
#include "gdigi.h"
|
||||||
|
#include "gui.h"
|
||||||
|
#include "gdigi_xml.h"
|
||||||
|
|
||||||
|
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||||
|
// FIXME: Bring the xml settings into this module?
|
||||||
|
extern XmlSettings xml_settings[];
|
||||||
|
extern guint n_xml_settings;
|
||||||
|
extern EffectValues values_on_off;
|
||||||
|
/**
|
||||||
|
* \param id modifier ID
|
||||||
|
* \param position modifier position
|
||||||
|
*
|
||||||
|
* Gets modifier info.
|
||||||
|
*
|
||||||
|
* \return Modifier which must not be freed, or NULL if no matching Modifier has been found.
|
||||||
|
*/
|
||||||
|
XmlSettings *get_xml_settings (guint id, guint position)
|
||||||
|
{
|
||||||
|
gint x;
|
||||||
|
|
||||||
|
for (x=0; x< n_xml_settings; x++) {
|
||||||
|
if ((xml_settings[x].id == id) && (xml_settings[x].position == position)) {
|
||||||
|
return xml_settings + x;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
gchar *
|
||||||
|
map_xml_value(XmlSettings *xml, gint value)
|
||||||
|
{
|
||||||
|
switch (xml->values->type) {
|
||||||
|
case VALUE_TYPE_LABEL:
|
||||||
|
if ((xml->values == &values_on_off) && (value > 1)) {
|
||||||
|
g_message("Skipping modifier->label %s\n", xml->label);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
if (value > xml->values->max || value < xml->values->min) {
|
||||||
|
g_message("%s value %d out of range %0.1f %0.1f", xml->label, value, xml->values->min, xml->values->max);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
XmlLabel *labels = xml->xml_labels;
|
||||||
|
guint labels_amt = xml->xml_labels_amt;
|
||||||
|
gint i;
|
||||||
|
|
||||||
|
// Maybe this can be a computation: i = xml->values->min + val
|
||||||
|
for (i = 0; i < labels_amt; i++) {
|
||||||
|
if (labels[i].type == value) {
|
||||||
|
return (labels[i].label);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
gboolean value_is_extra (EffectValues *val, SettingParam *param)
|
||||||
|
{
|
||||||
|
if ((param->value < val->min) || (param->value > val->max)) {
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define GDIGI_ENCODING "utf-8"
|
||||||
|
void
|
||||||
|
write_preset_to_xml(Preset *preset, gchar *filename)
|
||||||
|
{
|
||||||
|
|
||||||
|
int rc;
|
||||||
|
xmlTextWriterPtr writer;
|
||||||
|
GList *iter_params = preset->params;
|
||||||
|
guint last_id = 0;
|
||||||
|
guint last_position = 0;
|
||||||
|
|
||||||
|
printf("Creating a new xml doc\n");
|
||||||
|
/* Create a new XmlWriter for uri, with no compression. */
|
||||||
|
writer = xmlNewTextWriterFilename(filename, 0);
|
||||||
|
if (writer == NULL) {
|
||||||
|
printf("testXmlwriterFilename: Error creating the xml writer\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Start the document with the xml default for the version,
|
||||||
|
* encoding and the default for the standalone declaration.
|
||||||
|
*/
|
||||||
|
rc = xmlTextWriterStartDocument(writer, NULL, GDIGI_ENCODING, NULL);
|
||||||
|
if (rc < 0) {
|
||||||
|
printf
|
||||||
|
("testXmlwriterFilename: Error at xmlTextWriterStartDocument\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
rc = xmlTextWriterSetIndent(writer, 1);
|
||||||
|
rc = xmlTextWriterSetIndentString(writer, BAD_CAST " ");
|
||||||
|
/* Write the tag identifying type of prefix, schema version and ns. */
|
||||||
|
rc = xmlTextWriterStartElement(writer, BAD_CAST get_preset_filename(product_id));
|
||||||
|
|
||||||
|
rc = xmlTextWriterWriteAttribute(writer, BAD_CAST "SchemaVersion",
|
||||||
|
BAD_CAST "1.2");
|
||||||
|
|
||||||
|
|
||||||
|
rc = xmlTextWriterWriteAttribute(writer, BAD_CAST "xmlns",
|
||||||
|
BAD_CAST "http://www.digitech.com/xml/preset");
|
||||||
|
|
||||||
|
/* Write the Name tag. */
|
||||||
|
rc = xmlTextWriterWriteElement(writer, BAD_CAST "Name", BAD_CAST preset->name);
|
||||||
|
|
||||||
|
rc = xmlTextWriterStartElement(writer, BAD_CAST "Params");
|
||||||
|
|
||||||
|
while (iter_params) {
|
||||||
|
XmlSettings *xml;
|
||||||
|
SettingParam *param = (SettingParam *) iter_params->data;
|
||||||
|
|
||||||
|
if (param->id == last_id && param->position == last_position) {
|
||||||
|
g_message("Skipping duplicate parameter id %d position %d",
|
||||||
|
last_id, last_position);
|
||||||
|
iter_params = iter_params->next;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
rc = xmlTextWriterStartElement(writer, BAD_CAST "Param");
|
||||||
|
|
||||||
|
rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "ID",
|
||||||
|
"%d", param->id);
|
||||||
|
rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "Position",
|
||||||
|
"%d", param->position);
|
||||||
|
rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "Value",
|
||||||
|
"%d", param->value);
|
||||||
|
|
||||||
|
last_id = param->id;
|
||||||
|
last_position = param->position;
|
||||||
|
xml = get_xml_settings(param->id, param->position);
|
||||||
|
if (!xml) {
|
||||||
|
printf("Failed to get xml settings for id %d position %d\n",
|
||||||
|
param->id, param->position);
|
||||||
|
} else {
|
||||||
|
ValueType type;
|
||||||
|
gchar *suffix = "";
|
||||||
|
gdouble step = 1.0;
|
||||||
|
gint offset = 0;
|
||||||
|
gboolean decimal = FALSE;
|
||||||
|
EffectValues *values = NULL;
|
||||||
|
|
||||||
|
rc = xmlTextWriterWriteElement(writer, BAD_CAST "Name",
|
||||||
|
BAD_CAST xml->label);
|
||||||
|
values = xml->values;
|
||||||
|
type = values->type;
|
||||||
|
while ((type & VALUE_TYPE_EXTRA) && value_is_extra(values, param)) {
|
||||||
|
values = values->extra;
|
||||||
|
type = values->type;
|
||||||
|
}
|
||||||
|
type &= ~VALUE_TYPE_EXTRA;
|
||||||
|
|
||||||
|
if (type & VALUE_TYPE_OFFSET) {
|
||||||
|
offset = values->offset;
|
||||||
|
type &= ~VALUE_TYPE_OFFSET;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type & VALUE_TYPE_STEP) {
|
||||||
|
step = values->step;
|
||||||
|
type &= ~VALUE_TYPE_STEP;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type & VALUE_TYPE_SUFFIX) {
|
||||||
|
suffix = values->suffix;
|
||||||
|
type &= ~VALUE_TYPE_SUFFIX;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type & VALUE_TYPE_DECIMAL) {
|
||||||
|
decimal = TRUE;
|
||||||
|
type &= ~VALUE_TYPE_DECIMAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (type) {
|
||||||
|
case VALUE_TYPE_LABEL:
|
||||||
|
{
|
||||||
|
char *textp = map_xml_value(xml, param->value);
|
||||||
|
if (!textp) {
|
||||||
|
g_message("Unable to map %s value %d for id %d position %d",
|
||||||
|
xml->label, param->value, param->id, param->position);
|
||||||
|
textp = "";
|
||||||
|
}
|
||||||
|
rc = xmlTextWriterWriteElement(writer, BAD_CAST "Text",
|
||||||
|
BAD_CAST textp);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case VALUE_TYPE_PLAIN:
|
||||||
|
{
|
||||||
|
if (decimal) {
|
||||||
|
double value = (param->value + offset) * step;
|
||||||
|
rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "Text",
|
||||||
|
"%0.2f%s", value, suffix);
|
||||||
|
} else {
|
||||||
|
gint value = (param->value + offset) * step;
|
||||||
|
rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "Text",
|
||||||
|
"%d%s", value, suffix);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
case VALUE_TYPE_NONE:
|
||||||
|
rc = xmlTextWriterStartElement(writer, BAD_CAST "Text");
|
||||||
|
rc = xmlTextWriterEndElement(writer);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
g_message("Unhandled value type %d", type);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
rc = xmlTextWriterEndElement(writer);
|
||||||
|
|
||||||
|
iter_params = iter_params->next;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Here we could close the elements ORDER and EXAMPLE using the
|
||||||
|
* function xmlTextWriterEndElement, but since we do not want to
|
||||||
|
* write any other elements, we simply call xmlTextWriterEndDocument,
|
||||||
|
* which will do all the work. */
|
||||||
|
rc = xmlTextWriterEndDocument(writer);
|
||||||
|
if (rc < 0) {
|
||||||
|
printf("testXmlwriterFilename: Error at xmlTextWriterEndDocument\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
xmlFreeTextWriter(writer);
|
||||||
|
}
|
||||||
|
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
|
||||||
635
tests.c
635
tests.c
@@ -1,635 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2009 Tomasz Moń <desowin@gmail.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; under version 3 of the License.
|
|
||||||
*
|
|
||||||
* 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, see <http://www.gnu.org/licenses>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "gdigi.h"
|
|
||||||
|
|
||||||
void test_wah(struct usb_dev_handle *handle)
|
|
||||||
{
|
|
||||||
int x;
|
|
||||||
|
|
||||||
set_wah_type(handle, WAH_TYPE_CRY);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_wah_min(handle, x);
|
|
||||||
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_wah_max(handle, x);
|
|
||||||
|
|
||||||
for (x=0; x<=12; x++)
|
|
||||||
set_wah_level(handle, x);
|
|
||||||
|
|
||||||
set_wah_type(handle, WAH_TYPE_FULLRANGE);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_wah_min(handle, x);
|
|
||||||
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_wah_max(handle, x);
|
|
||||||
|
|
||||||
for (x=0; x<=12; x++)
|
|
||||||
set_wah_level(handle, x);
|
|
||||||
|
|
||||||
set_wah_type(handle, WAH_TYPE_CLYDE);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_wah_min(handle, x);
|
|
||||||
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_wah_max(handle, x);
|
|
||||||
|
|
||||||
for (x=0; x<=12; x++)
|
|
||||||
set_wah_level(handle, x);
|
|
||||||
|
|
||||||
set_wah_on_off(handle, TRUE);
|
|
||||||
set_wah_on_off(handle, FALSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
void test_compressor(struct usb_dev_handle *handle)
|
|
||||||
{
|
|
||||||
int x;
|
|
||||||
|
|
||||||
set_comp_type(handle, COMP_TYPE_DIGI);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_comp_sustain(handle, x);
|
|
||||||
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_comp_tone(handle, x);
|
|
||||||
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_comp_attack(handle, x);
|
|
||||||
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_comp_level(handle, x);
|
|
||||||
|
|
||||||
set_comp_type(handle, COMP_TYPE_CS);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_comp_sustain(handle, x);
|
|
||||||
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_comp_attack(handle, x);
|
|
||||||
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_comp_level(handle, x);
|
|
||||||
|
|
||||||
set_comp_on_off(handle, TRUE);
|
|
||||||
set_comp_on_off(handle, FALSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
void test_dist(struct usb_dev_handle *handle)
|
|
||||||
{
|
|
||||||
int x;
|
|
||||||
|
|
||||||
set_dist_type(handle, DIST_TYPE_SCREAMER);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_dist_option(handle, DIST_SCREAMER_DRIVE, x);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_dist_option(handle, DIST_SCREAMER_TONE, x);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_dist_option(handle, DIST_SCREAMER_LVL, x);
|
|
||||||
|
|
||||||
set_dist_type(handle, DIST_TYPE_808);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_dist_option(handle, DIST_808_OVERDRIVE, x);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_dist_option(handle, DIST_808_TONE, x);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_dist_option(handle, DIST_808_LVL, x);
|
|
||||||
|
|
||||||
set_dist_type(handle, DIST_TYPE_GUYOD);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_dist_option(handle, DIST_GUYOD_DRIVE, x);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_dist_option(handle, DIST_GUYOD_LVL, x);
|
|
||||||
|
|
||||||
set_dist_type(handle, DIST_TYPE_DOD250);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_dist_option(handle, DIST_DOD250_GAIN, x);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_dist_option(handle, DIST_DOD250_LVL, x);
|
|
||||||
|
|
||||||
set_dist_type(handle, DIST_TYPE_RODENT);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_dist_option(handle, DIST_RODENT_DIST, x);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_dist_option(handle, DIST_RODENT_FILTER, x);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_dist_option(handle, DIST_RODENT_LVL, x);
|
|
||||||
|
|
||||||
set_dist_type(handle, DIST_TYPE_MX);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_dist_option(handle, DIST_MX_DIST, x);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_dist_option(handle, DIST_MX_OUTPUT, x);
|
|
||||||
|
|
||||||
set_dist_type(handle, DIST_TYPE_DS);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_dist_option(handle, DIST_DS_GAIN, x);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_dist_option(handle, DIST_DS_TONE, x);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_dist_option(handle, DIST_DS_LVL, x);
|
|
||||||
|
|
||||||
set_dist_type(handle, DIST_TYPE_GRUNGE);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_dist_option(handle, DIST_GRUNGE_GRUNGE, x);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_dist_option(handle, DIST_GRUNGE_FACE, x);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_dist_option(handle, DIST_GRUNGE_LOUD, x);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_dist_option(handle, DIST_GRUNGE_BUTT, x);
|
|
||||||
|
|
||||||
set_dist_type(handle, DIST_TYPE_ZONE);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_dist_option(handle, DIST_ZONE_GAIN, x);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_dist_option(handle, DIST_ZONE_LOW, x);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_dist_option(handle, DIST_ZONE_MID_LVL, x);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_dist_option(handle, DIST_ZONE_MID_FREQ, x);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_dist_option(handle, DIST_ZONE_HIGH, x);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_dist_option(handle, DIST_ZONE_LEVEL, x);
|
|
||||||
|
|
||||||
set_dist_type(handle, DIST_TYPE_DEATH);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_dist_option(handle, DIST_DEATH_LOW, x);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_dist_option(handle, DIST_DEATH_MID, x);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_dist_option(handle, DIST_DEATH_HIGH, x);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_dist_option(handle, DIST_DEATH_LVL, x);
|
|
||||||
|
|
||||||
set_dist_type(handle, DIST_TYPE_GONK);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_dist_option(handle, DIST_GONK_GONK, x);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_dist_option(handle, DIST_GONK_SMEAR, x);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_dist_option(handle, DIST_GONK_SUCK, x);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_dist_option(handle, DIST_GONK_HEAVE, x);
|
|
||||||
|
|
||||||
set_dist_type(handle, DIST_TYPE_FUZZY);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_dist_option(handle, DIST_FUZZY_FUZZ, x);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_dist_option(handle, DIST_FUZZY_VOLUME, x);
|
|
||||||
|
|
||||||
set_dist_type(handle, DIST_TYPE_MP);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_dist_option(handle, DIST_MP_SUSTAIN, x);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_dist_option(handle, DIST_MP_TONE, x);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_dist_option(handle, DIST_MP_VOLUME, x);
|
|
||||||
|
|
||||||
set_dist_on_off(handle, TRUE);
|
|
||||||
set_dist_on_off(handle, FALSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
void test_presets(struct usb_dev_handle *handle)
|
|
||||||
{
|
|
||||||
int x;
|
|
||||||
|
|
||||||
for (x=0; x<=60; x++)
|
|
||||||
switch_user_preset(handle, x);
|
|
||||||
|
|
||||||
for (x=0; x<=60; x++)
|
|
||||||
switch_system_preset(handle, x);
|
|
||||||
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_preset_level(handle, x);
|
|
||||||
}
|
|
||||||
|
|
||||||
void test_pickups(struct usb_dev_handle *handle)
|
|
||||||
{
|
|
||||||
set_pickup_type(handle, PICKUP_TYPE_HB_SC);
|
|
||||||
set_pickup_type(handle, PICKUP_TYPE_SC_HB);
|
|
||||||
|
|
||||||
set_pickup_on_off(handle, TRUE);
|
|
||||||
set_pickup_on_off(handle, FALSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
void test_eq(struct usb_dev_handle *handle)
|
|
||||||
{
|
|
||||||
int x;
|
|
||||||
|
|
||||||
set_eq_type(handle, EQ_TYPE_BRIGHT);
|
|
||||||
set_eq_type(handle, EQ_TYPE_MIDBOOST);
|
|
||||||
set_eq_type(handle, EQ_TYPE_SCOOP);
|
|
||||||
set_eq_type(handle, EQ_TYPE_WARM);
|
|
||||||
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_eq_gain(handle, x);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_eq_level(handle, x);
|
|
||||||
|
|
||||||
for (x=0; x<=0x18; x++)
|
|
||||||
set_eq_bass(handle, x);
|
|
||||||
for (x=0; x<=0x18; x++)
|
|
||||||
set_eq_mid(handle, x);
|
|
||||||
for (x=0; x<=4700; x++)
|
|
||||||
set_eq_mid_hz(handle, x);
|
|
||||||
for (x=0; x<=0x18; x++)
|
|
||||||
set_eq_treble(handle, x);
|
|
||||||
for (x=0; x<=7500; x++)
|
|
||||||
set_eq_treb_hz(handle, x);
|
|
||||||
|
|
||||||
set_eq_on_off(handle, TRUE);
|
|
||||||
set_eq_on_off(handle, FALSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
void test_noisegate(struct usb_dev_handle *handle)
|
|
||||||
{
|
|
||||||
int x;
|
|
||||||
|
|
||||||
set_noisegate_type(handle, NOISEGATE_GATE);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_gate_option(handle, NOISEGATE_GATE_TRESHOLD, x);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_gate_option(handle, NOISEGATE_ATTACK, x);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_gate_option(handle, NOISEGATE_RELEASE, x);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_gate_option(handle, NOISEGATE_ATTN, x);
|
|
||||||
|
|
||||||
set_noisegate_type(handle, NOISEGATE_SWELL);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_gate_option(handle, NOISEGATE_SWELL_SENS, x);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_gate_option(handle, NOISEGATE_ATTACK, x);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_gate_option(handle, NOISEGATE_RELEASE, x);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_gate_option(handle, NOISEGATE_ATTN, x);
|
|
||||||
|
|
||||||
set_noisegate_on_off(handle, TRUE);
|
|
||||||
set_noisegate_on_off(handle, FALSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
void test_chorusfx(struct usb_dev_handle *handle)
|
|
||||||
{
|
|
||||||
int x;
|
|
||||||
|
|
||||||
set_chorusfx_type(handle, CHORUS_TYPE_CE);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_chorusfx_option(handle, CE_CHORUS_SPEED, x);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_chorusfx_option(handle, CE_CHORUS_DEPTH, x);
|
|
||||||
|
|
||||||
set_chorusfx_type(handle, CHORUS_TYPE_DUAL);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_chorusfx_option(handle, DUAL_CHORUS_SPEED, x);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_chorusfx_option(handle, DUAL_CHORUS_DEPTH, x);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_chorusfx_option(handle, DUAL_CHORUS_LEVEL, x);
|
|
||||||
set_chorusfx_option(handle, DUAL_CHORUS_WAVE, WAVE_TRI);
|
|
||||||
set_chorusfx_option(handle, DUAL_CHORUS_WAVE, WAVE_SINE);
|
|
||||||
set_chorusfx_option(handle, DUAL_CHORUS_WAVE, WAVE_SQUARE);
|
|
||||||
|
|
||||||
set_chorusfx_type(handle, CHORUS_TYPE_MULTI);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_chorusfx_option(handle, MULTI_CHORUS_SPEED, x);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_chorusfx_option(handle, MULTI_CHORUS_DEPTH, x);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_chorusfx_option(handle, MULTI_CHORUS_LEVEL, x);
|
|
||||||
set_chorusfx_option(handle, MULTI_CHORUS_WAVE, WAVE_TRI);
|
|
||||||
set_chorusfx_option(handle, MULTI_CHORUS_WAVE, WAVE_SINE);
|
|
||||||
set_chorusfx_option(handle, MULTI_CHORUS_WAVE, WAVE_SQUARE);
|
|
||||||
|
|
||||||
set_chorusfx_type(handle, CHORUS_TYPE_FLANGER);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_flanger_option(handle, FLANGER_SPEED, x);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_flanger_option(handle, FLANGER_DEPTH, x);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_flanger_option(handle, FLANGER_REGEN, x);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_flanger_option(handle, FLANGER_LEVEL, x);
|
|
||||||
set_flanger_option(handle, FLANGER_WAVE, WAVE_TRI);
|
|
||||||
set_flanger_option(handle, FLANGER_WAVE, WAVE_SINE);
|
|
||||||
set_flanger_option(handle, FLANGER_WAVE, WAVE_SQUARE);
|
|
||||||
|
|
||||||
set_chorusfx_type(handle, CHORUS_TYPE_MXR_FLANGER);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_flanger_option(handle, MXR_FLANGER_SPEED, x);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_flanger_option(handle, MXR_FLANGER_WIDTH, x);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_flanger_option(handle, MXR_FLANGER_REGEN, x);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_flanger_option(handle, MXR_FLANGER_MANUAL, x);
|
|
||||||
|
|
||||||
set_chorusfx_type(handle, CHORUS_TYPE_PHASER);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_flanger_option(handle, PHASER_SPEED, x);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_flanger_option(handle, PHASER_DEPTH, x);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_flanger_option(handle, PHASER_REGEN, x);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_flanger_option(handle, PHASER_LEVEL, x);
|
|
||||||
set_flanger_option(handle, PHASER_WAVE, WAVE_TRI);
|
|
||||||
set_flanger_option(handle, PHASER_WAVE, WAVE_SINE);
|
|
||||||
set_flanger_option(handle, PHASER_WAVE, WAVE_SQUARE);
|
|
||||||
|
|
||||||
set_chorusfx_type(handle, CHORUS_TYPE_VIBRATO);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_vibrato_option(handle, VIBRATO_SPEED, x);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_vibrato_option(handle, VIBRATO_DEPTH, x);
|
|
||||||
|
|
||||||
set_chorusfx_type(handle, CHORUS_TYPE_ROTARY);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_vibrato_option(handle, ROTARY_SPEED, x);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_vibrato_option(handle, ROTARY_INTENSITY, x);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_vibrato_option(handle, ROTARY_DOPPLER, x);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_vibrato_option(handle, ROTARY_CROSSOVER, x);
|
|
||||||
|
|
||||||
set_chorusfx_type(handle, CHORUS_TYPE_VIBROPAN);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_vibrato_option(handle, VIBROPAN_SPEED, x);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_vibrato_option(handle, VIBROPAN_DEPTH, x);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_vibrato_option(handle, VIBROPAN_VIBRA, x);
|
|
||||||
set_vibrato_option(handle, VIBROPAN_WAVE, WAVE_TRI);
|
|
||||||
set_vibrato_option(handle, VIBROPAN_WAVE, WAVE_SINE);
|
|
||||||
set_vibrato_option(handle, VIBROPAN_WAVE, WAVE_SQUARE);
|
|
||||||
|
|
||||||
set_chorusfx_type(handle, CHORUS_TYPE_TREMOLO);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_tremolo_option(handle, TREMOLO_SPEED, x);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_tremolo_option(handle, TREMOLO_DEPTH, x);
|
|
||||||
set_tremolo_option(handle, TREMOLO_WAVE, WAVE_TRI);
|
|
||||||
set_tremolo_option(handle, TREMOLO_WAVE, WAVE_SINE);
|
|
||||||
set_tremolo_option(handle, TREMOLO_WAVE, WAVE_SQUARE);
|
|
||||||
|
|
||||||
set_chorusfx_type(handle, CHORUS_TYPE_PANNER);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_tremolo_option(handle, PANNER_SPEED, x);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_tremolo_option(handle, PANNER_DEPTH, x);
|
|
||||||
set_tremolo_option(handle, PANNER_WAVE, WAVE_TRI);
|
|
||||||
set_tremolo_option(handle, PANNER_WAVE, WAVE_SINE);
|
|
||||||
set_tremolo_option(handle, PANNER_WAVE, WAVE_SQUARE);
|
|
||||||
|
|
||||||
set_chorusfx_type(handle, CHORUS_TYPE_ENVELOPE);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_envelope_option(handle, ENVELOPE_SENSITIVITY, x);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_envelope_option(handle, ENVELOPE_RANGE, x);
|
|
||||||
|
|
||||||
set_chorusfx_type(handle, CHORUS_TYPE_AUTOYA);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_ya_option(handle, AUTOYA_SPEED, x);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_ya_option(handle, AUTOYA_INTENSITY, x);
|
|
||||||
for (x=0; x<=0x31; x++)
|
|
||||||
set_ya_option(handle, AUTOYA_RANGE, x);
|
|
||||||
|
|
||||||
set_chorusfx_type(handle, CHORUS_TYPE_YAYA);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_ya_option(handle, YAYA_PEDAL, x);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_ya_option(handle, YAYA_INTENSITY, x);
|
|
||||||
for (x=0; x<=0x31; x++)
|
|
||||||
set_ya_option(handle, YAYA_RANGE, x);
|
|
||||||
|
|
||||||
set_chorusfx_type(handle, CHORUS_TYPE_STEP_FILTER);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_filter_option(handle, STEP_FILTER_SPEED, x);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_filter_option(handle, STEP_FILTER_INTENSITY, x);
|
|
||||||
|
|
||||||
set_chorusfx_type(handle, CHORUS_TYPE_WHAMMY);
|
|
||||||
set_whammy_option(handle, WHAMMY_AMOUNT, WHAMMY_OCT_UP);
|
|
||||||
set_whammy_option(handle, WHAMMY_AMOUNT, WHAMMY_2OCT_UP);
|
|
||||||
set_whammy_option(handle, WHAMMY_AMOUNT, WHAMMY_2ND_DN);
|
|
||||||
set_whammy_option(handle, WHAMMY_AMOUNT, WHAMMY_RV_2ND);
|
|
||||||
set_whammy_option(handle, WHAMMY_AMOUNT, WHAMMY_4TH_DN);
|
|
||||||
set_whammy_option(handle, WHAMMY_AMOUNT, WHAMMY_OCT_DN);
|
|
||||||
set_whammy_option(handle, WHAMMY_AMOUNT, WHAMMY_2OCT_DN);
|
|
||||||
set_whammy_option(handle, WHAMMY_AMOUNT, WHAMMY_DIV_BMB);
|
|
||||||
set_whammy_option(handle, WHAMMY_AMOUNT, WHAMMY_M3_MA);
|
|
||||||
set_whammy_option(handle, WHAMMY_AMOUNT, WHAMMY_2ND_MA3);
|
|
||||||
set_whammy_option(handle, WHAMMY_AMOUNT, WHAMMY_3RD_4TH);
|
|
||||||
set_whammy_option(handle, WHAMMY_AMOUNT, WHAMMY_4TH_5TH);
|
|
||||||
set_whammy_option(handle, WHAMMY_AMOUNT, WHAMMY_5TH_OCT);
|
|
||||||
set_whammy_option(handle, WHAMMY_AMOUNT, WHAMMY_HOCT_UP);
|
|
||||||
set_whammy_option(handle, WHAMMY_AMOUNT, WHAMMY_HOCT_DN);
|
|
||||||
set_whammy_option(handle, WHAMMY_AMOUNT, WHAMMY_OCT_UD);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_whammy_option(handle, WHAMMY_PEDAL, x);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_whammy_option(handle, WHAMMY_MIX, x);
|
|
||||||
|
|
||||||
set_chorusfx_type(handle, CHORUS_TYPE_PITCH_SHIFT);
|
|
||||||
for (x=0; x<=0x30; x++)
|
|
||||||
set_pitch_option(handle, PITCH_AMOUNT, x);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_pitch_option(handle, PITCH_MIX, x);
|
|
||||||
|
|
||||||
set_chorusfx_type(handle, CHORUS_TYPE_DETUNE);
|
|
||||||
for (x=0; x<=0x30; x++)
|
|
||||||
set_pitch_option(handle, DETUNE_AMOUNT, x);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_pitch_option(handle, DETUNE_LEVEL, x);
|
|
||||||
|
|
||||||
set_chorusfx_type(handle, CHORUS_TYPE_IPS);
|
|
||||||
set_ips_option(handle, IPS_SHIFT_AMOUNT, IPS_OCT_D);
|
|
||||||
set_ips_option(handle, IPS_SHIFT_AMOUNT, IPS_7TH_DN);
|
|
||||||
set_ips_option(handle, IPS_SHIFT_AMOUNT, IPS_6TH_DN);
|
|
||||||
set_ips_option(handle, IPS_SHIFT_AMOUNT, IPS_5TH_DN);
|
|
||||||
set_ips_option(handle, IPS_SHIFT_AMOUNT, IPS_4TH_DN);
|
|
||||||
set_ips_option(handle, IPS_SHIFT_AMOUNT, IPS_3RD_DN);
|
|
||||||
set_ips_option(handle, IPS_SHIFT_AMOUNT, IPS_2ND_DN);
|
|
||||||
set_ips_option(handle, IPS_SHIFT_AMOUNT, IPS_2ND_UP);
|
|
||||||
set_ips_option(handle, IPS_SHIFT_AMOUNT, IPS_3RD_UP);
|
|
||||||
set_ips_option(handle, IPS_SHIFT_AMOUNT, IPS_4TH_UP);
|
|
||||||
set_ips_option(handle, IPS_SHIFT_AMOUNT, IPS_5TH_UP);
|
|
||||||
set_ips_option(handle, IPS_SHIFT_AMOUNT, IPS_6TH_UP);
|
|
||||||
set_ips_option(handle, IPS_SHIFT_AMOUNT, IPS_7TH_UP);
|
|
||||||
set_ips_option(handle, IPS_SHIFT_AMOUNT, IPS_OCT_U);
|
|
||||||
set_ips_option(handle, IPS_KEY, IPS_E);
|
|
||||||
set_ips_option(handle, IPS_KEY, IPS_F);
|
|
||||||
set_ips_option(handle, IPS_KEY, IPS_GB);
|
|
||||||
set_ips_option(handle, IPS_KEY, IPS_G);
|
|
||||||
set_ips_option(handle, IPS_KEY, IPS_AB);
|
|
||||||
set_ips_option(handle, IPS_KEY, IPS_A);
|
|
||||||
set_ips_option(handle, IPS_KEY, IPS_BB);
|
|
||||||
set_ips_option(handle, IPS_KEY, IPS_B);
|
|
||||||
set_ips_option(handle, IPS_KEY, IPS_C);
|
|
||||||
set_ips_option(handle, IPS_KEY, IPS_DD);
|
|
||||||
set_ips_option(handle, IPS_KEY, IPS_D);
|
|
||||||
set_ips_option(handle, IPS_KEY, IPS_EB);
|
|
||||||
set_ips_option(handle, IPS_SCALE, IPS_MAJOR);
|
|
||||||
set_ips_option(handle, IPS_SCALE, IPS_MINOR);
|
|
||||||
set_ips_option(handle, IPS_SCALE, IPS_DORIA);
|
|
||||||
set_ips_option(handle, IPS_SCALE, IPS_MIXLYD);
|
|
||||||
set_ips_option(handle, IPS_SCALE, IPS_LYDIAN);
|
|
||||||
set_ips_option(handle, IPS_SCALE, IPS_HMINO);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_ips_option(handle, IPS_LEVEL, x);
|
|
||||||
|
|
||||||
set_chorusfx_on_off(handle, TRUE);
|
|
||||||
set_chorusfx_on_off(handle, FALSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
void test_delay(struct usb_dev_handle *handle)
|
|
||||||
{
|
|
||||||
int x;
|
|
||||||
|
|
||||||
set_delay_type(handle, DELAY_TYPE_ANALOG);
|
|
||||||
for (x=0; x<=139; x++)
|
|
||||||
set_delay_time(handle, x);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_delay_option(handle, ANALOG_LEVEL, x);
|
|
||||||
for (x=0; x<=100; x++)
|
|
||||||
set_delay_option(handle, ANALOG_REPEATS, x);
|
|
||||||
|
|
||||||
set_delay_type(handle, DELAY_TYPE_DIGITAL);
|
|
||||||
for (x=0; x<=139; x++)
|
|
||||||
set_delay_time(handle, x);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_delay_option(handle, DIGITAL_LEVEL, x);
|
|
||||||
for (x=0; x<=100; x++)
|
|
||||||
set_delay_option(handle, DIGITAL_REPEATS, x);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_delay_option(handle, DIGITAL_DUCKER_THRESH, x);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_delay_option(handle, DIGITAL_DUCKER_LEVEL, x);
|
|
||||||
|
|
||||||
set_delay_type(handle, DELAY_TYPE_MODULATED);
|
|
||||||
for (x=0; x<=139; x++)
|
|
||||||
set_delay_time(handle, x);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_delay_option(handle, MODULATED_LEVEL, x);
|
|
||||||
for (x=0; x<=100; x++)
|
|
||||||
set_delay_option(handle, MODULATED_REPEATS, x);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_delay_option(handle, MODULATED_DEPTH, x);
|
|
||||||
|
|
||||||
set_delay_type(handle, DELAY_TYPE_PONG);
|
|
||||||
for (x=0; x<=139; x++)
|
|
||||||
set_delay_time(handle, x);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_delay_option(handle, PONG_LEVEL, x);
|
|
||||||
for (x=0; x<=100; x++)
|
|
||||||
set_delay_option(handle, PONG_REPEATS, x);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_delay_option(handle, PONG_DUCKER_THRESH, x);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_delay_option(handle, PONG_DUCKER_LEVEL, x);
|
|
||||||
|
|
||||||
set_delay_type(handle, DELAY_TYPE_TAPE);
|
|
||||||
for (x=0; x<=139; x++)
|
|
||||||
set_delay_time(handle, x);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_delay_option(handle, TAPE_LEVEL, x);
|
|
||||||
for (x=0; x<=100; x++)
|
|
||||||
set_delay_option(handle, TAPE_REPEATS, x);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_delay_option(handle, TAPE_WOW, x);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_delay_option(handle, TAPE_FLUTTER, x);
|
|
||||||
|
|
||||||
set_delay_on_off(handle, TRUE);
|
|
||||||
set_delay_on_off(handle, FALSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
void test_reverb(struct usb_dev_handle *handle)
|
|
||||||
{
|
|
||||||
int x;
|
|
||||||
|
|
||||||
set_reverb_type(handle, REVERB_TYPE_TWIN);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_reverb_option(handle, TWIN_REVERB, x);
|
|
||||||
|
|
||||||
set_reverb_type(handle, REVERB_TYPE_LEX_AMBIENCE);
|
|
||||||
for (x=0; x<=15; x++)
|
|
||||||
set_reverb_option(handle, LEX_AMBIENCE_PREDELAY, x);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_reverb_option(handle, LEX_AMBIENCE_DECAY, x);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_reverb_option(handle, LEX_AMBIENCE_LIVELINESS, x);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_reverb_option(handle, LEX_AMBIENCE_LEVEL, x);
|
|
||||||
|
|
||||||
set_reverb_type(handle, REVERB_TYPE_LEX_STUDIO);
|
|
||||||
for (x=0; x<=15; x++)
|
|
||||||
set_reverb_option(handle, LEX_STUDIO_PREDELAY, x);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_reverb_option(handle, LEX_STUDIO_DECAY, x);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_reverb_option(handle, LEX_STUDIO_LIVELINESS, x);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_reverb_option(handle, LEX_STUDIO_LEVEL, x);
|
|
||||||
|
|
||||||
set_reverb_type(handle, REVERB_TYPE_LEX_ROOM);
|
|
||||||
for (x=0; x<=15; x++)
|
|
||||||
set_reverb_option(handle, LEX_ROOM_PREDELAY, x);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_reverb_option(handle, LEX_ROOM_DECAY, x);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_reverb_option(handle, LEX_ROOM_LIVELINESS, x);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_reverb_option(handle, LEX_ROOM_LEVEL, x);
|
|
||||||
|
|
||||||
set_reverb_type(handle, REVERB_TYPE_LEX_HALL);
|
|
||||||
for (x=0; x<=15; x++)
|
|
||||||
set_reverb_option(handle, LEX_HALL_PREDELAY, x);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_reverb_option(handle, LEX_HALL_DECAY, x);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_reverb_option(handle, LEX_HALL_LIVELINESS, x);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_reverb_option(handle, LEX_HALL_LEVEL, x);
|
|
||||||
|
|
||||||
set_reverb_type(handle, REVERB_TYPE_EMT240_PLATE);
|
|
||||||
for (x=0; x<=15; x++)
|
|
||||||
set_reverb_option(handle, EMT240_PLATE_PREDELAY, x);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_reverb_option(handle, EMT240_PLATE_DECAY, x);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_reverb_option(handle, EMT240_PLATE_LIVELINESS, x);
|
|
||||||
for (x=0; x<=99; x++)
|
|
||||||
set_reverb_option(handle, EMT240_PLATE_LEVEL, x);
|
|
||||||
|
|
||||||
set_reverb_on_off(handle, TRUE);
|
|
||||||
set_reverb_on_off(handle, FALSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
void test_all(struct usb_dev_handle *handle)
|
|
||||||
{
|
|
||||||
test_wah(handle);
|
|
||||||
test_compressor(handle);
|
|
||||||
test_dist(handle);
|
|
||||||
test_presets(handle);
|
|
||||||
test_pickups(handle);
|
|
||||||
test_eq(handle);
|
|
||||||
test_noisegate(handle);
|
|
||||||
test_chorusfx(handle);
|
|
||||||
test_delay(handle);
|
|
||||||
test_reverb(handle);
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user