diff options
author | David Robillard <d@drobilla.net> | 2011-07-07 20:13:12 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2011-07-07 20:13:12 +0000 |
commit | 6a8890125eb77dac87324e197aab09e8e098a973 (patch) | |
tree | b166596adf8c13fbf7627118e1cd538fe37bd8b8 /plugins/eg-amp.lv2/amp.c | |
parent | 99488ef7b46dd1147de863cceef31eda5aa6ddd6 (diff) | |
download | lv2-6a8890125eb77dac87324e197aab09e8e098a973.tar.xz |
Use enum for port indices (better type-safety and self-documentation).
Diffstat (limited to 'plugins/eg-amp.lv2/amp.c')
-rw-r--r-- | plugins/eg-amp.lv2/amp.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/plugins/eg-amp.lv2/amp.c b/plugins/eg-amp.lv2/amp.c index 1f2b824..1a9dd94 100644 --- a/plugins/eg-amp.lv2/amp.c +++ b/plugins/eg-amp.lv2/amp.c @@ -1,6 +1,7 @@ /* LV2 Amp Example Plugin Copyright 2006-2011 Steve Harris, David Robillard. + Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. @@ -20,10 +21,13 @@ #include "lv2/lv2plug.in/ns/lv2core/lv2.h" -#define AMP_URI "http://lv2plug.in/plugins/eg-amp" -#define AMP_GAIN 0 -#define AMP_INPUT 1 -#define AMP_OUTPUT 2 +#define AMP_URI "http://lv2plug.in/plugins/eg-amp" + +typedef enum { + AMP_GAIN = 0, + AMP_INPUT = 1, + AMP_OUTPUT = 2 +} PortIndex; typedef struct { float* gain; @@ -49,7 +53,7 @@ connect_port(LV2_Handle instance, { Amp* amp = (Amp*)instance; - switch (port) { + switch ((PortIndex)port) { case AMP_GAIN: amp->gain = data; break; |