Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
991527418a | ||
|
|
96317d5ac5 | ||
|
|
d24cc97f5d | ||
|
|
cac7e74d71 | ||
|
|
74583e9a7c | ||
|
|
03c3c48ecf | ||
|
|
aa2cc7bbb1 | ||
|
|
ec14a41869 |
382
effects.c
382
effects.c
@@ -17,6 +17,8 @@
|
||||
#include "gdigi.h"
|
||||
#include "effects.h"
|
||||
|
||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||
|
||||
static gchar *wave_labels[] = {
|
||||
"Tri",
|
||||
"Sine",
|
||||
@@ -115,22 +117,22 @@ static EffectValues values_0_to_15 = {
|
||||
};
|
||||
|
||||
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,
|
||||
};
|
||||
|
||||
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,
|
||||
};
|
||||
|
||||
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,
|
||||
};
|
||||
|
||||
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,
|
||||
};
|
||||
|
||||
@@ -155,12 +157,12 @@ static EffectValues values_ips_scale = {
|
||||
};
|
||||
|
||||
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,
|
||||
};
|
||||
|
||||
static EffectValues values_delay_repeats = {
|
||||
/* TODO: make last value display propertly */
|
||||
/** \todo make last value display propertly */
|
||||
0.0, 100.0, NULL,
|
||||
};
|
||||
|
||||
@@ -173,293 +175,292 @@ static EffectValues values_pickup_type = {
|
||||
};
|
||||
|
||||
static EffectSettings wah_settings[] = {
|
||||
{"Wah min", WAH_MIN, WAH_POSITION_MIN_MAX, &values_0_to_99},
|
||||
{"Wah max", WAH_MAX, WAH_POSITION_MIN_MAX, &values_0_to_99},
|
||||
{"Wah level", WAH_LEVEL, WAH_POSITION, &values_0_to_12},
|
||||
{"Min", WAH_MIN, WAH_POSITION_MIN_MAX, &values_0_to_99},
|
||||
{"Max", WAH_MAX, WAH_POSITION_MIN_MAX, &values_0_to_99},
|
||||
{"Level", WAH_LEVEL, WAH_POSITION, &values_0_to_12},
|
||||
};
|
||||
|
||||
static EffectSettings comp_digi_settings[] = {
|
||||
{"Compressor sustain", COMP_SUSTAIN, COMP_POSITION, &values_0_to_99},
|
||||
{"Compressor tone", COMP_TONE, COMP_POSITION, &values_0_to_99},
|
||||
{"Compressor attack", COMP_ATTACK, COMP_POSITION, &values_0_to_99},
|
||||
{"Compressor level", COMP_LEVEL, COMP_POSITION, &values_0_to_99},
|
||||
{"Sustain", COMP_SUSTAIN, COMP_POSITION, &values_0_to_99},
|
||||
{"Tone", COMP_TONE, COMP_POSITION, &values_0_to_99},
|
||||
{"Attack", COMP_ATTACK, COMP_POSITION, &values_0_to_99},
|
||||
{"Level", COMP_LEVEL, COMP_POSITION, &values_0_to_99},
|
||||
};
|
||||
|
||||
static EffectSettings comp_cs_settings[] = {
|
||||
{"Compressor sustain", COMP_SUSTAIN, COMP_POSITION, &values_0_to_99},
|
||||
{"Compressor attack", COMP_ATTACK, COMP_POSITION, &values_0_to_99},
|
||||
{"Compressor level", COMP_LEVEL, COMP_POSITION, &values_0_to_99},
|
||||
{"Sustain", COMP_SUSTAIN, COMP_POSITION, &values_0_to_99},
|
||||
{"Attack", COMP_ATTACK, COMP_POSITION, &values_0_to_99},
|
||||
{"Level", COMP_LEVEL, COMP_POSITION, &values_0_to_99},
|
||||
};
|
||||
|
||||
static EffectSettings dist_screamer_settings[] = {
|
||||
{"Screamer drive", DIST_SCREAMER_DRIVE, DIST_POSITION, &values_0_to_99},
|
||||
{"Screamer tone", DIST_SCREAMER_TONE, DIST_POSITION, &values_0_to_99},
|
||||
{"Screamer level", DIST_SCREAMER_LVL, DIST_POSITION, &values_0_to_99},
|
||||
{"Drive", DIST_SCREAMER_DRIVE, DIST_POSITION, &values_0_to_99},
|
||||
{"Tone", DIST_SCREAMER_TONE, DIST_POSITION, &values_0_to_99},
|
||||
{"Level", DIST_SCREAMER_LVL, DIST_POSITION, &values_0_to_99},
|
||||
};
|
||||
|
||||
static EffectSettings dist_808_settings[] = {
|
||||
{"808 overdrive", DIST_808_OVERDRIVE, DIST_POSITION, &values_0_to_99},
|
||||
{"808 tone", DIST_808_TONE, DIST_POSITION, &values_0_to_99},
|
||||
{"808 level", DIST_808_LVL, DIST_POSITION, &values_0_to_99},
|
||||
{"Overdrive", DIST_808_OVERDRIVE, DIST_POSITION, &values_0_to_99},
|
||||
{"Tone", DIST_808_TONE, DIST_POSITION, &values_0_to_99},
|
||||
{"Level", DIST_808_LVL, DIST_POSITION, &values_0_to_99},
|
||||
};
|
||||
|
||||
static EffectSettings dist_guyod_settings[] = {
|
||||
{"GuyOD drive", DIST_GUYOD_DRIVE, DIST_POSITION, &values_0_to_99},
|
||||
{"GuyOD level", DIST_GUYOD_LVL, DIST_POSITION, &values_0_to_99},
|
||||
{"Drive", DIST_GUYOD_DRIVE, DIST_POSITION, &values_0_to_99},
|
||||
{"Level", DIST_GUYOD_LVL, DIST_POSITION, &values_0_to_99},
|
||||
};
|
||||
|
||||
static EffectSettings dist_dod250_settings[] = {
|
||||
{"DOD250 gain", DIST_DOD250_GAIN, DIST_POSITION, &values_0_to_99},
|
||||
{"DOD250 level", DIST_DOD250_LVL, DIST_POSITION, &values_0_to_99},
|
||||
{"Gain", DIST_DOD250_GAIN, DIST_POSITION, &values_0_to_99},
|
||||
{"Level", DIST_DOD250_LVL, DIST_POSITION, &values_0_to_99},
|
||||
};
|
||||
|
||||
static EffectSettings dist_rodent_settings[] = {
|
||||
{"Rodent dist", DIST_RODENT_DIST, DIST_POSITION, &values_0_to_99},
|
||||
{"Rodent filter", DIST_RODENT_FILTER, DIST_POSITION, &values_0_to_99},
|
||||
{"Rodent level", DIST_RODENT_LVL, DIST_POSITION, &values_0_to_99},
|
||||
{"Dist", DIST_RODENT_DIST, DIST_POSITION, &values_0_to_99},
|
||||
{"Filter", DIST_RODENT_FILTER, DIST_POSITION, &values_0_to_99},
|
||||
{"Level", DIST_RODENT_LVL, DIST_POSITION, &values_0_to_99},
|
||||
};
|
||||
|
||||
static EffectSettings dist_mx_settings[] = {
|
||||
{"MX dist", DIST_MX_DIST, DIST_POSITION, &values_0_to_99},
|
||||
{"MX output", DIST_MX_OUTPUT, DIST_POSITION, &values_0_to_99},
|
||||
{"Dist", DIST_MX_DIST, DIST_POSITION, &values_0_to_99},
|
||||
{"Output", DIST_MX_OUTPUT, DIST_POSITION, &values_0_to_99},
|
||||
};
|
||||
|
||||
static EffectSettings dist_ds_settings[] = {
|
||||
{"DS gain", DIST_DS_GAIN, DIST_POSITION, &values_0_to_99},
|
||||
{"DS tone", DIST_DS_TONE, DIST_POSITION, &values_0_to_99},
|
||||
{"DS level", DIST_DS_LVL, DIST_POSITION, &values_0_to_99},
|
||||
{"Gain", DIST_DS_GAIN, DIST_POSITION, &values_0_to_99},
|
||||
{"Tone", DIST_DS_TONE, DIST_POSITION, &values_0_to_99},
|
||||
{"Level", DIST_DS_LVL, DIST_POSITION, &values_0_to_99},
|
||||
};
|
||||
|
||||
static EffectSettings dist_grunge_settings[] = {
|
||||
{"Grunge", DIST_GRUNGE_GRUNGE, DIST_POSITION, &values_0_to_99},
|
||||
{"Grunge face", DIST_GRUNGE_FACE, DIST_POSITION, &values_0_to_99},
|
||||
{"Grunge loud", DIST_GRUNGE_LOUD, DIST_POSITION, &values_0_to_99},
|
||||
{"Grunge butt", DIST_GRUNGE_BUTT, DIST_POSITION, &values_0_to_99},
|
||||
{"Face", DIST_GRUNGE_FACE, DIST_POSITION, &values_0_to_99},
|
||||
{"Loud", DIST_GRUNGE_LOUD, DIST_POSITION, &values_0_to_99},
|
||||
{"Butt", DIST_GRUNGE_BUTT, DIST_POSITION, &values_0_to_99},
|
||||
};
|
||||
|
||||
static EffectSettings dist_zone_settings[] = {
|
||||
{"Zone gain", DIST_ZONE_GAIN, DIST_POSITION, &values_0_to_99},
|
||||
{"Zone low", DIST_ZONE_LOW, DIST_POSITION, &values_0_to_99},
|
||||
{"Zone mid level", DIST_ZONE_MID_LVL, DIST_POSITION, &values_0_to_99},
|
||||
{"Zone mid freq", DIST_ZONE_MID_FREQ, DIST_POSITION, &values_0_to_99},
|
||||
{"Zone high", DIST_ZONE_HIGH, DIST_POSITION, &values_0_to_99},
|
||||
{"Zone level", DIST_ZONE_LEVEL, DIST_POSITION, &values_0_to_99},
|
||||
{"Gain", DIST_ZONE_GAIN, DIST_POSITION, &values_0_to_99},
|
||||
{"Low", DIST_ZONE_LOW, DIST_POSITION, &values_0_to_99},
|
||||
{"Mid level", DIST_ZONE_MID_LVL, DIST_POSITION, &values_0_to_99},
|
||||
{"Mid freq", DIST_ZONE_MID_FREQ, DIST_POSITION, &values_0_to_99},
|
||||
{"High", DIST_ZONE_HIGH, DIST_POSITION, &values_0_to_99},
|
||||
{"Level", DIST_ZONE_LEVEL, DIST_POSITION, &values_0_to_99},
|
||||
};
|
||||
|
||||
static EffectSettings dist_death_settings[] = {
|
||||
{"Death low", DIST_DEATH_LOW, DIST_POSITION, &values_0_to_99},
|
||||
{"Death mid", DIST_DEATH_MID, DIST_POSITION, &values_0_to_99},
|
||||
{"Death high", DIST_DEATH_HIGH, DIST_POSITION, &values_0_to_99},
|
||||
{"Death level", DIST_DEATH_LVL, DIST_POSITION, &values_0_to_99},
|
||||
{"Low", DIST_DEATH_LOW, DIST_POSITION, &values_0_to_99},
|
||||
{"Mid", DIST_DEATH_MID, DIST_POSITION, &values_0_to_99},
|
||||
{"High", DIST_DEATH_HIGH, DIST_POSITION, &values_0_to_99},
|
||||
{"Level", DIST_DEATH_LVL, DIST_POSITION, &values_0_to_99},
|
||||
};
|
||||
|
||||
static EffectSettings dist_gonk_settings[] = {
|
||||
{"Gonk gonk", DIST_GONK_GONK, DIST_POSITION, &values_0_to_99},
|
||||
{"Gonk smear", DIST_GONK_SMEAR, DIST_POSITION, &values_0_to_99},
|
||||
{"Gonk suck", DIST_GONK_SUCK, DIST_POSITION, &values_0_to_99},
|
||||
{"Gonk heave", DIST_GONK_HEAVE, DIST_POSITION, &values_0_to_99},
|
||||
{"Gonk", DIST_GONK_GONK, DIST_POSITION, &values_0_to_99},
|
||||
{"Smear", DIST_GONK_SMEAR, DIST_POSITION, &values_0_to_99},
|
||||
{"Suck", DIST_GONK_SUCK, DIST_POSITION, &values_0_to_99},
|
||||
{"Heave", DIST_GONK_HEAVE, DIST_POSITION, &values_0_to_99},
|
||||
};
|
||||
|
||||
static EffectSettings dist_fuzzy_settings[] = {
|
||||
{"Fuzzy fuzz", DIST_FUZZY_FUZZ, DIST_POSITION, &values_0_to_99},
|
||||
{"Fuzzy volume", DIST_FUZZY_VOLUME, DIST_POSITION, &values_0_to_99},
|
||||
{"Fuzz", DIST_FUZZY_FUZZ, DIST_POSITION, &values_0_to_99},
|
||||
{"Volume", DIST_FUZZY_VOLUME, DIST_POSITION, &values_0_to_99},
|
||||
};
|
||||
|
||||
static EffectSettings dist_mp_settings[] = {
|
||||
{"MP sustain", DIST_MP_SUSTAIN, DIST_POSITION, &values_0_to_99},
|
||||
{"MP tone", DIST_MP_TONE, DIST_POSITION, &values_0_to_99},
|
||||
{"MP volume", DIST_MP_VOLUME, DIST_POSITION, &values_0_to_99},
|
||||
{"Sustain", DIST_MP_SUSTAIN, DIST_POSITION, &values_0_to_99},
|
||||
{"Tone", DIST_MP_TONE, DIST_POSITION, &values_0_to_99},
|
||||
{"Volume", DIST_MP_VOLUME, DIST_POSITION, &values_0_to_99},
|
||||
};
|
||||
|
||||
static EffectSettings amp_settings[] = {
|
||||
{"AMP gain", AMP_GAIN, AMP_POSITION, &values_0_to_99},
|
||||
{"AMP level", AMP_LEVEL, AMP_POSITION, &values_0_to_99},
|
||||
{"Gain", AMP_GAIN, AMP_POSITION, &values_0_to_99},
|
||||
{"Level", AMP_LEVEL, AMP_POSITION, &values_0_to_99},
|
||||
};
|
||||
|
||||
static EffectSettings amp_settings2[] = {
|
||||
{"AMP level", AMP_LEVEL, AMP_POSITION, &values_0_to_99},
|
||||
{"Level", AMP_LEVEL, AMP_POSITION, &values_0_to_99},
|
||||
};
|
||||
|
||||
static EffectSettings eq_settings[] = {
|
||||
{"EQ bass", EQ_BASS, EQ_POSITION, &values_eq_db},
|
||||
{"EQ mid", EQ_MID, EQ_POSITION, &values_eq_db},
|
||||
{"EQ treble", EQ_TREBLE, EQ_POSITION, &values_eq_db},
|
||||
{"EQ mid Hz", EQ_MID_HZ, EQ_POSITION, &values_eq_mid_hz},
|
||||
{"EQ treb Hz", EQ_TREBLE_HZ, EQ_POSITION, &values_eq_treb_hz},
|
||||
{"Bass", EQ_BASS, EQ_POSITION, &values_eq_db},
|
||||
{"Mid", EQ_MID, EQ_POSITION, &values_eq_db},
|
||||
{"Treble", EQ_TREBLE, EQ_POSITION, &values_eq_db},
|
||||
{"Mid Hz", EQ_MID_HZ, EQ_POSITION, &values_eq_mid_hz},
|
||||
{"Treb Hz", EQ_TREBLE_HZ, EQ_POSITION, &values_eq_treb_hz},
|
||||
};
|
||||
|
||||
static EffectSettings noisegate_gate_settings[] = {
|
||||
{"Gate treshold", NOISEGATE_GATE_TRESHOLD, NOISEGATE_POSITION, &values_0_to_99},
|
||||
{"Gate attack", NOISEGATE_ATTACK, NOISEGATE_POSITION, &values_0_to_99},
|
||||
{"Gate release", NOISEGATE_RELEASE, NOISEGATE_POSITION, &values_0_to_99},
|
||||
{"Gate attn", NOISEGATE_ATTN, NOISEGATE_POSITION, &values_0_to_99},
|
||||
{"Treshold", NOISEGATE_GATE_TRESHOLD, NOISEGATE_POSITION, &values_0_to_99},
|
||||
{"Attack", NOISEGATE_ATTACK, NOISEGATE_POSITION, &values_0_to_99},
|
||||
{"Release", NOISEGATE_RELEASE, NOISEGATE_POSITION, &values_0_to_99},
|
||||
{"Attn", NOISEGATE_ATTN, NOISEGATE_POSITION, &values_0_to_99},
|
||||
};
|
||||
|
||||
static EffectSettings noisegate_swell_settings[] = {
|
||||
{"Swell sens", NOISEGATE_SWELL_SENS, NOISEGATE_POSITION, &values_0_to_99},
|
||||
{"Swell attack", NOISEGATE_ATTACK, NOISEGATE_POSITION, &values_0_to_99},
|
||||
{"Swell release", NOISEGATE_RELEASE, NOISEGATE_POSITION, &values_0_to_99},
|
||||
{"Swell attn", NOISEGATE_ATTN, NOISEGATE_POSITION, &values_0_to_99},
|
||||
{"Sens", NOISEGATE_SWELL_SENS, NOISEGATE_POSITION, &values_0_to_99},
|
||||
{"Attack", NOISEGATE_ATTACK, NOISEGATE_POSITION, &values_0_to_99},
|
||||
{"Release", NOISEGATE_RELEASE, NOISEGATE_POSITION, &values_0_to_99},
|
||||
{"Attn", NOISEGATE_ATTN, NOISEGATE_POSITION, &values_0_to_99},
|
||||
};
|
||||
|
||||
static EffectSettings chorusfx_ce_settings[] = {
|
||||
{"CE chorus speed", CE_CHORUS_SPEED, CHORUSFX_POSITION, &values_0_to_99},
|
||||
{"CE chorus depth", CE_CHORUS_DEPTH, CHORUSFX_POSITION, &values_0_to_99},
|
||||
{"Speed", CE_CHORUS_SPEED, CHORUSFX_POSITION, &values_0_to_99},
|
||||
{"Depth", CE_CHORUS_DEPTH, CHORUSFX_POSITION, &values_0_to_99},
|
||||
};
|
||||
|
||||
static EffectSettings chorusfx_dual_settings[] = {
|
||||
{"Dual chorus speed", DUAL_CHORUS_SPEED, CHORUSFX_POSITION, &values_0_to_99},
|
||||
{"Dual chorus depth", DUAL_CHORUS_DEPTH, CHORUSFX_POSITION, &values_0_to_99},
|
||||
{"Dual chorus level", DUAL_CHORUS_LEVEL, CHORUSFX_POSITION, &values_0_to_99},
|
||||
{"Dual chorus wave", DUAL_CHORUS_WAVE, CHORUSFX_POSITION, &values_waveform},
|
||||
{"Speed", DUAL_CHORUS_SPEED, CHORUSFX_POSITION, &values_0_to_99},
|
||||
{"Depth", DUAL_CHORUS_DEPTH, CHORUSFX_POSITION, &values_0_to_99},
|
||||
{"Level", DUAL_CHORUS_LEVEL, CHORUSFX_POSITION, &values_0_to_99},
|
||||
{"Wave", DUAL_CHORUS_WAVE, CHORUSFX_POSITION, &values_waveform},
|
||||
};
|
||||
|
||||
static EffectSettings chorusfx_multi_settings[] = {
|
||||
{"Multi chorus speed", MULTI_CHORUS_SPEED, CHORUSFX_POSITION, &values_0_to_99},
|
||||
{"Multi chorus depth", MULTI_CHORUS_DEPTH, CHORUSFX_POSITION, &values_0_to_99},
|
||||
{"Multi chorus level", MULTI_CHORUS_LEVEL, CHORUSFX_POSITION, &values_0_to_99},
|
||||
{"Multi chorus wave", MULTI_CHORUS_WAVE, CHORUSFX_POSITION, &values_waveform},
|
||||
{"Speed", MULTI_CHORUS_SPEED, CHORUSFX_POSITION, &values_0_to_99},
|
||||
{"Depth", MULTI_CHORUS_DEPTH, CHORUSFX_POSITION, &values_0_to_99},
|
||||
{"Level", MULTI_CHORUS_LEVEL, CHORUSFX_POSITION, &values_0_to_99},
|
||||
{"Wave", MULTI_CHORUS_WAVE, CHORUSFX_POSITION, &values_waveform},
|
||||
};
|
||||
|
||||
static EffectSettings chorusfx_flanger_settings[] = {
|
||||
{"Flanger speed", FLANGER_SPEED, CHORUSFX_POSITION, &values_0_to_99},
|
||||
{"Flanger depth", FLANGER_DEPTH, CHORUSFX_POSITION, &values_0_to_99},
|
||||
{"Flanger regen", FLANGER_REGEN, CHORUSFX_POSITION, &values_0_to_99},
|
||||
{"Flanger level", FLANGER_LEVEL, CHORUSFX_POSITION, &values_0_to_99},
|
||||
{"Flanger wave", FLANGER_WAVE, CHORUSFX_POSITION, &values_waveform},
|
||||
{"Speed", FLANGER_SPEED, CHORUSFX_POSITION, &values_0_to_99},
|
||||
{"Depth", FLANGER_DEPTH, CHORUSFX_POSITION, &values_0_to_99},
|
||||
{"Regen", FLANGER_REGEN, CHORUSFX_POSITION, &values_0_to_99},
|
||||
{"Level", FLANGER_LEVEL, CHORUSFX_POSITION, &values_0_to_99},
|
||||
{"Wave", FLANGER_WAVE, CHORUSFX_POSITION, &values_waveform},
|
||||
};
|
||||
|
||||
static EffectSettings chorusfx_mxr_flanger_settings[] = {
|
||||
{"MXR flanger speed", MXR_FLANGER_SPEED, CHORUSFX_POSITION, &values_0_to_99},
|
||||
{"MXR flanger width", MXR_FLANGER_WIDTH, CHORUSFX_POSITION, &values_0_to_99},
|
||||
{"MXR flanger regen", MXR_FLANGER_REGEN, CHORUSFX_POSITION, &values_0_to_99},
|
||||
{"MXR flanger manual", MXR_FLANGER_MANUAL, CHORUSFX_POSITION, &values_0_to_99},
|
||||
{"Speed", MXR_FLANGER_SPEED, CHORUSFX_POSITION, &values_0_to_99},
|
||||
{"Width", MXR_FLANGER_WIDTH, CHORUSFX_POSITION, &values_0_to_99},
|
||||
{"Regen", MXR_FLANGER_REGEN, CHORUSFX_POSITION, &values_0_to_99},
|
||||
{"Manual", MXR_FLANGER_MANUAL, CHORUSFX_POSITION, &values_0_to_99},
|
||||
};
|
||||
|
||||
static EffectSettings chorusfx_phaser_settings[] = {
|
||||
{"Phaser speed", PHASER_SPEED, CHORUSFX_POSITION, &values_0_to_99},
|
||||
{"Phaser depth", PHASER_DEPTH, CHORUSFX_POSITION, &values_0_to_99},
|
||||
{"Phaser regen", PHASER_REGEN, CHORUSFX_POSITION, &values_0_to_99},
|
||||
{"Phaser level", PHASER_LEVEL, CHORUSFX_POSITION, &values_0_to_99},
|
||||
{"Phaser wave", PHASER_WAVE, CHORUSFX_POSITION, &values_waveform},
|
||||
{"Speed", PHASER_SPEED, CHORUSFX_POSITION, &values_0_to_99},
|
||||
{"Depth", PHASER_DEPTH, CHORUSFX_POSITION, &values_0_to_99},
|
||||
{"Regen", PHASER_REGEN, CHORUSFX_POSITION, &values_0_to_99},
|
||||
{"Level", PHASER_LEVEL, CHORUSFX_POSITION, &values_0_to_99},
|
||||
{"Wave", PHASER_WAVE, CHORUSFX_POSITION, &values_waveform},
|
||||
};
|
||||
|
||||
static EffectSettings chorusfx_vibrato_settings[] = {
|
||||
{"Vibrato speed", VIBRATO_SPEED, CHORUSFX_POSITION, &values_0_to_99},
|
||||
{"Vibrato depth", VIBRATO_DEPTH, CHORUSFX_POSITION, &values_0_to_99},
|
||||
{"Speed", VIBRATO_SPEED, CHORUSFX_POSITION, &values_0_to_99},
|
||||
{"Depth", VIBRATO_DEPTH, CHORUSFX_POSITION, &values_0_to_99},
|
||||
};
|
||||
|
||||
static EffectSettings chorusfx_rotary_settings[] = {
|
||||
{"Rotary speed", ROTARY_SPEED, CHORUSFX_POSITION, &values_0_to_99},
|
||||
{"Rotary intensity", ROTARY_INTENSITY, CHORUSFX_POSITION, &values_0_to_99},
|
||||
{"Rotary doppler", ROTARY_DOPPLER, CHORUSFX_POSITION, &values_0_to_99},
|
||||
{"Rotary crossover", ROTARY_CROSSOVER, CHORUSFX_POSITION, &values_0_to_99},
|
||||
{"Speed", ROTARY_SPEED, CHORUSFX_POSITION, &values_0_to_99},
|
||||
{"Intensity", ROTARY_INTENSITY, CHORUSFX_POSITION, &values_0_to_99},
|
||||
{"Doppler", ROTARY_DOPPLER, CHORUSFX_POSITION, &values_0_to_99},
|
||||
{"Crossover", ROTARY_CROSSOVER, CHORUSFX_POSITION, &values_0_to_99},
|
||||
};
|
||||
|
||||
static EffectSettings chorusfx_vibropan_settings[] = {
|
||||
{"Vibropan speed", VIBROPAN_SPEED, CHORUSFX_POSITION, &values_0_to_99},
|
||||
{"Vibropan depth", VIBROPAN_DEPTH, CHORUSFX_POSITION, &values_0_to_99},
|
||||
{"Vibropan vibra", VIBROPAN_VIBRA, CHORUSFX_POSITION, &values_0_to_99},
|
||||
{"Vibropan wave", VIBROPAN_WAVE, CHORUSFX_POSITION, &values_waveform},
|
||||
{"Speed", VIBROPAN_SPEED, CHORUSFX_POSITION, &values_0_to_99},
|
||||
{"Depth", VIBROPAN_DEPTH, CHORUSFX_POSITION, &values_0_to_99},
|
||||
{"Vibra", VIBROPAN_VIBRA, CHORUSFX_POSITION, &values_0_to_99},
|
||||
{"Wave", VIBROPAN_WAVE, CHORUSFX_POSITION, &values_waveform},
|
||||
};
|
||||
|
||||
static EffectSettings chorusfx_tremolo_settings[] = {
|
||||
{"Tremolo speed", TREMOLO_SPEED, CHORUSFX_POSITION, &values_0_to_99},
|
||||
{"Tremolo depth", TREMOLO_DEPTH, CHORUSFX_POSITION, &values_0_to_99},
|
||||
{"Tremolo wave", TREMOLO_WAVE, CHORUSFX_POSITION, &values_waveform},
|
||||
{"Speed", TREMOLO_SPEED, CHORUSFX_POSITION, &values_0_to_99},
|
||||
{"Depth", TREMOLO_DEPTH, CHORUSFX_POSITION, &values_0_to_99},
|
||||
{"Wave", TREMOLO_WAVE, CHORUSFX_POSITION, &values_waveform},
|
||||
};
|
||||
|
||||
static EffectSettings chorusfx_panner_settings[] = {
|
||||
{"Panner speed", PANNER_SPEED, CHORUSFX_POSITION, &values_0_to_99},
|
||||
{"Panner depth", PANNER_DEPTH, CHORUSFX_POSITION, &values_0_to_99},
|
||||
{"Panner wave", PANNER_WAVE, CHORUSFX_POSITION, &values_waveform},
|
||||
{"Speed", PANNER_SPEED, CHORUSFX_POSITION, &values_0_to_99},
|
||||
{"Depth", PANNER_DEPTH, CHORUSFX_POSITION, &values_0_to_99},
|
||||
{"Wave", PANNER_WAVE, CHORUSFX_POSITION, &values_waveform},
|
||||
};
|
||||
|
||||
static EffectSettings chorusfx_envelope_settings[] = {
|
||||
{"Envelope sensitivity", ENVELOPE_SENSITIVITY, CHORUSFX_POSITION, &values_0_to_99},
|
||||
{"Envelope range", ENVELOPE_RANGE, CHORUSFX_POSITION, &values_0_to_99},
|
||||
{"Sensitivity", ENVELOPE_SENSITIVITY, CHORUSFX_POSITION, &values_0_to_99},
|
||||
{"Range", ENVELOPE_RANGE, CHORUSFX_POSITION, &values_0_to_99},
|
||||
};
|
||||
|
||||
static EffectSettings chorusfx_autoya_settings[] = {
|
||||
{"AutoYa speed", AUTOYA_SPEED, CHORUSFX_POSITION, &values_0_to_99},
|
||||
{"AutoYa intensity", AUTOYA_INTENSITY, CHORUSFX_POSITION, &values_0_to_99},
|
||||
{"AutoYa range", AUTOYA_RANGE, CHORUSFX_POSITION, &values_0_to_49},
|
||||
{"Speed", AUTOYA_SPEED, CHORUSFX_POSITION, &values_0_to_99},
|
||||
{"Intensity", AUTOYA_INTENSITY, CHORUSFX_POSITION, &values_0_to_99},
|
||||
{"Range", AUTOYA_RANGE, CHORUSFX_POSITION, &values_0_to_49},
|
||||
};
|
||||
|
||||
static EffectSettings chorusfx_yaya_settings[] = {
|
||||
{"YaYa pedal", YAYA_PEDAL, CHORUSFX_POSITION, &values_0_to_99},
|
||||
{"YaYa intensity", YAYA_INTENSITY, CHORUSFX_POSITION, &values_0_to_99},
|
||||
{"YaYa range", YAYA_RANGE, CHORUSFX_POSITION, &values_0_to_49},
|
||||
{"Pedal", YAYA_PEDAL, CHORUSFX_POSITION, &values_0_to_99},
|
||||
{"Intensity", YAYA_INTENSITY, CHORUSFX_POSITION, &values_0_to_99},
|
||||
{"Range", YAYA_RANGE, CHORUSFX_POSITION, &values_0_to_49},
|
||||
};
|
||||
|
||||
static EffectSettings chorusfx_step_filter_settings[] = {
|
||||
{"Step filter speed", STEP_FILTER_SPEED, CHORUSFX_POSITION, &values_0_to_99},
|
||||
{"Step filter intensity", STEP_FILTER_INTENSITY, CHORUSFX_POSITION, &values_0_to_99},
|
||||
{"Speed", STEP_FILTER_SPEED, CHORUSFX_POSITION, &values_0_to_99},
|
||||
{"Intensity", STEP_FILTER_INTENSITY, CHORUSFX_POSITION, &values_0_to_99},
|
||||
};
|
||||
|
||||
static EffectSettings chorusfx_whammy_settings[] = {
|
||||
{"Whammy pedal", WHAMMY_PEDAL, CHORUSFX_POSITION, &values_0_to_99},
|
||||
{"Whammy mix", WHAMMY_MIX, CHORUSFX_POSITION, &values_0_to_99},
|
||||
{"Whammy amount", WHAMMY_AMOUNT, CHORUSFX_POSITION, &values_whammy_amount},
|
||||
{"Pedal", WHAMMY_PEDAL, CHORUSFX_POSITION, &values_0_to_99},
|
||||
{"Mix", WHAMMY_MIX, CHORUSFX_POSITION, &values_0_to_99},
|
||||
{"Amount", WHAMMY_AMOUNT, CHORUSFX_POSITION, &values_whammy_amount},
|
||||
};
|
||||
|
||||
static EffectSettings chorusfx_pitch_shift_settings[] = {
|
||||
/* TODO: make this display propertly (display range -24 to 24) */
|
||||
{"Pitch amount", PITCH_AMOUNT, CHORUSFX_POSITION, &values_m24_to_24},
|
||||
{"Pitch mix", PITCH_MIX, CHORUSFX_POSITION, &values_0_to_99},
|
||||
{"Amount", PITCH_AMOUNT, CHORUSFX_POSITION, &values_m24_to_24},
|
||||
{"Mix", PITCH_MIX, CHORUSFX_POSITION, &values_0_to_99},
|
||||
};
|
||||
|
||||
static EffectSettings chorusfx_detune_settings[] = {
|
||||
{"Detune amount", DETUNE_AMOUNT, CHORUSFX_POSITION, &values_m24_to_24},
|
||||
{"Detune level", DETUNE_LEVEL, CHORUSFX_POSITION, &values_0_to_99},
|
||||
{"Amount", DETUNE_AMOUNT, CHORUSFX_POSITION, &values_m24_to_24},
|
||||
{"Level", DETUNE_LEVEL, CHORUSFX_POSITION, &values_0_to_99},
|
||||
};
|
||||
|
||||
static EffectSettings chorusfx_ips_settings[] = {
|
||||
{"IPS shift", IPS_SHIFT_AMOUNT, CHORUSFX_POSITION, &values_ips_shift},
|
||||
{"IPS key", IPS_KEY, CHORUSFX_POSITION, &values_ips_key},
|
||||
{"IPS scale", IPS_SCALE, CHORUSFX_POSITION, &values_ips_scale},
|
||||
{"IPS level", IPS_LEVEL, CHORUSFX_POSITION, &values_0_to_99},
|
||||
{"Shift", IPS_SHIFT_AMOUNT, CHORUSFX_POSITION, &values_ips_shift},
|
||||
{"Key", IPS_KEY, CHORUSFX_POSITION, &values_ips_key},
|
||||
{"Scale", IPS_SCALE, CHORUSFX_POSITION, &values_ips_scale},
|
||||
{"Level", IPS_LEVEL, CHORUSFX_POSITION, &values_0_to_99},
|
||||
};
|
||||
|
||||
static EffectSettings delay_analog_settings[] = {
|
||||
{"Delay time", DELAY_TIME, DELAY_POSITION, &values_delay_time},
|
||||
{"Delay analog level", ANALOG_LEVEL, DELAY_POSITION, &values_0_to_99},
|
||||
{"Delay analog repeats", ANALOG_REPEATS, DELAY_POSITION, &values_delay_repeats},
|
||||
{"Time", DELAY_TIME, DELAY_POSITION, &values_delay_time},
|
||||
{"Level", ANALOG_LEVEL, DELAY_POSITION, &values_0_to_99},
|
||||
{"Repeats", ANALOG_REPEATS, DELAY_POSITION, &values_delay_repeats},
|
||||
};
|
||||
|
||||
static EffectSettings delay_digital_settings[] = {
|
||||
{"Delay time", DELAY_TIME, DELAY_POSITION, &values_delay_time},
|
||||
{"Delay digital level", DIGITAL_LEVEL, DELAY_POSITION, &values_0_to_99},
|
||||
{"Delay digital repeats", DIGITAL_REPEATS, DELAY_POSITION, &values_delay_repeats},
|
||||
{"Delay digital ducker thresh", DIGITAL_DUCKER_THRESH, DELAY_POSITION, &values_0_to_99},
|
||||
{"Delay digital ducker level", DIGITAL_DUCKER_LEVEL, DELAY_POSITION, &values_0_to_99},
|
||||
{"Time", DELAY_TIME, DELAY_POSITION, &values_delay_time},
|
||||
{"Level", DIGITAL_LEVEL, DELAY_POSITION, &values_0_to_99},
|
||||
{"Repeats", DIGITAL_REPEATS, DELAY_POSITION, &values_delay_repeats},
|
||||
{"Ducker thresh", DIGITAL_DUCKER_THRESH, DELAY_POSITION, &values_0_to_99},
|
||||
{"Ducker level", DIGITAL_DUCKER_LEVEL, DELAY_POSITION, &values_0_to_99},
|
||||
};
|
||||
|
||||
static EffectSettings delay_modulated_settings[] = {
|
||||
{"Delay time", DELAY_TIME, DELAY_POSITION, &values_delay_time},
|
||||
{"Delay modulated level", MODULATED_LEVEL, DELAY_POSITION, &values_0_to_99},
|
||||
{"Delay modulated repeats", MODULATED_REPEATS, DELAY_POSITION, &values_delay_repeats},
|
||||
{"Delay modulated depth", MODULATED_DEPTH, DELAY_POSITION, &values_0_to_99},
|
||||
{"Time", DELAY_TIME, DELAY_POSITION, &values_delay_time},
|
||||
{"Level", MODULATED_LEVEL, DELAY_POSITION, &values_0_to_99},
|
||||
{"Repeats", MODULATED_REPEATS, DELAY_POSITION, &values_delay_repeats},
|
||||
{"Depth", MODULATED_DEPTH, DELAY_POSITION, &values_0_to_99},
|
||||
};
|
||||
|
||||
static EffectSettings delay_pong_settings[] = {
|
||||
{"Delay time", DELAY_TIME, DELAY_POSITION, &values_delay_time},
|
||||
{"Delay pong level", PONG_LEVEL, DELAY_POSITION, &values_0_to_99},
|
||||
{"Delay pong repeats", PONG_REPEATS, DELAY_POSITION, &values_delay_repeats},
|
||||
{"Delay pong ducker thresh", PONG_DUCKER_THRESH, DELAY_POSITION, &values_0_to_99},
|
||||
{"Delay pong ducker level", PONG_DUCKER_LEVEL, DELAY_POSITION, &values_0_to_99},
|
||||
{"Time", DELAY_TIME, DELAY_POSITION, &values_delay_time},
|
||||
{"Level", PONG_LEVEL, DELAY_POSITION, &values_0_to_99},
|
||||
{"Repeats", PONG_REPEATS, DELAY_POSITION, &values_delay_repeats},
|
||||
{"Ducker thresh", PONG_DUCKER_THRESH, DELAY_POSITION, &values_0_to_99},
|
||||
{"Ducker level", PONG_DUCKER_LEVEL, DELAY_POSITION, &values_0_to_99},
|
||||
};
|
||||
|
||||
static EffectSettings delay_tape_settings[] = {
|
||||
{"Delay time", DELAY_TIME, DELAY_POSITION, &values_delay_time},
|
||||
{"Delay tape level", TAPE_LEVEL, DELAY_POSITION, &values_0_to_99},
|
||||
{"Delay tape repeats", TAPE_REPEATS, DELAY_POSITION, &values_delay_repeats},
|
||||
{"Delay tape wow", TAPE_WOW, DELAY_POSITION, &values_0_to_99},
|
||||
{"Delay tape flutter", TAPE_FLUTTER, DELAY_POSITION, &values_0_to_99},
|
||||
{"Time", DELAY_TIME, DELAY_POSITION, &values_delay_time},
|
||||
{"Level", TAPE_LEVEL, DELAY_POSITION, &values_0_to_99},
|
||||
{"Repeats", TAPE_REPEATS, DELAY_POSITION, &values_delay_repeats},
|
||||
{"Wow", TAPE_WOW, DELAY_POSITION, &values_0_to_99},
|
||||
{"Flutter", TAPE_FLUTTER, DELAY_POSITION, &values_0_to_99},
|
||||
};
|
||||
|
||||
static EffectSettings reverb_twin_settings[] = {
|
||||
{"Twin reverb", TWIN_REVERB, REVERB_POSITION, &values_0_to_99},
|
||||
{"Reverb", TWIN_REVERB, REVERB_POSITION, &values_0_to_99},
|
||||
};
|
||||
|
||||
static EffectSettings reverb_lex_ambience_settings[] = {
|
||||
@@ -685,55 +686,58 @@ static EffectGroup effects_lib_group[] = {
|
||||
};
|
||||
|
||||
static Effect wah_effect[] = {
|
||||
{"Wah", WAH_ON_OFF, WAH_POSITION, wah_group, G_N_ELEMENTS(wah_group)},
|
||||
{NULL, WAH_ON_OFF, WAH_POSITION, wah_group, G_N_ELEMENTS(wah_group)},
|
||||
};
|
||||
|
||||
static Effect comp_effect[] = {
|
||||
{"Compressor", COMP_ON_OFF, COMP_POSITION, comp_group, G_N_ELEMENTS(comp_group)},
|
||||
{NULL, COMP_ON_OFF, COMP_POSITION, comp_group, G_N_ELEMENTS(comp_group)},
|
||||
};
|
||||
|
||||
static Effect dist_effect[] = {
|
||||
{"Distortion", DIST_ON_OFF, DIST_POSITION, dist_group, G_N_ELEMENTS(dist_group)},
|
||||
{NULL, DIST_ON_OFF, DIST_POSITION, dist_group, G_N_ELEMENTS(dist_group)},
|
||||
};
|
||||
|
||||
static Effect noisegate_effect[] = {
|
||||
{"Noisegate", NOISEGATE_ON_OFF, NOISEGATE_POSITION, noisegate_group, G_N_ELEMENTS(noisegate_group)},
|
||||
{NULL, NOISEGATE_ON_OFF, NOISEGATE_POSITION, noisegate_group, G_N_ELEMENTS(noisegate_group)},
|
||||
};
|
||||
|
||||
static Effect chorusfx_effect[] = {
|
||||
{"Chorus/FX", CHORUSFX_ON_OFF, CHORUSFX_POSITION, chorusfx_group, G_N_ELEMENTS(chorusfx_group)},
|
||||
{NULL, CHORUSFX_ON_OFF, CHORUSFX_POSITION, chorusfx_group, G_N_ELEMENTS(chorusfx_group)},
|
||||
};
|
||||
|
||||
static Effect delay_effect[] = {
|
||||
{"Delay", DELAY_ON_OFF, DELAY_POSITION, delay_group, G_N_ELEMENTS(delay_group)},
|
||||
{NULL, DELAY_ON_OFF, DELAY_POSITION, delay_group, G_N_ELEMENTS(delay_group)},
|
||||
};
|
||||
|
||||
static Effect reverb_effect[] = {
|
||||
{"Reverb", REVERB_ON_OFF, REVERB_POSITION, reverb_group, G_N_ELEMENTS(reverb_group)},
|
||||
{NULL, REVERB_ON_OFF, REVERB_POSITION, reverb_group, G_N_ELEMENTS(reverb_group)},
|
||||
};
|
||||
|
||||
static Effect amp_effect[] = {
|
||||
{"Amp", AMP_ON_OFF, AMP_POSITION, amp_group, G_N_ELEMENTS(amp_group)},
|
||||
{NULL, AMP_ON_OFF, AMP_POSITION, amp_group, G_N_ELEMENTS(amp_group)},
|
||||
{"Cabinet", -1, -1, amp_cab_group, G_N_ELEMENTS(amp_cab_group)},
|
||||
};
|
||||
|
||||
static Effect eq_effect[] = {
|
||||
{"EQ", EQ_ON_OFF, EQ_POSITION, eq_group, G_N_ELEMENTS(eq_group)},
|
||||
{NULL, EQ_ON_OFF, EQ_POSITION, eq_group, G_N_ELEMENTS(eq_group)},
|
||||
};
|
||||
|
||||
EffectList effects[] = {
|
||||
{wah_effect, G_N_ELEMENTS(wah_effect)},
|
||||
{amp_effect, G_N_ELEMENTS(amp_effect)},
|
||||
{eq_effect, G_N_ELEMENTS(eq_effect)},
|
||||
{comp_effect, G_N_ELEMENTS(comp_effect)},
|
||||
{dist_effect, G_N_ELEMENTS(dist_effect)},
|
||||
{noisegate_effect, G_N_ELEMENTS(noisegate_effect)},
|
||||
{chorusfx_effect, G_N_ELEMENTS(chorusfx_effect)},
|
||||
{delay_effect, G_N_ELEMENTS(delay_effect)},
|
||||
{reverb_effect, G_N_ELEMENTS(reverb_effect)},
|
||||
{"Wah", wah_effect, G_N_ELEMENTS(wah_effect)},
|
||||
{"Amplifier", amp_effect, G_N_ELEMENTS(amp_effect)},
|
||||
{"Equalizer", eq_effect, G_N_ELEMENTS(eq_effect)},
|
||||
{"Compressor", comp_effect, G_N_ELEMENTS(comp_effect)},
|
||||
{"Distortion", dist_effect, G_N_ELEMENTS(dist_effect)},
|
||||
{"Noisegate", noisegate_effect, G_N_ELEMENTS(noisegate_effect)},
|
||||
{"Chorus/FX", chorusfx_effect, G_N_ELEMENTS(chorusfx_effect)},
|
||||
{"Delay", delay_effect, G_N_ELEMENTS(delay_effect)},
|
||||
{"Reverb", reverb_effect, G_N_ELEMENTS(reverb_effect)},
|
||||
};
|
||||
|
||||
int n_effects = G_N_ELEMENTS(effects);
|
||||
|
||||
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
|
||||
|
||||
typedef struct {
|
||||
gchar *label;
|
||||
guint id;
|
||||
@@ -741,6 +745,8 @@ typedef struct {
|
||||
EffectValues *values;
|
||||
} Modifier;
|
||||
|
||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||
|
||||
static Modifier modifiers[] = {
|
||||
{"None", 0, 0, NULL},
|
||||
{"Pickup Enable", PICKUP_ON_OFF, PICKUP_POSITION, &values_on_off},
|
||||
@@ -879,14 +885,15 @@ static Modifier modifiers[] = {
|
||||
|
||||
int n_modifiers = G_N_ELEMENTS(modifiers);
|
||||
|
||||
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
|
||||
|
||||
/**
|
||||
* get_modifier:
|
||||
* @id: modifier ID
|
||||
* @position: modifier position
|
||||
* \param id modifier ID
|
||||
* \param position modifier position
|
||||
*
|
||||
* 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)
|
||||
{
|
||||
@@ -900,19 +907,18 @@ static Modifier *get_modifier(guint id, guint position)
|
||||
}
|
||||
|
||||
/**
|
||||
* get_modifier_settings:
|
||||
* @values: possible setting values
|
||||
* \param values possible setting values
|
||||
*
|
||||
* 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)
|
||||
{
|
||||
if (values == 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));
|
||||
settings[0].id = EXP_MIN;
|
||||
settings[1].id = EXP_MAX;
|
||||
@@ -928,8 +934,7 @@ static EffectSettings *get_modifier_settings(EffectValues *values)
|
||||
}
|
||||
|
||||
/**
|
||||
* effect_settings_free:
|
||||
* @settings: settings to be freed
|
||||
* \param settings settings to be freed
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* 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()
|
||||
{
|
||||
@@ -996,8 +999,7 @@ ModifierGroup *modifier_linkable_list()
|
||||
}
|
||||
|
||||
/**
|
||||
* modifier_group_free:
|
||||
* @modifier_group: group to be freed
|
||||
* \param modifier_group group to be freed
|
||||
*
|
||||
* Frees all memory used by ModifierGroup.
|
||||
**/
|
||||
|
||||
41
effects.h
41
effects.h
@@ -20,38 +20,39 @@
|
||||
#include <glib/gtypes.h>
|
||||
|
||||
typedef struct {
|
||||
gdouble min; /* Minumum value */
|
||||
gdouble max; /* Maximum value */
|
||||
GStrv labels; /* value labels */
|
||||
gdouble min; /**< Minumum value */
|
||||
gdouble max; /**< Maximum value */
|
||||
GStrv labels; /**< value labels */
|
||||
} EffectValues;
|
||||
|
||||
typedef struct {
|
||||
gchar *label; /* Parameter name */
|
||||
guint id; /* ID (to set parameter) */
|
||||
guint position; /* position */
|
||||
EffectValues *values; /* valid parameter values */
|
||||
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 */
|
||||
guint id; /* ID (to set effect type) */
|
||||
guint position; /* position */
|
||||
EffectSettings *settings; /* possible parameters */
|
||||
gint settings_amt; /* possible parameters length */
|
||||
guint type; /**< value (type) */
|
||||
gchar *label; /**< Effect name */
|
||||
guint id; /**< ID (to set effect type) */
|
||||
guint position; /**< position */
|
||||
EffectSettings *settings; /**< possible parameters */
|
||||
gint settings_amt; /**< possible parameters length */
|
||||
} EffectGroup;
|
||||
|
||||
typedef struct {
|
||||
gchar *label; /* Base effect name */
|
||||
guint id; /* ID (to set effect on/off) */
|
||||
guint position; /* position */
|
||||
EffectGroup *group; /* possible effect types */
|
||||
gint group_amt; /* possible effect types length */
|
||||
gchar *label; /**< Group label */
|
||||
guint id; /**< ID to set effect on/off, or if it isn't on/off group then -1 */
|
||||
guint position; /**< position */
|
||||
EffectGroup *group; /**< possible effect types */
|
||||
gint group_amt; /**< possible effect types length */
|
||||
} Effect;
|
||||
|
||||
typedef struct {
|
||||
Effect *effect; /* list of supported effects */
|
||||
gint amt; /* list of supported effects length */
|
||||
gchar *label; /**< base effect name */
|
||||
Effect *effect; /**< list of supported effects */
|
||||
gint amt; /**< list of supported effects length */
|
||||
} EffectList;
|
||||
|
||||
typedef struct {
|
||||
|
||||
102
gdigi.c
102
gdigi.c
@@ -31,13 +31,12 @@ static snd_rawmidi_t *input = NULL;
|
||||
static char *device = "hw:1,0,0";
|
||||
|
||||
/**
|
||||
* calculate_checksum:
|
||||
* @array: data to calculate checksum
|
||||
* @length: data length
|
||||
* \param array data to calculate checksum
|
||||
* \param length data length
|
||||
*
|
||||
* Calculates message checksum
|
||||
* Calculates message checksum.
|
||||
*
|
||||
* Return value: calculated checksum
|
||||
* \return calculated checksum.
|
||||
**/
|
||||
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.
|
||||
*
|
||||
* Return value: FALSE on success, TRUE on error.
|
||||
* \return FALSE on success, TRUE on error.
|
||||
**/
|
||||
gboolean open_device()
|
||||
{
|
||||
@@ -80,9 +77,8 @@ gboolean open_device()
|
||||
}
|
||||
|
||||
/**
|
||||
* send_data:
|
||||
* @data: data to be sent
|
||||
* @length: data length
|
||||
* \param data data to be sent
|
||||
* \param length data length
|
||||
*
|
||||
* Sends data to device. This function uses global output variable.
|
||||
**/
|
||||
@@ -92,13 +88,12 @@ void send_data(char *data, int length)
|
||||
}
|
||||
|
||||
/**
|
||||
* pack_data:
|
||||
* @data: data to be packed
|
||||
* @len: data length
|
||||
* \param data data to be packed
|
||||
* \param len data length
|
||||
*
|
||||
* 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)
|
||||
{
|
||||
@@ -131,8 +126,7 @@ GString *pack_data(gchar *data, gint len)
|
||||
}
|
||||
|
||||
/**
|
||||
* unpack_message:
|
||||
* @msg: message to unpack
|
||||
* \param msg message to unpack
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* 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()
|
||||
{
|
||||
@@ -245,10 +237,9 @@ GString* read_data()
|
||||
}
|
||||
|
||||
/**
|
||||
* send_message:
|
||||
* @procedure: procedure ID
|
||||
* @data: unpacked message data
|
||||
* @len: data length
|
||||
* \param procedure procedure ID
|
||||
* \param data unpacked message data
|
||||
* \param len data length
|
||||
*
|
||||
* 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:
|
||||
* @msg: SysEx message
|
||||
* \param msg SysEx message
|
||||
*
|
||||
* Checks message ID.
|
||||
*
|
||||
* Return value: MessageID, or -1 on error.
|
||||
* \return MessageID, or -1 on error.
|
||||
**/
|
||||
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);
|
||||
|
||||
if (msg->len > 7) {
|
||||
@@ -297,12 +287,11 @@ static MessageID get_message_id(GString *msg)
|
||||
}
|
||||
|
||||
/**
|
||||
* get_message_by_id:
|
||||
* @id: MessageID of requested message
|
||||
* \param id MessageID of requested message
|
||||
*
|
||||
* 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)
|
||||
{
|
||||
@@ -320,9 +309,8 @@ GString *get_message_by_id(MessageID id)
|
||||
}
|
||||
|
||||
/**
|
||||
* append_value:
|
||||
* @msg: message to append value
|
||||
* @value: value to append
|
||||
* \param msg message to append value
|
||||
* \param value value to append
|
||||
*
|
||||
* Packs value using scheme used on all newer DigiTech products.
|
||||
**/
|
||||
@@ -354,10 +342,9 @@ void append_value(GString *msg, guint value)
|
||||
}
|
||||
|
||||
/**
|
||||
* set_option:
|
||||
* @id: Parameter ID
|
||||
* @position: Parameter position
|
||||
* @value: Parameter value
|
||||
* \param id Parameter ID
|
||||
* \param position Parameter position
|
||||
* \param value Parameter value
|
||||
*
|
||||
* 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:
|
||||
* @bank: preset bank
|
||||
* @x: preset index
|
||||
* \param bank preset bank
|
||||
* \param x preset index
|
||||
*
|
||||
* Switches to selected preset.
|
||||
**/
|
||||
@@ -392,9 +378,8 @@ void switch_preset(guint bank, guint x)
|
||||
}
|
||||
|
||||
/**
|
||||
* store_preset_name:
|
||||
* @x: preset index
|
||||
* @name: preset name
|
||||
* \param x preset index
|
||||
* \param name preset name
|
||||
*
|
||||
* Stores current edit buffer in user presets bank.
|
||||
**/
|
||||
@@ -411,9 +396,8 @@ void store_preset_name(int x, const gchar *name)
|
||||
}
|
||||
|
||||
/**
|
||||
* set_preset_name:
|
||||
* @x: preset index
|
||||
* @name: preset name
|
||||
* \param x preset index
|
||||
* \param name preset name
|
||||
*
|
||||
* Sets preset name.
|
||||
**/
|
||||
@@ -429,12 +413,11 @@ void set_preset_name(int x, gchar *name)
|
||||
}
|
||||
|
||||
/**
|
||||
* query_preset_names:
|
||||
* @bank: preset bank
|
||||
* \param bank preset bank
|
||||
*
|
||||
* 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)
|
||||
{
|
||||
@@ -471,11 +454,9 @@ GStrv query_preset_names(gchar bank)
|
||||
}
|
||||
|
||||
/**
|
||||
* get_current_preset:
|
||||
*
|
||||
* 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()
|
||||
{
|
||||
@@ -490,14 +471,13 @@ GString *get_current_preset()
|
||||
}
|
||||
|
||||
/**
|
||||
* request_who_am_i:
|
||||
* @device_id: Variable to hold device ID
|
||||
* @family_id: Variable to hold family ID
|
||||
* @product_id: Variable to hold product ID
|
||||
* \param device_id Variable to hold device ID
|
||||
* \param family_id Variable to hold family ID
|
||||
* \param product_id Variable to hold product ID
|
||||
*
|
||||
* 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,
|
||||
unsigned char *product_id)
|
||||
@@ -555,11 +535,15 @@ static void request_device_configuration()
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||
|
||||
static GOptionEntry options[] = {
|
||||
{"device", 'd', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_STRING, &device, "MIDI device port to use", NULL},
|
||||
{NULL}
|
||||
};
|
||||
|
||||
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
GError *error = NULL;
|
||||
GOptionContext *context;
|
||||
@@ -580,7 +564,7 @@ int main(int argc, char *argv[]) {
|
||||
show_error_message(NULL, "Failed to open MIDI device");
|
||||
} else {
|
||||
if (request_who_am_i(&device_id, &family_id, &product_id) == FALSE) {
|
||||
show_error_message(NULL, "No suitable reply from device - is it connected?");
|
||||
show_error_message(NULL, "No suitable reply from device");
|
||||
} else {
|
||||
gui_create();
|
||||
gtk_main();
|
||||
|
||||
4
gdigi.h
4
gdigi.h
@@ -20,6 +20,8 @@
|
||||
#include <glib.h>
|
||||
#include <glib-object.h>
|
||||
|
||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||
|
||||
enum {
|
||||
WAH_TYPE_CRY = 132,
|
||||
WAH_TYPE_FULLRANGE = 133,
|
||||
@@ -539,6 +541,8 @@ enum {
|
||||
#define USB_AUDIO_PLAYBACK_MIX 12297
|
||||
#define USB_AUDIO_LEVEL 12307
|
||||
|
||||
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
|
||||
|
||||
typedef enum {
|
||||
PRESETS_SYSTEM = 0,
|
||||
PRESETS_USER = 1,
|
||||
|
||||
88
gtkknob.c
88
gtkknob.c
@@ -74,22 +74,23 @@ static GtkWidgetClass *parent_class = NULL;
|
||||
* gtk_knob_get_type()
|
||||
*
|
||||
*****************************************************************************/
|
||||
guint
|
||||
GType
|
||||
gtk_knob_get_type(void) {
|
||||
static guint knob_type = 0;
|
||||
static GType knob_type = 0;
|
||||
|
||||
if (!knob_type) {
|
||||
GtkTypeInfo knob_info = {
|
||||
"GtkKnob",
|
||||
sizeof (GtkKnob),
|
||||
static const GTypeInfo knob_info = {
|
||||
sizeof (GtkKnobClass),
|
||||
(GtkClassInitFunc) gtk_knob_class_init,
|
||||
(GtkObjectInitFunc) gtk_knob_init,
|
||||
NULL,
|
||||
NULL,
|
||||
(GClassInitFunc) gtk_knob_class_init,
|
||||
NULL,
|
||||
NULL,
|
||||
sizeof (GtkKnob),
|
||||
0,
|
||||
(GInstanceInitFunc) gtk_knob_init,
|
||||
};
|
||||
|
||||
knob_type = gtk_type_unique (gtk_widget_get_type (), &knob_info);
|
||||
knob_type = g_type_register_static (GTK_TYPE_WIDGET, "GtkKnob", &knob_info, 0);
|
||||
}
|
||||
|
||||
return knob_type;
|
||||
@@ -109,7 +110,7 @@ gtk_knob_class_init (GtkKnobClass *class) {
|
||||
object_class = (GtkObjectClass*) class;
|
||||
widget_class = (GtkWidgetClass*) class;
|
||||
|
||||
parent_class = gtk_type_class (gtk_widget_get_type ());
|
||||
parent_class = g_type_class_ref (GTK_TYPE_WIDGET);
|
||||
|
||||
object_class->destroy = gtk_knob_destroy;
|
||||
|
||||
@@ -160,7 +161,7 @@ gtk_knob_new(GtkAdjustment *adjustment, GtkKnobAnim *anim) {
|
||||
g_return_val_if_fail (anim != NULL, NULL);
|
||||
g_return_val_if_fail (GDK_IS_PIXBUF (anim->pixbuf), NULL);
|
||||
|
||||
knob = gtk_type_new (gtk_knob_get_type ());
|
||||
knob = g_object_new (gtk_knob_get_type (), NULL);
|
||||
|
||||
gtk_knob_set_animation (knob, anim);
|
||||
|
||||
@@ -190,7 +191,7 @@ gtk_knob_destroy(GtkObject *object) {
|
||||
knob = GTK_KNOB (object);
|
||||
|
||||
if (knob->adjustment) {
|
||||
gtk_object_unref (GTK_OBJECT (knob->adjustment));
|
||||
g_object_unref (knob->adjustment);
|
||||
knob->adjustment = NULL;
|
||||
}
|
||||
/* FIXME: needs ref counting for automatic GtkKnobAnim cleanup
|
||||
@@ -201,16 +202,16 @@ gtk_knob_destroy(GtkObject *object) {
|
||||
*/
|
||||
|
||||
if (knob->mask) {
|
||||
gdk_bitmap_unref (knob->mask);
|
||||
g_object_unref (knob->mask);
|
||||
knob->mask = NULL;
|
||||
}
|
||||
|
||||
if (knob->mask_gc) {
|
||||
gdk_gc_unref (knob->mask_gc);
|
||||
g_object_unref (knob->mask_gc);
|
||||
knob->mask_gc = NULL;
|
||||
}
|
||||
if (knob->red_gc) {
|
||||
gdk_gc_unref (knob->red_gc);
|
||||
g_object_unref (knob->red_gc);
|
||||
knob->red_gc = NULL;
|
||||
}
|
||||
|
||||
@@ -262,21 +263,23 @@ gtk_knob_set_adjustment(GtkKnob *knob, GtkAdjustment *adjustment) {
|
||||
g_return_if_fail (GTK_IS_KNOB (knob));
|
||||
|
||||
if (knob->adjustment) {
|
||||
gtk_signal_disconnect_by_data (GTK_OBJECT (knob->adjustment),
|
||||
(gpointer)knob);
|
||||
gtk_object_unref (GTK_OBJECT (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;
|
||||
gtk_object_ref (GTK_OBJECT (knob->adjustment));
|
||||
gtk_object_sink (GTK_OBJECT (knob->adjustment));
|
||||
g_object_ref (GTK_OBJECT (knob->adjustment));
|
||||
g_object_ref_sink (GTK_OBJECT (knob->adjustment));
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (adjustment), "changed",
|
||||
GTK_SIGNAL_FUNC (gtk_knob_adjustment_changed),
|
||||
(gpointer)knob);
|
||||
gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed",
|
||||
GTK_SIGNAL_FUNC (gtk_knob_adjustment_value_changed),
|
||||
(gpointer)knob);
|
||||
g_signal_connect (adjustment, "changed",
|
||||
(GCallback) gtk_knob_adjustment_changed,
|
||||
knob);
|
||||
g_signal_connect (adjustment, "value_changed",
|
||||
(GCallback) gtk_knob_adjustment_value_changed,
|
||||
knob);
|
||||
|
||||
knob->old_value = adjustment->value;
|
||||
knob->old_lower = adjustment->lower;
|
||||
@@ -439,13 +442,11 @@ gtk_knob_scroll(GtkWidget *widget, GdkEventScroll *event) {
|
||||
switch (event->direction) {
|
||||
case GDK_SCROLL_UP:
|
||||
knob->adjustment->value += knob->adjustment->step_increment;
|
||||
gtk_signal_emit_by_name (GTK_OBJECT (knob->adjustment),
|
||||
"value_changed");
|
||||
g_signal_emit_by_name (knob->adjustment, "value_changed");
|
||||
break;
|
||||
case GDK_SCROLL_DOWN:
|
||||
knob->adjustment->value -= knob->adjustment->step_increment;
|
||||
gtk_signal_emit_by_name (GTK_OBJECT (knob->adjustment),
|
||||
"value_changed");
|
||||
g_signal_emit_by_name (knob->adjustment, "value_changed");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -485,8 +486,7 @@ gtk_knob_button_press(GtkWidget *widget, GdkEventButton *event) {
|
||||
knob->adjustment->value = floor ((knob->adjustment->lower +
|
||||
knob->adjustment->upper + 1.0)
|
||||
* 0.5);
|
||||
gtk_signal_emit_by_name (GTK_OBJECT (knob->adjustment),
|
||||
"value_changed");
|
||||
g_signal_emit_by_name (knob->adjustment, "value_changed");
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@@ -526,8 +526,7 @@ gtk_knob_button_release(GtkWidget *widget, GdkEventButton *event) {
|
||||
if (knob->policy != GTK_UPDATE_CONTINUOUS
|
||||
&& knob->old_value != knob->adjustment->value)
|
||||
{
|
||||
gtk_signal_emit_by_name (GTK_OBJECT (knob->adjustment),
|
||||
"value_changed");
|
||||
g_signal_emit_by_name (knob->adjustment, "value_changed");
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -632,8 +631,7 @@ gtk_knob_timer(GtkKnob *knob) {
|
||||
g_return_val_if_fail (GTK_IS_KNOB (knob), FALSE);
|
||||
|
||||
if (knob->policy == GTK_UPDATE_DELAYED) {
|
||||
gtk_signal_emit_by_name (GTK_OBJECT (knob->adjustment),
|
||||
"value_changed");
|
||||
g_signal_emit_by_name (knob->adjustment, "value_changed");
|
||||
}
|
||||
|
||||
/* don't keep running this timer */
|
||||
@@ -650,19 +648,18 @@ static void
|
||||
gtk_knob_update_mouse_update(GtkKnob *knob) {
|
||||
|
||||
if (knob->policy == GTK_UPDATE_CONTINUOUS) {
|
||||
gtk_signal_emit_by_name (GTK_OBJECT (knob->adjustment),
|
||||
"value_changed");
|
||||
g_signal_emit_by_name (knob->adjustment, "value_changed");
|
||||
}
|
||||
else {
|
||||
gtk_widget_draw (GTK_WIDGET (knob), NULL);
|
||||
gtk_widget_queue_draw (GTK_WIDGET (knob));
|
||||
|
||||
if (knob->policy == GTK_UPDATE_DELAYED) {
|
||||
if (knob->timer) {
|
||||
gtk_timeout_remove (knob->timer);
|
||||
g_source_remove (knob->timer);
|
||||
}
|
||||
knob->timer = gtk_timeout_add (SCROLL_DELAY_LENGTH,
|
||||
(GtkFunction) gtk_knob_timer,
|
||||
(gpointer) knob);
|
||||
knob->timer = g_timeout_add (SCROLL_DELAY_LENGTH,
|
||||
(GSourceFunc) gtk_knob_timer,
|
||||
(gpointer) knob);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -743,11 +740,10 @@ gtk_knob_update(GtkKnob *knob) {
|
||||
|
||||
if (new_value != knob->adjustment->value) {
|
||||
knob->adjustment->value = new_value;
|
||||
gtk_signal_emit_by_name (GTK_OBJECT (knob->adjustment),
|
||||
"value_changed");
|
||||
g_signal_emit_by_name (knob->adjustment, "value_changed");
|
||||
}
|
||||
|
||||
gtk_widget_draw (GTK_WIDGET (knob), NULL);
|
||||
gtk_widget_queue_draw (GTK_WIDGET (knob));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -30,9 +30,9 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define GTK_KNOB(obj) GTK_CHECK_CAST(obj, gtk_knob_get_type(), GtkKnob)
|
||||
#define GTK_KNOB_CLASS(klass) GTK_CHECK_CLASS_CAST(klass, gtk_knob_get_type(), GtkKnobClass)
|
||||
#define GTK_IS_KNOB(obj) GTK_CHECK_TYPE(obj, gtk_knob_get_type())
|
||||
#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;
|
||||
@@ -82,7 +82,7 @@ typedef struct _GtkKnobAnim GtkKnobAnim;
|
||||
|
||||
|
||||
extern GtkWidget *gtk_knob_new(GtkAdjustment *adjustment, GtkKnobAnim *anim);
|
||||
extern guint gtk_knob_get_type(void);
|
||||
extern GType gtk_knob_get_type(void);
|
||||
extern GtkAdjustment *gtk_knob_get_adjustment(GtkKnob *knob);
|
||||
extern void gtk_knob_set_update_policy(GtkKnob *knob, GtkUpdateType policy);
|
||||
extern void gtk_knob_set_adjustment(GtkKnob *knob, GtkAdjustment *adjustment);
|
||||
|
||||
243
gui.c
243
gui.c
@@ -22,27 +22,32 @@
|
||||
#include "gtkknob.h"
|
||||
#include "knob.h"
|
||||
|
||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||
|
||||
extern EffectList effects[];
|
||||
extern int n_effects;
|
||||
|
||||
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
|
||||
|
||||
typedef struct {
|
||||
GtkObject *widget;
|
||||
gint id;
|
||||
gint position;
|
||||
|
||||
/* used for combo boxes, if widget isn't combo box, then both value and x are -1 */
|
||||
gint value; /* effect type value */
|
||||
gint x; /* combo box item number */
|
||||
gint value; /**< effect type value */
|
||||
gint x; /**< combo box item number */
|
||||
} WidgetListElem;
|
||||
|
||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||
static GtkKnobAnim *knob_anim = NULL; /* animation used by knobs */
|
||||
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 */
|
||||
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
|
||||
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:
|
||||
* @parent: transient parent, or NULL for none
|
||||
* @message: error description
|
||||
* \param parent transient parent, or NULL for none
|
||||
* \param message error description
|
||||
*
|
||||
* Shows error message dialog.
|
||||
**/
|
||||
@@ -61,9 +66,8 @@ void show_error_message(GtkWidget *parent, gchar *message)
|
||||
}
|
||||
|
||||
/**
|
||||
* value_changed_option_cb:
|
||||
* @adj: the object which emitted the signal
|
||||
* @setting: setting controlled by adj
|
||||
* \param adj the object which emitted the signal
|
||||
* \param setting setting controlled by adj
|
||||
*
|
||||
* Sets effect value.
|
||||
**/
|
||||
@@ -93,9 +97,8 @@ void value_changed_option_cb(GtkAdjustment *adj, EffectSettings *setting)
|
||||
}
|
||||
|
||||
/**
|
||||
* toggled_cb:
|
||||
* @button: the object which emitted the signal
|
||||
* @effect: effect controlled by button
|
||||
* \param button the object which emitted the signal
|
||||
* \param effect effect controlled by button
|
||||
*
|
||||
* Turns effect on/off basing on state of button.
|
||||
**/
|
||||
@@ -110,12 +113,11 @@ void toggled_cb(GtkToggleButton *button, Effect *effect)
|
||||
}
|
||||
|
||||
/**
|
||||
* widget_list_add:
|
||||
* @widget: GtkObject to add to widget list
|
||||
* @id: object controlled ID
|
||||
* @position: object controlled position
|
||||
* @value: effect value type (if widget is GtkComboBox, otherwise -1)
|
||||
* @x: combo box item number (if widget is GtkComboBox, otherwise -1)
|
||||
* \param widget GtkObject to add to widget list
|
||||
* \param id object controlled ID
|
||||
* \param position object controlled position
|
||||
* \param value effect value type (if widget is GtkComboBox, otherwise -1)
|
||||
* \param x combo box item number (if widget is GtkComboBox, otherwise -1)
|
||||
*
|
||||
* 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:
|
||||
* @el: widget list element
|
||||
* @param: parameter to set
|
||||
* \param el widget list element
|
||||
* \param param parameter to set
|
||||
*
|
||||
* 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:
|
||||
* @preset: preset to sync
|
||||
* \param preset preset to sync
|
||||
*
|
||||
* 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.
|
||||
**/
|
||||
static void apply_current_preset()
|
||||
@@ -195,13 +193,12 @@ static void apply_current_preset()
|
||||
}
|
||||
|
||||
/**
|
||||
* create_table:
|
||||
* @settings: effect parameters
|
||||
* @amt: amount of effect parameters
|
||||
* \param settings effect parameters
|
||||
* \param amt amount of 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)
|
||||
{
|
||||
@@ -240,16 +237,15 @@ GtkWidget *create_table(EffectSettings *settings, gint amt)
|
||||
}
|
||||
|
||||
/**
|
||||
* create_on_off_button:
|
||||
* @effect: Effect that can be turned on/off
|
||||
* \param effect Effect that can be turned 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 *button = gtk_toggle_button_new_with_label(effect->label);
|
||||
GtkWidget *button = gtk_check_button_new();
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), FALSE);
|
||||
g_signal_connect(G_OBJECT(button), "toggled", G_CALLBACK(toggled_cb), effect);
|
||||
widget_list_add(GTK_OBJECT(button), effect->id, effect->position, -1, -1);
|
||||
@@ -257,32 +253,33 @@ GtkWidget *create_on_off_button(Effect *effect)
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
gint type; /* effect group type (value) */
|
||||
gint id; /* option ID */
|
||||
gint position; /* position */
|
||||
GtkWidget *child; /* child widget */
|
||||
gint type; /**< effect group type (value) */
|
||||
gint id; /**< option ID */
|
||||
gint position; /**< position */
|
||||
GtkWidget *child; /**< child widget */
|
||||
} EffectSettingsGroup;
|
||||
|
||||
/**
|
||||
* effect_settings_group_free:
|
||||
* @group: group to be freed
|
||||
* \param group group to be freed
|
||||
*
|
||||
* Frees all memory used by group
|
||||
**/
|
||||
void effect_settings_group_free(EffectSettingsGroup *group)
|
||||
{
|
||||
/* destroy widget without parent */
|
||||
if (gtk_widget_get_parent(group->child) == NULL)
|
||||
gtk_widget_destroy(group->child);
|
||||
if (group->child != NULL) {
|
||||
/* destroy widget without parent */
|
||||
if (gtk_widget_get_parent(group->child) == NULL)
|
||||
gtk_widget_destroy(group->child);
|
||||
|
||||
g_object_unref(group->child);
|
||||
}
|
||||
|
||||
g_object_unref(group->child);
|
||||
g_slice_free(EffectSettingsGroup, group);
|
||||
}
|
||||
|
||||
/**
|
||||
* combo_box_changed_cb:
|
||||
* @widget: the object which emitted the signal
|
||||
* @data: user data (unused, can be anything)
|
||||
* \param widget the object which emitted the signal
|
||||
* \param data user data (unused, can be anything)
|
||||
*
|
||||
* Switches effect type and shows widgets allowing to set selected effect type parameters.
|
||||
**/
|
||||
@@ -309,20 +306,22 @@ void combo_box_changed_cb(GtkComboBox *widget, gpointer data)
|
||||
if (child != NULL) {
|
||||
gtk_container_remove(GTK_CONTAINER(gtk_widget_get_parent(gtk_widget_get_parent(vbox))), child);
|
||||
}
|
||||
gtk_container_add(GTK_CONTAINER(gtk_widget_get_parent(gtk_widget_get_parent(vbox))), settings->child);
|
||||
gtk_widget_show_all(gtk_widget_get_parent(gtk_widget_get_parent(vbox)));
|
||||
|
||||
if (settings->child != NULL) {
|
||||
gtk_container_add(GTK_CONTAINER(gtk_widget_get_parent(gtk_widget_get_parent(vbox))), settings->child);
|
||||
gtk_widget_show_all(gtk_widget_get_parent(gtk_widget_get_parent(vbox)));
|
||||
}
|
||||
g_object_set_data(G_OBJECT(widget), "active_child", settings->child);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* create_widget_container:
|
||||
* @group: Effect type groups
|
||||
* @amt: amount of effect groups
|
||||
* \param group Effect type groups
|
||||
* \param amt amount of effect groups
|
||||
*
|
||||
* 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)
|
||||
{
|
||||
@@ -347,14 +346,18 @@ GtkWidget *create_widget_container(EffectGroup *group, gint amt)
|
||||
gtk_combo_box_append_text(GTK_COMBO_BOX(combo_box), group[x].label);
|
||||
cmbox_no++;
|
||||
|
||||
widget = create_table(group[x].settings, group[x].settings_amt);
|
||||
g_object_ref_sink(widget);
|
||||
if ((group[x].settings != NULL) && (group[x].settings > 0)) {
|
||||
widget = create_table(group[x].settings, group[x].settings_amt);
|
||||
g_object_ref_sink(widget);
|
||||
} else
|
||||
widget = NULL;
|
||||
|
||||
settings = g_slice_new(EffectSettingsGroup);
|
||||
settings->id = group[x].id;
|
||||
settings->type = group[x].type;
|
||||
settings->position = group[x].position;
|
||||
settings->child = widget;
|
||||
|
||||
widget_list_add(GTK_OBJECT(combo_box), group[x].id, group[x].position, group[x].type, x);
|
||||
|
||||
name = g_strdup_printf("SettingsGroup%d", cmbox_no);
|
||||
@@ -370,37 +373,46 @@ GtkWidget *create_widget_container(EffectGroup *group, gint amt)
|
||||
}
|
||||
|
||||
/**
|
||||
* create_vbox:
|
||||
* @widgets: Effect descriptions
|
||||
* @amt: amount of effect descriptions
|
||||
* \param widgets Effect descriptions
|
||||
* \param amt amount of effect descriptions
|
||||
* \param label frame label (can be NULL)
|
||||
*
|
||||
* Creates vbox containing widgets allowing user to set effect options.
|
||||
* Creates frame (with optional label) 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, gchar *label)
|
||||
{
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *widget;
|
||||
GtkWidget *table;
|
||||
GtkWidget *container;
|
||||
GtkWidget *frame;
|
||||
int x;
|
||||
|
||||
vbox = gtk_vbox_new(FALSE, 0);
|
||||
hbox = gtk_hbox_new(FALSE, 0);
|
||||
frame = gtk_frame_new(label);
|
||||
|
||||
gtk_box_set_homogeneous(GTK_BOX(hbox), TRUE);
|
||||
vbox = gtk_vbox_new(FALSE, 0);
|
||||
|
||||
table = gtk_table_new(2, amt, FALSE);
|
||||
gtk_table_set_col_spacings(GTK_TABLE(table), 2);
|
||||
|
||||
for (x = 0; x<amt; x++) {
|
||||
widget = create_on_off_button(&widgets[x]);
|
||||
gtk_box_pack_start(GTK_BOX(hbox), widget, TRUE, TRUE, 2);
|
||||
if ((widgets[x].id != -1) && (widgets[x].position != -1)) {
|
||||
widget = create_on_off_button(&widgets[x]);
|
||||
gtk_table_attach_defaults(GTK_TABLE(table), widget, 0, 1, x, x+1);
|
||||
} else if (widgets[x].label) {
|
||||
widget = gtk_label_new(widgets[x].label);
|
||||
gtk_table_attach_defaults(GTK_TABLE(table), widget, 0, 1, x, x+1);
|
||||
}
|
||||
|
||||
table = create_widget_container(widgets[x].group, widgets[x].group_amt);
|
||||
gtk_box_pack_start(GTK_BOX(hbox), table, TRUE, TRUE, 2);
|
||||
container = create_widget_container(widgets[x].group, widgets[x].group_amt);
|
||||
gtk_table_attach_defaults(GTK_TABLE(table), container, 1, 2, x, x+1);
|
||||
}
|
||||
gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 2);
|
||||
|
||||
gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 2);
|
||||
return vbox;
|
||||
gtk_container_add(GTK_CONTAINER(frame), vbox);
|
||||
return frame;
|
||||
}
|
||||
|
||||
enum {
|
||||
@@ -411,11 +423,10 @@ enum {
|
||||
};
|
||||
|
||||
/**
|
||||
* row_activate_cb:
|
||||
* @treeview: the object which emitted the signal
|
||||
* @path: the GtkTreePath for the activated row
|
||||
* @column: the GtkTreeViewColumn in which the activation occurred
|
||||
* @model: model holding preset names
|
||||
* \param treeview the object which emitted the signal
|
||||
* \param path the GtkTreePath for the activated row
|
||||
* \param column the GtkTreeViewColumn in which the activation occurred
|
||||
* \param model model holding preset names
|
||||
*
|
||||
* Sets active device preset to preset selected by user.
|
||||
**/
|
||||
@@ -434,10 +445,9 @@ void row_activate_cb(GtkTreeView *treeview, GtkTreePath *path, GtkTreeViewColumn
|
||||
}
|
||||
|
||||
/**
|
||||
* fill_store_with_presets:
|
||||
* @model: model to fill
|
||||
* @bank: preset bank
|
||||
* @name: preset bank description visible to user
|
||||
* \param model model to fill
|
||||
* \param bank preset bank
|
||||
* \param name preset bank description visible to user
|
||||
*
|
||||
* Appends to model preset names found in device preset bank.
|
||||
**/
|
||||
@@ -458,19 +468,22 @@ static void fill_store_with_presets(GtkTreeStore *model, guint bank, gchar *name
|
||||
-1);
|
||||
|
||||
for (x=0; x<g_strv_length(presets); x++) {
|
||||
gchar *tmp = g_strdup_printf("%d - %s", x+1, presets[x]);
|
||||
|
||||
gtk_tree_store_append(model, &child_iter, &iter);
|
||||
gtk_tree_store_set(model, &child_iter,
|
||||
PRESET_NAME_COLUMN, presets[x],
|
||||
PRESET_NAME_COLUMN, tmp,
|
||||
PRESET_NUMBER_COLUMN, x,
|
||||
PRESET_BANK_COLUMN, bank,
|
||||
-1);
|
||||
|
||||
g_free(tmp);
|
||||
}
|
||||
g_strfreev(presets);
|
||||
}
|
||||
|
||||
/**
|
||||
* fill_store:
|
||||
* @model: model to fill
|
||||
* \param model model to fill
|
||||
*
|
||||
* Fills model with preset names found on device.
|
||||
**/
|
||||
@@ -481,11 +494,9 @@ static void fill_store(GtkTreeStore *model)
|
||||
}
|
||||
|
||||
/**
|
||||
* create_preset_tree:
|
||||
*
|
||||
* 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()
|
||||
{
|
||||
@@ -513,9 +524,8 @@ GtkWidget *create_preset_tree()
|
||||
}
|
||||
|
||||
/**
|
||||
* show_store_preset_window:
|
||||
* @window: application toplevel window
|
||||
* @default_name: default preset name
|
||||
* \param window application toplevel window
|
||||
* \param default_name default preset name
|
||||
*
|
||||
* Shows window allowing user to store current edit buffer.
|
||||
**/
|
||||
@@ -568,8 +578,7 @@ static void show_store_preset_window(GtkWidget *window, gchar *default_name)
|
||||
}
|
||||
|
||||
/**
|
||||
* action_store_cb:
|
||||
* @action: the object which emitted the signal
|
||||
* \param action the object which emitted the signal
|
||||
*
|
||||
* Shows store preset window.
|
||||
**/
|
||||
@@ -580,8 +589,7 @@ static void action_store_cb(GtkAction *action)
|
||||
}
|
||||
|
||||
/**
|
||||
* action_show_about_dialog_cb:
|
||||
* @action: the object which emitted the signal
|
||||
* \param action the object which emitted the signal
|
||||
*
|
||||
* Shows about dialog.
|
||||
**/
|
||||
@@ -603,6 +611,8 @@ static void action_show_about_dialog_cb(GtkAction *action)
|
||||
NULL);
|
||||
}
|
||||
|
||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||
|
||||
typedef struct {
|
||||
gchar *name;
|
||||
gchar *suffix;
|
||||
@@ -611,11 +621,13 @@ typedef struct {
|
||||
static SupportedFileTypes file_types[] = {
|
||||
{"RP250Preset", "*.rp250p"},
|
||||
};
|
||||
|
||||
static guint n_file_types = G_N_ELEMENTS(file_types);
|
||||
|
||||
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
|
||||
|
||||
/**
|
||||
* action_open_preset_cb:
|
||||
* @action: the object which emitted the signal
|
||||
* \param action the object which emitted the signal
|
||||
*
|
||||
* Shows file chooser dialog.
|
||||
* If user opens valid preset file, the preset gets applied to edit buffer and store preset window is shown.
|
||||
@@ -653,9 +665,14 @@ static void action_open_preset_cb(GtkAction *action)
|
||||
|
||||
gboolean loaded = FALSE;
|
||||
while (!loaded && gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) {
|
||||
GError *error = NULL;
|
||||
gchar *filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
|
||||
Preset *preset = create_preset_from_xml_file(filename);
|
||||
if (preset != NULL) {
|
||||
Preset *preset = create_preset_from_xml_file(filename, &error);
|
||||
if (error) {
|
||||
show_error_message(window, error->message);
|
||||
g_error_free(error);
|
||||
error = NULL;
|
||||
} else if (preset != NULL) {
|
||||
apply_preset_to_gui(preset);
|
||||
|
||||
gtk_widget_hide(dialog);
|
||||
@@ -706,8 +723,7 @@ static void action_open_preset_cb(GtkAction *action)
|
||||
}
|
||||
|
||||
/**
|
||||
* widget_list_free:
|
||||
* @list: widget list to be freed
|
||||
* \param list widget list to be freed
|
||||
*
|
||||
* Frees all memory used by widget list.
|
||||
*/
|
||||
@@ -721,8 +737,7 @@ static void widget_list_free(GList *list)
|
||||
}
|
||||
|
||||
/**
|
||||
* action_quit_cb:
|
||||
* @action: the object which emitted the signal
|
||||
* \param action the object which emitted the signal
|
||||
*
|
||||
* Destroys action object "window" data, then stops gtk main loop.
|
||||
**/
|
||||
@@ -734,6 +749,8 @@ static void action_quit_cb(GtkAction *action)
|
||||
gtk_main_quit();
|
||||
}
|
||||
|
||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||
|
||||
static GtkActionEntry entries[] = {
|
||||
{"File", NULL, "_File"},
|
||||
{"Preset", NULL, "_Preset"},
|
||||
@@ -762,11 +779,12 @@ static const gchar *menu_info =
|
||||
" </menubar>"
|
||||
"</ui>";
|
||||
|
||||
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
|
||||
|
||||
/**
|
||||
* add_action_data:
|
||||
* @ui: GtkUIManager to lookup actions
|
||||
* @path: path to action
|
||||
* @window: toplevel window
|
||||
* \param ui GtkUIManager to lookup actions
|
||||
* \param path path to action
|
||||
* \param window toplevel window
|
||||
*
|
||||
* Sets action object "window" data to toplevel window.
|
||||
**/
|
||||
@@ -781,9 +799,8 @@ static void add_action_data(GtkUIManager *ui, const gchar *path, GtkWidget *wind
|
||||
}
|
||||
|
||||
/**
|
||||
* add_menubar:
|
||||
* @window: toplevel window
|
||||
* @vbox: vbox to hold menubar
|
||||
* \param window toplevel window
|
||||
* \param vbox vbox to hold menubar
|
||||
*
|
||||
* Creates menubar (adds accel group to toplevel window as well) and packs it into vbox.
|
||||
**/
|
||||
@@ -819,8 +836,6 @@ static void add_menubar(GtkWidget *window, GtkWidget *vbox)
|
||||
}
|
||||
|
||||
/**
|
||||
* gui_create:
|
||||
*
|
||||
* Creates main window.
|
||||
**/
|
||||
void gui_create()
|
||||
@@ -856,11 +871,11 @@ void gui_create()
|
||||
knob_anim = gtk_knob_animation_new_from_inline(knob_pixbuf);
|
||||
|
||||
for (x = 0; x<n_effects; x++) {
|
||||
if ((x % 3) == 0) {
|
||||
hbox = gtk_hbox_new(TRUE, 0);
|
||||
if ((x % ((n_effects+1)/2)) == 0) {
|
||||
hbox = gtk_hbox_new(FALSE, 0);
|
||||
gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, TRUE, 2);
|
||||
}
|
||||
widget = create_vbox(effects[x].effect, effects[x].amt);
|
||||
widget = create_vbox(effects[x].effect, effects[x].amt, effects[x].label);
|
||||
gtk_box_pack_start(GTK_BOX(hbox), widget, TRUE, TRUE, 2);
|
||||
}
|
||||
|
||||
@@ -871,8 +886,6 @@ void gui_create()
|
||||
}
|
||||
|
||||
/**
|
||||
* gui_free:
|
||||
*
|
||||
* Frees memory allocated by gui_create which is not explicitly freed when main window is destroyed.
|
||||
**/
|
||||
void gui_free()
|
||||
|
||||
BIN
knob.png
BIN
knob.png
Binary file not shown.
|
Before Width: | Height: | Size: 72 KiB After Width: | Height: | Size: 62 KiB |
35
preset.c
35
preset.c
@@ -19,6 +19,8 @@
|
||||
#include <string.h>
|
||||
#include "preset.h"
|
||||
|
||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||
|
||||
enum {
|
||||
PARSER_TYPE_NOT_SET = -1,
|
||||
PARSER_TYPE_PRESET_NAME = 0,
|
||||
@@ -112,24 +114,27 @@ static void XMLCALL text_cb(void *data, const char* text, int len)
|
||||
g_free(value);
|
||||
}
|
||||
|
||||
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
|
||||
|
||||
/**
|
||||
* create_preset_from_xml_file:
|
||||
* @filename: valid path to file
|
||||
* \param filename valid path to file
|
||||
* \param error return location for an error
|
||||
*
|
||||
* 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, GError **error)
|
||||
{
|
||||
GFile *file;
|
||||
GError *error = NULL;
|
||||
GError *err = NULL;
|
||||
gchar *contents;
|
||||
|
||||
file = g_file_new_for_path(filename);
|
||||
if (g_file_get_contents(filename, &contents, NULL, &error) == FALSE) {
|
||||
g_message("Failed to get %s contents: %s", filename, error->message);
|
||||
g_error_free(error);
|
||||
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);
|
||||
g_object_unref(file);
|
||||
return NULL;
|
||||
}
|
||||
@@ -148,9 +153,9 @@ Preset *create_preset_from_xml_file(gchar *filename)
|
||||
XML_SetCharacterDataHandler(p, text_cb);
|
||||
|
||||
if (XML_Parse(p, contents, strlen(contents), XML_TRUE) != XML_STATUS_OK) {
|
||||
g_warning("Parse error at line %d:\n%s",
|
||||
(int)XML_GetCurrentLineNumber(p),
|
||||
XML_ErrorString(XML_GetErrorCode(p)));
|
||||
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);
|
||||
@@ -170,12 +175,11 @@ Preset *create_preset_from_xml_file(gchar *filename)
|
||||
}
|
||||
|
||||
/**
|
||||
* create_preset_from_data:
|
||||
* @data: unpacked RECEIVE_PRESET_PARAMETERS message
|
||||
* \param data unpacked RECEIVE_PRESET_PARAMETERS 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)
|
||||
{
|
||||
@@ -226,8 +230,7 @@ Preset *create_preset_from_data(GString *data)
|
||||
}
|
||||
|
||||
/**
|
||||
* preset_free:
|
||||
* @preset: preset to be freed
|
||||
* \param preset preset to be freed
|
||||
*
|
||||
* Frees all memory used by preset.
|
||||
**/
|
||||
|
||||
Reference in New Issue
Block a user