some Doxygen work
This commit is contained in:
44
effects.c
44
effects.c
@@ -17,6 +17,8 @@
|
|||||||
#include "gdigi.h"
|
#include "gdigi.h"
|
||||||
#include "effects.h"
|
#include "effects.h"
|
||||||
|
|
||||||
|
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||||
|
|
||||||
static gchar *wave_labels[] = {
|
static gchar *wave_labels[] = {
|
||||||
"Tri",
|
"Tri",
|
||||||
"Sine",
|
"Sine",
|
||||||
@@ -115,22 +117,22 @@ static EffectValues values_0_to_15 = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static EffectValues values_m24_to_24 = {
|
static EffectValues values_m24_to_24 = {
|
||||||
/* TODO: make this display propertly (display range -24 to 24) */
|
/** \todo make this display propertly (display range -24 to 24) */
|
||||||
0.0, 48.0, NULL,
|
0.0, 48.0, NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
static EffectValues values_eq_db = {
|
static EffectValues values_eq_db = {
|
||||||
/* TODO: make those display propertly (display range -12 to 12) */
|
/** \todo make those display propertly (display range -12dB to 12dB) */
|
||||||
0.0, 24.0, NULL,
|
0.0, 24.0, NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
static EffectValues values_eq_mid_hz = {
|
static EffectValues values_eq_mid_hz = {
|
||||||
/* TODO: make this display propertly (display range 300 to 5000) */
|
/** \todo make this display propertly (display range 300 to 5000) */
|
||||||
0.0, 4700.0, NULL,
|
0.0, 4700.0, NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
static EffectValues values_eq_treb_hz = {
|
static EffectValues values_eq_treb_hz = {
|
||||||
/* TODO: make this display propertly (display range 500 to 8000) */
|
/** \todo make this display propertly (display range 500 to 8000) */
|
||||||
0.0, 7500.0, NULL,
|
0.0, 7500.0, NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -155,12 +157,12 @@ static EffectValues values_ips_scale = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static EffectValues values_delay_time = {
|
static EffectValues values_delay_time = {
|
||||||
/* TODO: make this display propertly (10 msec to 5 sec) */
|
/** \todo make this display propertly (10 msec to 5 sec) */
|
||||||
0.0, 139.0, NULL,
|
0.0, 139.0, NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
static EffectValues values_delay_repeats = {
|
static EffectValues values_delay_repeats = {
|
||||||
/* TODO: make last value display propertly */
|
/** \todo make last value display propertly */
|
||||||
0.0, 100.0, NULL,
|
0.0, 100.0, NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -734,6 +736,8 @@ EffectList effects[] = {
|
|||||||
|
|
||||||
int n_effects = G_N_ELEMENTS(effects);
|
int n_effects = G_N_ELEMENTS(effects);
|
||||||
|
|
||||||
|
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
gchar *label;
|
gchar *label;
|
||||||
guint id;
|
guint id;
|
||||||
@@ -741,6 +745,8 @@ typedef struct {
|
|||||||
EffectValues *values;
|
EffectValues *values;
|
||||||
} Modifier;
|
} Modifier;
|
||||||
|
|
||||||
|
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||||
|
|
||||||
static Modifier modifiers[] = {
|
static Modifier modifiers[] = {
|
||||||
{"None", 0, 0, NULL},
|
{"None", 0, 0, NULL},
|
||||||
{"Pickup Enable", PICKUP_ON_OFF, PICKUP_POSITION, &values_on_off},
|
{"Pickup Enable", PICKUP_ON_OFF, PICKUP_POSITION, &values_on_off},
|
||||||
@@ -879,14 +885,15 @@ static Modifier modifiers[] = {
|
|||||||
|
|
||||||
int n_modifiers = G_N_ELEMENTS(modifiers);
|
int n_modifiers = G_N_ELEMENTS(modifiers);
|
||||||
|
|
||||||
|
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get_modifier:
|
* \param id modifier ID
|
||||||
* @id: modifier ID
|
* \param position modifier position
|
||||||
* @position: modifier position
|
|
||||||
*
|
*
|
||||||
* Gets modifier info.
|
* Gets modifier info.
|
||||||
*
|
*
|
||||||
* Return value: Modifier which must not be freed, or NULL if no matching Modifier has been found.
|
* \return Modifier which must not be freed, or NULL if no matching Modifier has been found.
|
||||||
*/
|
*/
|
||||||
static Modifier *get_modifier(guint id, guint position)
|
static Modifier *get_modifier(guint id, guint position)
|
||||||
{
|
{
|
||||||
@@ -900,19 +907,18 @@ static Modifier *get_modifier(guint id, guint position)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get_modifier_settings:
|
* \param values possible setting values
|
||||||
* @values: possible setting values
|
|
||||||
*
|
*
|
||||||
* Creates EffectSettings containing expression pedal min and max settings.
|
* Creates EffectSettings containing expression pedal min and max settings.
|
||||||
*
|
*
|
||||||
* Return value: EffectSettings which must be freed using effect_settings_free.
|
* \return EffectSettings which must be freed using effect_settings_free.
|
||||||
**/
|
**/
|
||||||
static EffectSettings *get_modifier_settings(EffectValues *values)
|
static EffectSettings *get_modifier_settings(EffectValues *values)
|
||||||
{
|
{
|
||||||
if (values == NULL)
|
if (values == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
/* TODO: reuse exsisting settings if values is the same */
|
/** \todo reuse exsisting settings if values is the same */
|
||||||
EffectSettings *settings = g_slice_alloc0(2 * sizeof(EffectSettings));
|
EffectSettings *settings = g_slice_alloc0(2 * sizeof(EffectSettings));
|
||||||
settings[0].id = EXP_MIN;
|
settings[0].id = EXP_MIN;
|
||||||
settings[1].id = EXP_MAX;
|
settings[1].id = EXP_MAX;
|
||||||
@@ -928,8 +934,7 @@ static EffectSettings *get_modifier_settings(EffectValues *values)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* effect_settings_free:
|
* \param settings settings to be freed
|
||||||
* @settings: settings to be freed
|
|
||||||
*
|
*
|
||||||
* Frees all memory used by EffectSettings.
|
* Frees all memory used by EffectSettings.
|
||||||
**/
|
**/
|
||||||
@@ -939,11 +944,9 @@ static void effect_settings_free(EffectSettings *settings)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* modifier_linkable_list:
|
|
||||||
*
|
|
||||||
* Retrieves modifier linkable gruop from device.
|
* Retrieves modifier linkable gruop from device.
|
||||||
*
|
*
|
||||||
* Return value: ModifierGroup which must be freed using modifier_group_free.
|
* \return ModifierGroup which must be freed using modifier_group_free.
|
||||||
**/
|
**/
|
||||||
ModifierGroup *modifier_linkable_list()
|
ModifierGroup *modifier_linkable_list()
|
||||||
{
|
{
|
||||||
@@ -996,8 +999,7 @@ ModifierGroup *modifier_linkable_list()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* modifier_group_free:
|
* \param modifier_group group to be freed
|
||||||
* @modifier_group: group to be freed
|
|
||||||
*
|
*
|
||||||
* Frees all memory used by ModifierGroup.
|
* Frees all memory used by ModifierGroup.
|
||||||
**/
|
**/
|
||||||
|
|||||||
40
effects.h
40
effects.h
@@ -20,38 +20,38 @@
|
|||||||
#include <glib/gtypes.h>
|
#include <glib/gtypes.h>
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
gdouble min; /* Minumum value */
|
gdouble min; /**< Minumum value */
|
||||||
gdouble max; /* Maximum value */
|
gdouble max; /**< Maximum value */
|
||||||
GStrv labels; /* value labels */
|
GStrv labels; /**< value labels */
|
||||||
} EffectValues;
|
} EffectValues;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
gchar *label; /* Parameter name */
|
gchar *label; /**< Parameter name */
|
||||||
guint id; /* ID (to set parameter) */
|
guint id; /**< ID (to set parameter) */
|
||||||
guint position; /* position */
|
guint position; /**< position */
|
||||||
EffectValues *values; /* valid parameter values */
|
EffectValues *values; /**< valid parameter values */
|
||||||
} EffectSettings;
|
} EffectSettings;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
guint type; /* value (type) */
|
guint type; /**< value (type) */
|
||||||
gchar *label; /* Effect name */
|
gchar *label; /**< Effect name */
|
||||||
guint id; /* ID (to set effect type) */
|
guint id; /**< ID (to set effect type) */
|
||||||
guint position; /* position */
|
guint position; /**< position */
|
||||||
EffectSettings *settings; /* possible parameters */
|
EffectSettings *settings; /**< possible parameters */
|
||||||
gint settings_amt; /* possible parameters length */
|
gint settings_amt; /**< possible parameters length */
|
||||||
} EffectGroup;
|
} EffectGroup;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
gchar *label; /* Base effect name */
|
gchar *label; /**< Base effect name */
|
||||||
guint id; /* ID (to set effect on/off) */
|
guint id; /**< ID (to set effect on/off) */
|
||||||
guint position; /* position */
|
guint position; /**< position */
|
||||||
EffectGroup *group; /* possible effect types */
|
EffectGroup *group; /**< possible effect types */
|
||||||
gint group_amt; /* possible effect types length */
|
gint group_amt; /**< possible effect types length */
|
||||||
} Effect;
|
} Effect;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
Effect *effect; /* list of supported effects */
|
Effect *effect; /**< list of supported effects */
|
||||||
gint amt; /* list of supported effects length */
|
gint amt; /**< list of supported effects length */
|
||||||
} EffectList;
|
} EffectList;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|||||||
100
gdigi.c
100
gdigi.c
@@ -31,13 +31,12 @@ static snd_rawmidi_t *input = NULL;
|
|||||||
static char *device = "hw:1,0,0";
|
static char *device = "hw:1,0,0";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* calculate_checksum:
|
* \param array data to calculate checksum
|
||||||
* @array: data to calculate checksum
|
* \param length data length
|
||||||
* @length: data length
|
|
||||||
*
|
*
|
||||||
* Calculates message checksum
|
* Calculates message checksum.
|
||||||
*
|
*
|
||||||
* Return value: calculated checksum
|
* \return calculated checksum.
|
||||||
**/
|
**/
|
||||||
static char calculate_checksum(gchar *array, gint length)
|
static char calculate_checksum(gchar *array, gint length)
|
||||||
{
|
{
|
||||||
@@ -52,11 +51,9 @@ static char calculate_checksum(gchar *array, gint length)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* open_device:
|
|
||||||
*
|
|
||||||
* Opens MIDI device. This function modifies global input and output variables.
|
* Opens MIDI device. This function modifies global input and output variables.
|
||||||
*
|
*
|
||||||
* Return value: FALSE on success, TRUE on error.
|
* \return FALSE on success, TRUE on error.
|
||||||
**/
|
**/
|
||||||
gboolean open_device()
|
gboolean open_device()
|
||||||
{
|
{
|
||||||
@@ -80,9 +77,8 @@ gboolean open_device()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* send_data:
|
* \param data data to be sent
|
||||||
* @data: data to be sent
|
* \param length data length
|
||||||
* @length: data length
|
|
||||||
*
|
*
|
||||||
* Sends data to device. This function uses global output variable.
|
* Sends data to device. This function uses global output variable.
|
||||||
**/
|
**/
|
||||||
@@ -92,13 +88,12 @@ void send_data(char *data, int length)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* pack_data:
|
* \param data data to be packed
|
||||||
* @data: data to be packed
|
* \param len data length
|
||||||
* @len: data length
|
|
||||||
*
|
*
|
||||||
* Packs data using method used on all newer DigiTech products.
|
* Packs data using method used on all newer DigiTech products.
|
||||||
*
|
*
|
||||||
* Return value: GString containing packed data
|
* \return GString containing packed data
|
||||||
**/
|
**/
|
||||||
GString *pack_data(gchar *data, gint len)
|
GString *pack_data(gchar *data, gint len)
|
||||||
{
|
{
|
||||||
@@ -131,8 +126,7 @@ GString *pack_data(gchar *data, gint len)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* unpack_message:
|
* \param msg message to unpack
|
||||||
* @msg: message to unpack
|
|
||||||
*
|
*
|
||||||
* Unpacks message data. This function modifies given GString.
|
* Unpacks message data. This function modifies given GString.
|
||||||
**/
|
**/
|
||||||
@@ -175,11 +169,9 @@ static void unpack_message(GString *msg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* read_data:
|
|
||||||
*
|
|
||||||
* Reads data from MIDI IN. This function uses global input variable.
|
* Reads data from MIDI IN. This function uses global input variable.
|
||||||
*
|
*
|
||||||
* Return value: GString containing data, or NULL when no data was read.
|
* \return GString containing data, or NULL when no data was read.
|
||||||
**/
|
**/
|
||||||
GString* read_data()
|
GString* read_data()
|
||||||
{
|
{
|
||||||
@@ -245,10 +237,9 @@ GString* read_data()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* send_message:
|
* \param procedure procedure ID
|
||||||
* @procedure: procedure ID
|
* \param data unpacked message data
|
||||||
* @data: unpacked message data
|
* \param len data length
|
||||||
* @len: data length
|
|
||||||
*
|
*
|
||||||
* Creates SysEx message then sends it. This function uses folowing global variables: device_id, family_id and product_id.
|
* Creates SysEx message then sends it. This function uses folowing global variables: device_id, family_id and product_id.
|
||||||
**/
|
**/
|
||||||
@@ -278,16 +269,15 @@ void send_message(gint procedure, gchar *data, gint len)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get_message_id:
|
* \param msg SysEx message
|
||||||
* @msg: SysEx message
|
|
||||||
*
|
*
|
||||||
* Checks message ID.
|
* Checks message ID.
|
||||||
*
|
*
|
||||||
* Return value: MessageID, or -1 on error.
|
* \return MessageID, or -1 on error.
|
||||||
**/
|
**/
|
||||||
static MessageID get_message_id(GString *msg)
|
static MessageID get_message_id(GString *msg)
|
||||||
{
|
{
|
||||||
/* TODO: sanity checks */
|
/** \todo check if msg is valid SysEx message */
|
||||||
g_return_val_if_fail(msg != NULL, -1);
|
g_return_val_if_fail(msg != NULL, -1);
|
||||||
|
|
||||||
if (msg->len > 7) {
|
if (msg->len > 7) {
|
||||||
@@ -297,12 +287,11 @@ static MessageID get_message_id(GString *msg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get_message_by_id:
|
* \param id MessageID of requested message
|
||||||
* @id: MessageID of requested message
|
|
||||||
*
|
*
|
||||||
* Reads data from MIDI IN until message with matching id is found.
|
* Reads data from MIDI IN until message with matching id is found.
|
||||||
*
|
*
|
||||||
* Return value: GString containing unpacked message.
|
* \return GString containing unpacked message.
|
||||||
**/
|
**/
|
||||||
GString *get_message_by_id(MessageID id)
|
GString *get_message_by_id(MessageID id)
|
||||||
{
|
{
|
||||||
@@ -320,9 +309,8 @@ GString *get_message_by_id(MessageID id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* append_value:
|
* \param msg message to append value
|
||||||
* @msg: message to append value
|
* \param value value to append
|
||||||
* @value: value to append
|
|
||||||
*
|
*
|
||||||
* Packs value using scheme used on all newer DigiTech products.
|
* Packs value using scheme used on all newer DigiTech products.
|
||||||
**/
|
**/
|
||||||
@@ -354,10 +342,9 @@ void append_value(GString *msg, guint value)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set_option:
|
* \param id Parameter ID
|
||||||
* @id: Parameter ID
|
* \param position Parameter position
|
||||||
* @position: Parameter position
|
* \param value Parameter value
|
||||||
* @value: Parameter value
|
|
||||||
*
|
*
|
||||||
* Forms SysEx message to set parameter then sends it to device.
|
* Forms SysEx message to set parameter then sends it to device.
|
||||||
**/
|
**/
|
||||||
@@ -373,9 +360,8 @@ void set_option(guint id, guint position, guint value)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* switch_preset:
|
* \param bank preset bank
|
||||||
* @bank: preset bank
|
* \param x preset index
|
||||||
* @x: preset index
|
|
||||||
*
|
*
|
||||||
* Switches to selected preset.
|
* Switches to selected preset.
|
||||||
**/
|
**/
|
||||||
@@ -392,9 +378,8 @@ void switch_preset(guint bank, guint x)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* store_preset_name:
|
* \param x preset index
|
||||||
* @x: preset index
|
* \param name preset name
|
||||||
* @name: preset name
|
|
||||||
*
|
*
|
||||||
* Stores current edit buffer in user presets bank.
|
* Stores current edit buffer in user presets bank.
|
||||||
**/
|
**/
|
||||||
@@ -411,9 +396,8 @@ void store_preset_name(int x, const gchar *name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set_preset_name:
|
* \param x preset index
|
||||||
* @x: preset index
|
* \param name preset name
|
||||||
* @name: preset name
|
|
||||||
*
|
*
|
||||||
* Sets preset name.
|
* Sets preset name.
|
||||||
**/
|
**/
|
||||||
@@ -429,12 +413,11 @@ void set_preset_name(int x, gchar *name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* query_preset_names:
|
* \param bank preset bank
|
||||||
* @bank: preset bank
|
|
||||||
*
|
*
|
||||||
* Queries preset names.
|
* Queries preset names.
|
||||||
*
|
*
|
||||||
* Return value: GStrv which must be freed with g_strfreev, or NULL on error.
|
* \return GStrv which must be freed with g_strfreev, or NULL on error.
|
||||||
**/
|
**/
|
||||||
GStrv query_preset_names(gchar bank)
|
GStrv query_preset_names(gchar bank)
|
||||||
{
|
{
|
||||||
@@ -471,11 +454,9 @@ GStrv query_preset_names(gchar bank)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get_current_preset:
|
|
||||||
*
|
|
||||||
* Queries current edit buffer.
|
* Queries current edit buffer.
|
||||||
*
|
*
|
||||||
* Return value: GString containing RECEIVE_PRESET_PARAMETERS SysEx message.
|
* \return GString containing RECEIVE_PRESET_PARAMETERS SysEx message.
|
||||||
**/
|
**/
|
||||||
GString *get_current_preset()
|
GString *get_current_preset()
|
||||||
{
|
{
|
||||||
@@ -490,14 +471,13 @@ GString *get_current_preset()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* request_who_am_i:
|
* \param device_id Variable to hold device ID
|
||||||
* @device_id: Variable to hold device ID
|
* \param family_id Variable to hold family ID
|
||||||
* @family_id: Variable to hold family ID
|
* \param product_id Variable to hold product ID
|
||||||
* @product_id: Variable to hold product ID
|
|
||||||
*
|
*
|
||||||
* Requests device information.
|
* Requests device information.
|
||||||
*
|
*
|
||||||
* Return value: TRUE on success, FALSE on error.
|
* \return TRUE on success, FALSE on error.
|
||||||
**/
|
**/
|
||||||
static gboolean request_who_am_i(unsigned char *device_id, unsigned char *family_id,
|
static gboolean request_who_am_i(unsigned char *device_id, unsigned char *family_id,
|
||||||
unsigned char *product_id)
|
unsigned char *product_id)
|
||||||
@@ -555,11 +535,15 @@ static void request_device_configuration()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||||
|
|
||||||
static GOptionEntry options[] = {
|
static GOptionEntry options[] = {
|
||||||
{"device", 'd', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_STRING, &device, "MIDI device port to use", NULL},
|
{"device", 'd', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_STRING, &device, "MIDI device port to use", NULL},
|
||||||
{NULL}
|
{NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
GOptionContext *context;
|
GOptionContext *context;
|
||||||
|
|||||||
4
gdigi.h
4
gdigi.h
@@ -20,6 +20,8 @@
|
|||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include <glib-object.h>
|
#include <glib-object.h>
|
||||||
|
|
||||||
|
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
WAH_TYPE_CRY = 132,
|
WAH_TYPE_CRY = 132,
|
||||||
WAH_TYPE_FULLRANGE = 133,
|
WAH_TYPE_FULLRANGE = 133,
|
||||||
@@ -539,6 +541,8 @@ enum {
|
|||||||
#define USB_AUDIO_PLAYBACK_MIX 12297
|
#define USB_AUDIO_PLAYBACK_MIX 12297
|
||||||
#define USB_AUDIO_LEVEL 12307
|
#define USB_AUDIO_LEVEL 12307
|
||||||
|
|
||||||
|
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
PRESETS_SYSTEM = 0,
|
PRESETS_SYSTEM = 0,
|
||||||
PRESETS_USER = 1,
|
PRESETS_USER = 1,
|
||||||
|
|||||||
160
gui.c
160
gui.c
@@ -22,27 +22,32 @@
|
|||||||
#include "gtkknob.h"
|
#include "gtkknob.h"
|
||||||
#include "knob.h"
|
#include "knob.h"
|
||||||
|
|
||||||
|
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||||
|
|
||||||
extern EffectList effects[];
|
extern EffectList effects[];
|
||||||
extern int n_effects;
|
extern int n_effects;
|
||||||
|
|
||||||
|
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
GtkObject *widget;
|
GtkObject *widget;
|
||||||
gint id;
|
gint id;
|
||||||
gint position;
|
gint position;
|
||||||
|
|
||||||
/* used for combo boxes, if widget isn't combo box, then both value and x are -1 */
|
/* used for combo boxes, if widget isn't combo box, then both value and x are -1 */
|
||||||
gint value; /* effect type value */
|
gint value; /**< effect type value */
|
||||||
gint x; /* combo box item number */
|
gint x; /**< combo box item number */
|
||||||
} WidgetListElem;
|
} WidgetListElem;
|
||||||
|
|
||||||
|
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||||
static GtkKnobAnim *knob_anim = NULL; /* animation used by knobs */
|
static GtkKnobAnim *knob_anim = NULL; /* animation used by knobs */
|
||||||
static GList *widget_list = NULL; /* this list contains WidgetListElem data elements */
|
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
|
||||||
static gboolean allow_send = FALSE; /* if FALSE GUI parameter changes won't be sent to device */
|
static GList *widget_list = NULL; /**< this list contains WidgetListElem data elements */
|
||||||
|
static gboolean allow_send = FALSE; /**< if FALSE GUI parameter changes won't be sent to device */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* show_error_message:
|
* \param parent transient parent, or NULL for none
|
||||||
* @parent: transient parent, or NULL for none
|
* \param message error description
|
||||||
* @message: error description
|
|
||||||
*
|
*
|
||||||
* Shows error message dialog.
|
* Shows error message dialog.
|
||||||
**/
|
**/
|
||||||
@@ -61,9 +66,8 @@ void show_error_message(GtkWidget *parent, gchar *message)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* value_changed_option_cb:
|
* \param adj the object which emitted the signal
|
||||||
* @adj: the object which emitted the signal
|
* \param setting setting controlled by adj
|
||||||
* @setting: setting controlled by adj
|
|
||||||
*
|
*
|
||||||
* Sets effect value.
|
* Sets effect value.
|
||||||
**/
|
**/
|
||||||
@@ -93,9 +97,8 @@ void value_changed_option_cb(GtkAdjustment *adj, EffectSettings *setting)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* toggled_cb:
|
* \param button the object which emitted the signal
|
||||||
* @button: the object which emitted the signal
|
* \param effect effect controlled by button
|
||||||
* @effect: effect controlled by button
|
|
||||||
*
|
*
|
||||||
* Turns effect on/off basing on state of button.
|
* Turns effect on/off basing on state of button.
|
||||||
**/
|
**/
|
||||||
@@ -110,12 +113,11 @@ void toggled_cb(GtkToggleButton *button, Effect *effect)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* widget_list_add:
|
* \param widget GtkObject to add to widget list
|
||||||
* @widget: GtkObject to add to widget list
|
* \param id object controlled ID
|
||||||
* @id: object controlled ID
|
* \param position object controlled position
|
||||||
* @position: object controlled position
|
* \param value effect value type (if widget is GtkComboBox, otherwise -1)
|
||||||
* @value: effect value type (if widget is GtkComboBox, otherwise -1)
|
* \param x combo box item number (if widget is GtkComboBox, otherwise -1)
|
||||||
* @x: combo box item number (if widget is GtkComboBox, otherwise -1)
|
|
||||||
*
|
*
|
||||||
* Adds widget to widget list.
|
* Adds widget to widget list.
|
||||||
**/
|
**/
|
||||||
@@ -134,9 +136,8 @@ static void widget_list_add(GtkObject *widget, gint id, gint position, gint valu
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* apply_widget_setting:
|
* \param el widget list element
|
||||||
* @el: widget list element
|
* \param param parameter to set
|
||||||
* @param: parameter to set
|
|
||||||
*
|
*
|
||||||
* Sets widget list element value to param value.
|
* Sets widget list element value to param value.
|
||||||
**/
|
**/
|
||||||
@@ -156,8 +157,7 @@ static void apply_widget_setting(WidgetListElem *el, SettingParam *param)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* apply_preset_to_gui:
|
* \param preset preset to sync
|
||||||
* @preset: preset to sync
|
|
||||||
*
|
*
|
||||||
* Synces GUI with preset.
|
* Synces GUI with preset.
|
||||||
**/
|
**/
|
||||||
@@ -181,8 +181,6 @@ static void apply_preset_to_gui(Preset *preset)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* apply_current_preset:
|
|
||||||
*
|
|
||||||
* Synces GUI with device current edit buffer.
|
* Synces GUI with device current edit buffer.
|
||||||
**/
|
**/
|
||||||
static void apply_current_preset()
|
static void apply_current_preset()
|
||||||
@@ -195,13 +193,12 @@ static void apply_current_preset()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* create_table:
|
* \param settings effect parameters
|
||||||
* @settings: effect parameters
|
* \param amt amount of effect parameters
|
||||||
* @amt: amount of effect parameters
|
|
||||||
*
|
*
|
||||||
* Creates knobs that allow user to set effect parameters.
|
* Creates knobs that allow user to set effect parameters.
|
||||||
*
|
*
|
||||||
* Return value: GtkTable containing necessary widgets to set effect parameters.
|
* \return GtkTable containing necessary widgets to set effect parameters.
|
||||||
**/
|
**/
|
||||||
GtkWidget *create_table(EffectSettings *settings, gint amt)
|
GtkWidget *create_table(EffectSettings *settings, gint amt)
|
||||||
{
|
{
|
||||||
@@ -240,12 +237,11 @@ GtkWidget *create_table(EffectSettings *settings, gint amt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* create_on_off_button:
|
* \param effect Effect that can be turned on/off
|
||||||
* @effect: Effect that can be turned on/off
|
|
||||||
*
|
*
|
||||||
* Creates toggle button that allow user to turn effect on/off.
|
* Creates toggle button that allow user to turn effect on/off.
|
||||||
*
|
*
|
||||||
* Return value: GtkToggleButton
|
* \return GtkToggleButton
|
||||||
**/
|
**/
|
||||||
GtkWidget *create_on_off_button(Effect *effect)
|
GtkWidget *create_on_off_button(Effect *effect)
|
||||||
{
|
{
|
||||||
@@ -257,15 +253,14 @@ GtkWidget *create_on_off_button(Effect *effect)
|
|||||||
}
|
}
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
gint type; /* effect group type (value) */
|
gint type; /**< effect group type (value) */
|
||||||
gint id; /* option ID */
|
gint id; /**< option ID */
|
||||||
gint position; /* position */
|
gint position; /**< position */
|
||||||
GtkWidget *child; /* child widget */
|
GtkWidget *child; /**< child widget */
|
||||||
} EffectSettingsGroup;
|
} EffectSettingsGroup;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* effect_settings_group_free:
|
* \param group group to be freed
|
||||||
* @group: group to be freed
|
|
||||||
*
|
*
|
||||||
* Frees all memory used by group
|
* Frees all memory used by group
|
||||||
**/
|
**/
|
||||||
@@ -280,9 +275,8 @@ void effect_settings_group_free(EffectSettingsGroup *group)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* combo_box_changed_cb:
|
* \param widget the object which emitted the signal
|
||||||
* @widget: the object which emitted the signal
|
* \param data user data (unused, can be anything)
|
||||||
* @data: user data (unused, can be anything)
|
|
||||||
*
|
*
|
||||||
* Switches effect type and shows widgets allowing to set selected effect type parameters.
|
* Switches effect type and shows widgets allowing to set selected effect type parameters.
|
||||||
**/
|
**/
|
||||||
@@ -316,13 +310,12 @@ void combo_box_changed_cb(GtkComboBox *widget, gpointer data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* create_widget_container:
|
* \param group Effect type groups
|
||||||
* @group: Effect type groups
|
* \param amt amount of effect groups
|
||||||
* @amt: amount of effect groups
|
|
||||||
*
|
*
|
||||||
* Creates widget allowing user to choose effect type.
|
* Creates widget allowing user to choose effect type.
|
||||||
*
|
*
|
||||||
* Return value: widget that allow user to set effect type.
|
* \return widget that allow user to set effect type.
|
||||||
**/
|
**/
|
||||||
GtkWidget *create_widget_container(EffectGroup *group, gint amt)
|
GtkWidget *create_widget_container(EffectGroup *group, gint amt)
|
||||||
{
|
{
|
||||||
@@ -370,13 +363,12 @@ GtkWidget *create_widget_container(EffectGroup *group, gint amt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* create_vbox:
|
* \param widgets Effect descriptions
|
||||||
* @widgets: Effect descriptions
|
* \param amt amount of effect descriptions
|
||||||
* @amt: amount of effect descriptions
|
|
||||||
*
|
*
|
||||||
* Creates vbox containing widgets allowing user to set effect options.
|
* Creates vbox containing widgets allowing user to set effect options.
|
||||||
*
|
*
|
||||||
* Return value: widget that allow user to set effect options.
|
* \return widget that allow user to set effect options.
|
||||||
**/
|
**/
|
||||||
GtkWidget *create_vbox(Effect *widgets, gint amt)
|
GtkWidget *create_vbox(Effect *widgets, gint amt)
|
||||||
{
|
{
|
||||||
@@ -411,11 +403,10 @@ enum {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* row_activate_cb:
|
* \param treeview the object which emitted the signal
|
||||||
* @treeview: the object which emitted the signal
|
* \param path the GtkTreePath for the activated row
|
||||||
* @path: the GtkTreePath for the activated row
|
* \param column the GtkTreeViewColumn in which the activation occurred
|
||||||
* @column: the GtkTreeViewColumn in which the activation occurred
|
* \param model model holding preset names
|
||||||
* @model: model holding preset names
|
|
||||||
*
|
*
|
||||||
* Sets active device preset to preset selected by user.
|
* Sets active device preset to preset selected by user.
|
||||||
**/
|
**/
|
||||||
@@ -434,10 +425,9 @@ void row_activate_cb(GtkTreeView *treeview, GtkTreePath *path, GtkTreeViewColumn
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* fill_store_with_presets:
|
* \param model model to fill
|
||||||
* @model: model to fill
|
* \param bank preset bank
|
||||||
* @bank: preset bank
|
* \param name preset bank description visible to user
|
||||||
* @name: preset bank description visible to user
|
|
||||||
*
|
*
|
||||||
* Appends to model preset names found in device preset bank.
|
* Appends to model preset names found in device preset bank.
|
||||||
**/
|
**/
|
||||||
@@ -469,8 +459,7 @@ static void fill_store_with_presets(GtkTreeStore *model, guint bank, gchar *name
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* fill_store:
|
* \param model model to fill
|
||||||
* @model: model to fill
|
|
||||||
*
|
*
|
||||||
* Fills model with preset names found on device.
|
* Fills model with preset names found on device.
|
||||||
**/
|
**/
|
||||||
@@ -481,11 +470,9 @@ static void fill_store(GtkTreeStore *model)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* create_preset_tree:
|
|
||||||
*
|
|
||||||
* Creates treeview showing list of presets available on device.
|
* Creates treeview showing list of presets available on device.
|
||||||
*
|
*
|
||||||
* Return value: treeview containing all preset names found on device.
|
* \return treeview containing all preset names found on device.
|
||||||
**/
|
**/
|
||||||
GtkWidget *create_preset_tree()
|
GtkWidget *create_preset_tree()
|
||||||
{
|
{
|
||||||
@@ -513,9 +500,8 @@ GtkWidget *create_preset_tree()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* show_store_preset_window:
|
* \param window application toplevel window
|
||||||
* @window: application toplevel window
|
* \param default_name default preset name
|
||||||
* @default_name: default preset name
|
|
||||||
*
|
*
|
||||||
* Shows window allowing user to store current edit buffer.
|
* Shows window allowing user to store current edit buffer.
|
||||||
**/
|
**/
|
||||||
@@ -568,8 +554,7 @@ static void show_store_preset_window(GtkWidget *window, gchar *default_name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* action_store_cb:
|
* \param action the object which emitted the signal
|
||||||
* @action: the object which emitted the signal
|
|
||||||
*
|
*
|
||||||
* Shows store preset window.
|
* Shows store preset window.
|
||||||
**/
|
**/
|
||||||
@@ -580,8 +565,7 @@ static void action_store_cb(GtkAction *action)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* action_show_about_dialog_cb:
|
* \param action the object which emitted the signal
|
||||||
* @action: the object which emitted the signal
|
|
||||||
*
|
*
|
||||||
* Shows about dialog.
|
* Shows about dialog.
|
||||||
**/
|
**/
|
||||||
@@ -603,6 +587,8 @@ static void action_show_about_dialog_cb(GtkAction *action)
|
|||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
gchar *name;
|
gchar *name;
|
||||||
gchar *suffix;
|
gchar *suffix;
|
||||||
@@ -611,11 +597,13 @@ typedef struct {
|
|||||||
static SupportedFileTypes file_types[] = {
|
static SupportedFileTypes file_types[] = {
|
||||||
{"RP250Preset", "*.rp250p"},
|
{"RP250Preset", "*.rp250p"},
|
||||||
};
|
};
|
||||||
|
|
||||||
static guint n_file_types = G_N_ELEMENTS(file_types);
|
static guint n_file_types = G_N_ELEMENTS(file_types);
|
||||||
|
|
||||||
|
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* action_open_preset_cb:
|
* \param action the object which emitted the signal
|
||||||
* @action: the object which emitted the signal
|
|
||||||
*
|
*
|
||||||
* Shows file chooser dialog.
|
* Shows file chooser dialog.
|
||||||
* If user opens valid preset file, the preset gets applied to edit buffer and store preset window is shown.
|
* If user opens valid preset file, the preset gets applied to edit buffer and store preset window is shown.
|
||||||
@@ -706,8 +694,7 @@ static void action_open_preset_cb(GtkAction *action)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* widget_list_free:
|
* \param list widget list to be freed
|
||||||
* @list: widget list to be freed
|
|
||||||
*
|
*
|
||||||
* Frees all memory used by widget list.
|
* Frees all memory used by widget list.
|
||||||
*/
|
*/
|
||||||
@@ -721,8 +708,7 @@ static void widget_list_free(GList *list)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* action_quit_cb:
|
* \param action the object which emitted the signal
|
||||||
* @action: the object which emitted the signal
|
|
||||||
*
|
*
|
||||||
* Destroys action object "window" data, then stops gtk main loop.
|
* Destroys action object "window" data, then stops gtk main loop.
|
||||||
**/
|
**/
|
||||||
@@ -734,6 +720,8 @@ static void action_quit_cb(GtkAction *action)
|
|||||||
gtk_main_quit();
|
gtk_main_quit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||||
|
|
||||||
static GtkActionEntry entries[] = {
|
static GtkActionEntry entries[] = {
|
||||||
{"File", NULL, "_File"},
|
{"File", NULL, "_File"},
|
||||||
{"Preset", NULL, "_Preset"},
|
{"Preset", NULL, "_Preset"},
|
||||||
@@ -762,11 +750,12 @@ static const gchar *menu_info =
|
|||||||
" </menubar>"
|
" </menubar>"
|
||||||
"</ui>";
|
"</ui>";
|
||||||
|
|
||||||
|
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* add_action_data:
|
* \param ui GtkUIManager to lookup actions
|
||||||
* @ui: GtkUIManager to lookup actions
|
* \param path path to action
|
||||||
* @path: path to action
|
* \param window toplevel window
|
||||||
* @window: toplevel window
|
|
||||||
*
|
*
|
||||||
* Sets action object "window" data to toplevel window.
|
* Sets action object "window" data to toplevel window.
|
||||||
**/
|
**/
|
||||||
@@ -781,9 +770,8 @@ static void add_action_data(GtkUIManager *ui, const gchar *path, GtkWidget *wind
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* add_menubar:
|
* \param window toplevel window
|
||||||
* @window: toplevel window
|
* \param vbox vbox to hold menubar
|
||||||
* @vbox: vbox to hold menubar
|
|
||||||
*
|
*
|
||||||
* Creates menubar (adds accel group to toplevel window as well) and packs it into vbox.
|
* Creates menubar (adds accel group to toplevel window as well) and packs it into vbox.
|
||||||
**/
|
**/
|
||||||
@@ -819,8 +807,6 @@ static void add_menubar(GtkWidget *window, GtkWidget *vbox)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gui_create:
|
|
||||||
*
|
|
||||||
* Creates main window.
|
* Creates main window.
|
||||||
**/
|
**/
|
||||||
void gui_create()
|
void gui_create()
|
||||||
@@ -871,8 +857,6 @@ void gui_create()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gui_free:
|
|
||||||
*
|
|
||||||
* Frees memory allocated by gui_create which is not explicitly freed when main window is destroyed.
|
* Frees memory allocated by gui_create which is not explicitly freed when main window is destroyed.
|
||||||
**/
|
**/
|
||||||
void gui_free()
|
void gui_free()
|
||||||
|
|||||||
17
preset.c
17
preset.c
@@ -19,6 +19,8 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "preset.h"
|
#include "preset.h"
|
||||||
|
|
||||||
|
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
PARSER_TYPE_NOT_SET = -1,
|
PARSER_TYPE_NOT_SET = -1,
|
||||||
PARSER_TYPE_PRESET_NAME = 0,
|
PARSER_TYPE_PRESET_NAME = 0,
|
||||||
@@ -112,13 +114,14 @@ static void XMLCALL text_cb(void *data, const char* text, int len)
|
|||||||
g_free(value);
|
g_free(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* create_preset_from_xml_file:
|
* \param filename valid path to file
|
||||||
* @filename: valid path to file
|
|
||||||
*
|
*
|
||||||
* Tries to open file pointed by path, then parses it.
|
* Tries to open file pointed by path, then parses it.
|
||||||
*
|
*
|
||||||
* Return value: Preset which must be freed using preset_free, or NULL on error.
|
* \return Preset which must be freed using preset_free, or NULL on error.
|
||||||
**/
|
**/
|
||||||
Preset *create_preset_from_xml_file(gchar *filename)
|
Preset *create_preset_from_xml_file(gchar *filename)
|
||||||
{
|
{
|
||||||
@@ -170,12 +173,11 @@ Preset *create_preset_from_xml_file(gchar *filename)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* create_preset_from_data:
|
* \param data unpacked RECEIVE_PRESET_PARAMETERS message
|
||||||
* @data: unpacked RECEIVE_PRESET_PARAMETERS message
|
|
||||||
*
|
*
|
||||||
* Parses message
|
* Parses message
|
||||||
*
|
*
|
||||||
* Return value: Preset which must be freed using preset_free, or NULL on error.
|
* \return Preset which must be freed using preset_free, or NULL on error.
|
||||||
**/
|
**/
|
||||||
Preset *create_preset_from_data(GString *data)
|
Preset *create_preset_from_data(GString *data)
|
||||||
{
|
{
|
||||||
@@ -226,8 +228,7 @@ Preset *create_preset_from_data(GString *data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* preset_free:
|
* \param preset preset to be freed
|
||||||
* @preset: preset to be freed
|
|
||||||
*
|
*
|
||||||
* Frees all memory used by preset.
|
* Frees all memory used by preset.
|
||||||
**/
|
**/
|
||||||
|
|||||||
Reference in New Issue
Block a user