From 3755120541b11175311974ed494bd3f3327da8d5 Mon Sep 17 00:00:00 2001 From: NepDisk Date: Tue, 24 Mar 2026 15:16:00 -0400 Subject: [PATCH] OpenAL EFX: Clean up globalmapefxparameters and add error handeling --- src/deh_soc.c | 511 +++++++++++++++----------------------------------- 1 file changed, 150 insertions(+), 361 deletions(-) diff --git a/src/deh_soc.c b/src/deh_soc.c index 7936ce78d..967afe5ac 100644 --- a/src/deh_soc.c +++ b/src/deh_soc.c @@ -804,16 +804,72 @@ static mapheader_lighting_t *usemaplighting(INT32 mapnum, const char *word) } } -static void processvector(char *word2, f_vector3_t *vec, SINT8 num) +#define OUTOFRANGE(name, value, min, max) deh_warning("Level header %d: EFX parameter %s is out of range. (value:%d min:%d max:%d)\n", mapnum, name, value, min, max) + +#define OUTOFRANGE_FLOAT(name, value, min, max) deh_warning("Level header %d: EFX parameter %s is out of range. (value:%f min:%f max:%f)\n", mapnum, name, value, min, max) + +#define OUTOFRANGE_CONSTANT(name, valuename, minname, maxname) deh_warning("Level header %d: EFX parameter %s is out of range. (value:%s min:%s max:%s)\n", mapnum, name, valuename, minname, maxname) + +#define FIELDSET(name, field, value, min, max) \ +if (fastcmp(word, name)) \ +{ \ + if (value >= min && value <= max) \ + mapheaderinfo[mapnum]->globalEFX->field = value; \ + else \ + OUTOFRANGE(name, value, min, max); \ +} + +#define FIELDSET_FLOAT(name, field, value, min, max) \ +if (fastcmp(word, name)) \ +{ \ + if (value >= min && value <= max) \ + mapheaderinfo[mapnum]->globalEFX->field = value; \ + else \ + OUTOFRANGE_FLOAT(name, value, min, max); \ +} + +#define FIELDSET_FVEC3(name, field, value, min, max) \ +if (fastcmp(word, name)) \ +{ \ + processvector(name, mapnum, value, &mapheaderinfo[mapnum]->globalEFX->field, min, max); \ +} + +#define FIELDSET_BOOL(name, field, value, word2) \ +if (fastcmp(word, name)) \ +{ \ + if (value || word2[0] == 'T' || word2[0] == 'O') \ + mapheaderinfo[mapnum]->globalEFX->field = 1; \ + else \ + mapheaderinfo[mapnum]->globalEFX->field = 0; \ +} + +#define FIELDSET_CONSTANT(name, minname, maxname, field, word2, min, max) \ +if (fastcmp(word, name)) \ +{ \ + INT32 constnum = get_number(word2); \ + if (constnum >= min && constnum <= max) \ + mapheaderinfo[mapnum]->globalEFX->field = constnum; \ + else \ + OUTOFRANGE_CONSTANT(name, word2, minname, maxname); \ +} + +static void processvector(const char* name, INT32 mapnum, char *word2, f_vector3_t *vec, float min, float max) { char *tmp = strtok(word2,","); - float vector[num]; + float vector[3]; int i = 0; do { - if (i >= num) + if (i >= 3) break; - vector[i++] = atof(tmp); + float value = atof(tmp); + if (value >= min && value <= max) + vector[i++] = value; + else + { + deh_warning("Level header %d: EFX parameter %d of 3 of is out of range for %s. (value:%f min:%f max:%f)\n", mapnum, i+1, name, value, min, max); + return; + } } while ((tmp = strtok(NULL, ",")) != NULL); vec->x = vector[0]; @@ -827,428 +883,161 @@ static void globalmapefxparameters(INT32 mapnum, INT32 i, char *word, char *word // Take off GLOBALEFX_ word += 10; + // this is a float. + float j = atof(word2); + // Check and take off effect name if (fastncmp(word, "EAXREVERB_", 10)) { word += 10; - if (fastcmp(word, "DENSITY")) - { - mapheaderinfo[mapnum]->globalEFX->eaxreverb.density = atof(word2); - } - else if (fastcmp(word, "DIFFUSION")) - { - mapheaderinfo[mapnum]->globalEFX->eaxreverb.diffusion = atof(word2); - } - else if (fastcmp(word, "GAIN")) - { - mapheaderinfo[mapnum]->globalEFX->eaxreverb.gain = atof(word2); - } - else if (fastcmp(word, "GAINHF")) - { - mapheaderinfo[mapnum]->globalEFX->eaxreverb.gainhf = atof(word2); - } - else if (fastcmp(word, "GAINLF")) - { - mapheaderinfo[mapnum]->globalEFX->eaxreverb.gainlf = atof(word2); - } - else if (fastcmp(word, "DECAY_TIME")) - { - mapheaderinfo[mapnum]->globalEFX->eaxreverb.decay_time = atof(word2); - } - else if (fastcmp(word, "DECAY_HFRATIO")) - { - mapheaderinfo[mapnum]->globalEFX->eaxreverb.decay_hfratio = atof(word2); - } - else if (fastcmp(word, "DECAY_LFRATIO")) - { - mapheaderinfo[mapnum]->globalEFX->eaxreverb.decay_lfratio = atof(word2); - } - else if (fastcmp(word, "REFLECTIONS_GAIN")) - { - mapheaderinfo[mapnum]->globalEFX->eaxreverb.reflections_gain = atof(word2); - } - else if (fastcmp(word, "REFLECTIONS_DELAY")) - { - mapheaderinfo[mapnum]->globalEFX->eaxreverb.reflections_delay = atof(word2); - } - else if (fastcmp(word, "REFLECTIONS_PAN")) - { - processvector(word2, &mapheaderinfo[mapnum]->globalEFX->eaxreverb.reflections_pan, 3); - } - else if (fastcmp(word, "LATE_REVERB_GAIN")) - { - mapheaderinfo[mapnum]->globalEFX->eaxreverb.late_reverb_gain = atof(word2); - } - else if (fastcmp(word, "LATE_REVERB_DELAY")) - { - mapheaderinfo[mapnum]->globalEFX->eaxreverb.late_reverb_gain = atof(word2); - } - else if (fastcmp(word, "LATE_REVERB_PAN")) - { - processvector(word2, &mapheaderinfo[mapnum]->globalEFX->eaxreverb.late_reverb_pan, 3); - } - else if (fastcmp(word, "ECHO_TIME")) - { - mapheaderinfo[mapnum]->globalEFX->eaxreverb.echo_time = atof(word2); - } - else if (fastcmp(word, "ECHO_DEPTH")) - { - mapheaderinfo[mapnum]->globalEFX->eaxreverb.echo_depth = atof(word2); - } - else if (fastcmp(word, "MODULATION_TIME")) - { - mapheaderinfo[mapnum]->globalEFX->eaxreverb.modulation_time = atof(word2); - } - else if (fastcmp(word, "MODULATION_DEPTH")) - { - mapheaderinfo[mapnum]->globalEFX->eaxreverb.modulation_depth = atof(word2); - } - else if (fastcmp(word, "AIR_ABSORPTION_GAINHF")) - { - mapheaderinfo[mapnum]->globalEFX->eaxreverb.air_absorption_gainhf = atof(word2); - } - else if (fastcmp(word, "HFREFERENCE")) - { - mapheaderinfo[mapnum]->globalEFX->eaxreverb.hfreference = atof(word2); - } - else if (fastcmp(word, "LFREFERENCE")) - { - mapheaderinfo[mapnum]->globalEFX->eaxreverb.lfreference = atof(word2); - } - else if (fastcmp(word, "ROOM_ROLLOFF_FACTOR")) - { - mapheaderinfo[mapnum]->globalEFX->eaxreverb.room_rolloff_factor = atof(word2); - } - else if (fastcmp(word, "DECAY_HFLIMIT")) - { - if (i || word2[0] == 'T' || word2[0] == 'O') - mapheaderinfo[mapnum]->globalEFX->eaxreverb.decay_hflimit = 1; - else - mapheaderinfo[mapnum]->globalEFX->eaxreverb.decay_hflimit = 0; - } + FIELDSET_FLOAT("DENSITY", eaxreverb.density, j, 0.0f, 1.0f) + else FIELDSET_FLOAT("DIFFUSION", eaxreverb.diffusion, j, 0.0f, 1.0f) + else FIELDSET_FLOAT("GAIN", eaxreverb.gain, j, 0.0f, 1.0f) + else FIELDSET_FLOAT("GAINHF", eaxreverb.gainhf, j, 0.0f, 1.0f) + else FIELDSET_FLOAT("GAINLF", eaxreverb.gainlf, j, 0.0f, 1.0f) + else FIELDSET_FLOAT("DECAY_TIME", eaxreverb.decay_time, j, 0.1f, 20.0f) + else FIELDSET_FLOAT("DECAY_HFRATIO", eaxreverb.decay_hfratio, j, 0.1f, 2.0f) + else FIELDSET_FLOAT("DECAY_LFRATIO", eaxreverb.decay_lfratio, j, 0.1f, 2.0f) + else FIELDSET_FLOAT("REFLECTIONS_GAIN", eaxreverb.reflections_gain, j, 0.0f, 3.16f) + else FIELDSET_FLOAT("REFLECTIONS_DELAY", eaxreverb.reflections_delay, j, 0.0f, 0.3f) + else FIELDSET_FVEC3("REFLECTIONS_PAN", eaxreverb.reflections_pan, word2, -1.0f, 1.0f) + else FIELDSET_FLOAT("LATE_REVERB_GAIN", eaxreverb.late_reverb_gain, j, 0.0f, 10.0f) + else FIELDSET_FLOAT("LATE_REVERB_DELAY", eaxreverb.late_reverb_delay, j, 0.0f, 0.1f) + else FIELDSET_FVEC3("LATE_REVERB_PAN", eaxreverb.late_reverb_pan, word2, -1.0f, 1.0f) + else FIELDSET_FLOAT("ECHO_TIME", eaxreverb.echo_time, j, 0.075f, 0.25f) + else FIELDSET_FLOAT("ECHO_DEPTH", eaxreverb.echo_depth, j, 0.0f, 1.0f) + else FIELDSET_FLOAT("MODULATION_TIME", eaxreverb.modulation_time, j, 0.04f, 4.0f) + else FIELDSET_FLOAT("MODULATION_DEPTH", eaxreverb.modulation_depth, j, 0.0f, 1.0f) + else FIELDSET_FLOAT("AIR_ABSORPTION_GAINHF", eaxreverb.air_absorption_gainhf, j, 0.892f, 1.0f) + else FIELDSET_FLOAT("HFREFERENCE", eaxreverb.hfreference, j, 1000.0f, 20000.0f) + else FIELDSET_FLOAT("LFREFERENCE", eaxreverb.lfreference, j, 20.0f, 1000.0f) + else FIELDSET_FLOAT("ROOM_ROLLOFF_FACTOR", eaxreverb.room_rolloff_factor, j, 0.0f, 10.0f) + else FIELDSET_BOOL("DECAY_HFLIMIT", eaxreverb.decay_hflimit, i, word2) } else if (fastncmp(word, "REVERB_", 7)) { word += 7; - if (fastcmp(word, "DENSITY")) - { - mapheaderinfo[mapnum]->globalEFX->reverb.density = atof(word2); - } - else if (fastcmp(word, "DIFFUSION")) - { - mapheaderinfo[mapnum]->globalEFX->reverb.diffusion = atof(word2); - } - else if (fastcmp(word, "GAIN")) - { - mapheaderinfo[mapnum]->globalEFX->reverb.gain = atof(word2); - } - else if (fastcmp(word, "GAINHF")) - { - mapheaderinfo[mapnum]->globalEFX->reverb.gainhf = atof(word2); - } - else if (fastcmp(word, "DECAY_TIME")) - { - mapheaderinfo[mapnum]->globalEFX->reverb.decay_time = atof(word2); - } - else if (fastcmp(word, "DECAY_HFRATIO")) - { - mapheaderinfo[mapnum]->globalEFX->reverb.decay_hfratio = atof(word2); - } - else if (fastcmp(word, "REFLECTIONS_GAIN")) - { - mapheaderinfo[mapnum]->globalEFX->reverb.reflections_gain = atof(word2); - } - else if (fastcmp(word, "REFLECTIONS_DELAY")) - { - mapheaderinfo[mapnum]->globalEFX->reverb.reflections_delay = atof(word2); - } - else if (fastcmp(word, "LATE_REVERB_GAIN")) - { - mapheaderinfo[mapnum]->globalEFX->reverb.late_reverb_gain = atof(word2); - } - else if (fastcmp(word, "LATE_REVERB_DELAY")) - { - mapheaderinfo[mapnum]->globalEFX->reverb.late_reverb_delay = atof(word2); - } - else if (fastcmp(word, "AIR_ABSORPTION_GAINHF")) - { - mapheaderinfo[mapnum]->globalEFX->reverb.air_absorption_gainhf = atof(word2); - } - else if (fastcmp(word, "ROOM_ROLLOFF_FACTOR")) - { - mapheaderinfo[mapnum]->globalEFX->reverb.room_rolloff_factor = atof(word2); - } - else if (fastcmp(word, "DECAY_HFLIMIT")) - { - if (i || word2[0] == 'T' || word2[0] == 'O') - mapheaderinfo[mapnum]->globalEFX->reverb.decay_hflimit = 1; - else - mapheaderinfo[mapnum]->globalEFX->reverb.decay_hflimit = 0; - } + FIELDSET_FLOAT("DENSITY", reverb.density, j, 0.0f, 1.0f) + else FIELDSET_FLOAT("DIFFUSION", reverb.diffusion, j, 0.0f, 1.0f) + else FIELDSET_FLOAT("GAIN", reverb.gain, j, 0.0f, 1.0f) + else FIELDSET_FLOAT("GAINHF", reverb.gainhf, j, 0.0f, 1.0f) + else FIELDSET_FLOAT("DECAY_TIME", reverb.decay_time, j, 0.1f, 20.0f) + else FIELDSET_FLOAT("DECAY_HFRATIO", reverb.decay_hfratio, j, 0.1f, 2.0f) + else FIELDSET_FLOAT("REFLECTIONS_GAIN", reverb.reflections_gain, j, 0.0f, 3.16f) + else FIELDSET_FLOAT("REFLECTIONS_DELAY", reverb.reflections_delay, j, 0.0f, 0.3f) + else FIELDSET_FLOAT("LATE_REVERB_GAIN", reverb.late_reverb_gain, j, 0.0f, 10.0f) + else FIELDSET_FLOAT("LATE_REVERB_DELAY", reverb.late_reverb_delay, j, 0.0f, 0.1f) + else FIELDSET_FLOAT("AIR_ABSORPTION_GAINHF", reverb.air_absorption_gainhf, j, 0.892f, 1.0f) + else FIELDSET_FLOAT("ROOM_ROLLOFF_FACTOR", reverb.room_rolloff_factor, j, 0.0f, 10.0f) + else FIELDSET_BOOL("DECAY_HFLIMIT", reverb.decay_hflimit, i, word2) } else if (fastncmp(word, "CHORUS_", 7)) { word += 7; - if (fastcmp(word, "WAVEFORM")) - { - mapheaderinfo[mapnum]->globalEFX->chorus.waveform = get_number(word2); - } - else if (fastcmp(word, "PHASE")) - { - mapheaderinfo[mapnum]->globalEFX->chorus.phase = i; - } - else if (fastcmp(word, "RATE")) - { - mapheaderinfo[mapnum]->globalEFX->chorus.rate = atof(word2); - } - else if (fastcmp(word, "DEPTH")) - { - mapheaderinfo[mapnum]->globalEFX->chorus.depth = atof(word2); - } - else if (fastcmp(word, "FEEDBACK")) - { - mapheaderinfo[mapnum]->globalEFX->chorus.feedback = atof(word2); - } - else if (fastcmp(word, "DELAY")) - { - mapheaderinfo[mapnum]->globalEFX->chorus.delay = atof(word2); - } + FIELDSET_CONSTANT("WAVEFORM", "CHORUSWAVE_SINUSOID", "CHORUSWAVE_TRIANGLE", chorus.waveform, word2, CHORUSWAVE_SINUSOID, CHORUSWAVE_TRIANGLE) + else FIELDSET("PHASE", chorus.phase, i, -180, 180) + else FIELDSET_FLOAT("RATE", chorus.rate, j, 0.0f, 10.0f) + else FIELDSET_FLOAT("DEPTH", chorus.depth, j, 0.0f, 1.0f) + else FIELDSET_FLOAT("FEEDBACK", chorus.feedback, j, -1.0f, 1.0f) + else FIELDSET_FLOAT("DELAY", chorus.delay, j, 0.0f, 0.016f) } else if (fastncmp(word, "DISTORTION_", 11)) { word += 11; - if (fastcmp(word, "EDGE")) - { - mapheaderinfo[mapnum]->globalEFX->distortion.edge = atof(word2); - } - else if (fastcmp(word, "GAIN")) - { - mapheaderinfo[mapnum]->globalEFX->distortion.gain = atof(word2); - } - else if (fastcmp(word, "LOWPASS_CUTOFF")) - { - mapheaderinfo[mapnum]->globalEFX->distortion.lowpass_cutoff = atof(word2); - } - else if (fastcmp(word, "EQCENTER")) - { - mapheaderinfo[mapnum]->globalEFX->distortion.eqcenter = atof(word2); - } - else if (fastcmp(word, "EQBANDWIDTH")) - { - mapheaderinfo[mapnum]->globalEFX->distortion.eqbandwidth = atof(word2); - } + FIELDSET_FLOAT("EDGE", distortion.edge, j, 0.0f, 1.0f) + else FIELDSET_FLOAT("GAIN", distortion.gain, j, 0.01f, 1.0f) + else FIELDSET_FLOAT("LOWPASS_CUTOFF", distortion.lowpass_cutoff, j, 80.0f, 24000.0f) + else FIELDSET_FLOAT("EQCENTER", distortion.eqcenter, j, 80.0f, 24000.0f) + else FIELDSET_FLOAT("EQBANDWIDTH", distortion.eqbandwidth, j, 80.0f, 24000.0f) } else if (fastncmp(word, "ECHO_", 5)) { word += 5; - if (fastcmp(word, "DELAY")) - { - mapheaderinfo[mapnum]->globalEFX->echo.delay = atof(word2); - } - else if (fastcmp(word, "LRDELAY")) - { - mapheaderinfo[mapnum]->globalEFX->echo.lrdelay = atof(word2); - } - else if (fastcmp(word, "DAMPING")) - { - mapheaderinfo[mapnum]->globalEFX->echo.damping = atof(word2); - } - else if (fastcmp(word, "FEEDBACK")) - { - mapheaderinfo[mapnum]->globalEFX->echo.feedback = atof(word2); - } - else if (fastcmp(word, "SPREAD")) - { - mapheaderinfo[mapnum]->globalEFX->echo.spread = atof(word2); - } + FIELDSET_FLOAT("DELAY", echo.delay, j, 0.0f, 0.207f) + else FIELDSET_FLOAT("LRDELAY", echo.lrdelay, j, 0.0f, 0.404f) + else FIELDSET_FLOAT("DAMPING", echo.damping, j, 0.0f, 0.99f) + else FIELDSET_FLOAT("FEEDBACK", echo.feedback, j, 0.0f, 1.0f) + else FIELDSET_FLOAT("SPREAD", echo.spread, j, -1.0f, 1.0f) } else if (fastncmp(word, "FLANGER_", 8)) { word += 8; - if (fastcmp(word, "WAVEFORM")) - { - mapheaderinfo[mapnum]->globalEFX->flanger.waveform = get_number(word2); - } - else if (fastcmp(word, "PHASE")) - { - mapheaderinfo[mapnum]->globalEFX->flanger.phase = i; - } - else if (fastcmp(word, "RATE")) - { - mapheaderinfo[mapnum]->globalEFX->flanger.rate = atof(word2); - } - else if (fastcmp(word, "DEPTH")) - { - mapheaderinfo[mapnum]->globalEFX->flanger.depth = atof(word2); - } - else if (fastcmp(word, "FEEDBACK")) - { - mapheaderinfo[mapnum]->globalEFX->flanger.feedback = atof(word2); - } - else if (fastcmp(word, "DELAY")) - { - mapheaderinfo[mapnum]->globalEFX->flanger.delay = atof(word2); - } + FIELDSET_CONSTANT("WAVEFORM", "FLANGERWAVE_SINUSOID", "FLANGERWAVE_TRIANGLE", flanger.waveform, word2, FLANGERWAVE_SINUSOID, FLANGERWAVE_TRIANGLE) + else FIELDSET("PHASE", flanger.phase, i, -180, 180) + else FIELDSET_FLOAT("RATE", flanger.rate, j, 0.0f, 10.0f) + else FIELDSET_FLOAT("DEPTH", flanger.depth, j, 0.0f, 1.0f) + else FIELDSET_FLOAT("FEEDBACK", flanger.feedback, j, -1.0f, 1.0f) + else FIELDSET_FLOAT("DELAY", flanger.delay, j, 0.0f, 0.004f) } else if (fastncmp(word, "FREQSHIFT_", 10)) { word += 10; - if (fastcmp(word, "FREQUENCY")) - { - mapheaderinfo[mapnum]->globalEFX->freqshift.frequency = atof(word2); - } - else if (fastcmp(word, "LEFT_DIRECTION")) - { - mapheaderinfo[mapnum]->globalEFX->freqshift.left_direction = get_number(word2); - } - else if (fastcmp(word, "RIGHT_DIRECTION")) - { - mapheaderinfo[mapnum]->globalEFX->freqshift.right_direction = get_number(word2); - } + FIELDSET_FLOAT("FREQUENCY", freqshift.frequency, j, 0.0f, 24000.0f) + else FIELDSET_CONSTANT("LEFT_DIRECTION", "FREQSHIFTDIR_DOWN", "FREQSHIFTDIR_OFF", freqshift.left_direction, word2, FREQSHIFTDIR_DOWN, FREQSHIFTDIR_OFF) + else FIELDSET_CONSTANT("RIGHT_DIRECTION", "FREQSHIFTDIR_DOWN", "FREQSHIFTDIR_OFF", freqshift.right_direction, word2, FREQSHIFTDIR_DOWN, FREQSHIFTDIR_OFF) } else if (fastncmp(word, "VOCALMORPH_", 11)) { word += 11; - if (fastcmp(word, "PHONEMEA")) - { - mapheaderinfo[mapnum]->globalEFX->vocal_morpher.phonemea = i; - } - else if (fastcmp(word, "PHONEMEB")) - { - mapheaderinfo[mapnum]->globalEFX->vocal_morpher.phonemeb = i; - } - else if (fastcmp(word, "PHONEMEA_COARSE_TUNING")) - { - mapheaderinfo[mapnum]->globalEFX->vocal_morpher.phonemea_coarse_tuning = i; - } - else if (fastcmp(word, "PHONEMEB_COARSE_TUNING")) - { - mapheaderinfo[mapnum]->globalEFX->vocal_morpher.phonemeb_coarse_tuning = i; - } - else if (fastcmp(word, "WAVEFORM")) - { - mapheaderinfo[mapnum]->globalEFX->vocal_morpher.waveform = get_number(word2); - } - else if (fastcmp(word, "RATE")) - { - mapheaderinfo[mapnum]->globalEFX->vocal_morpher.rate = atof(word2); - } + FIELDSET("PHONEMEA", vocal_morpher.phonemea, i, 0, 29) + else FIELDSET("PHONEMEB", vocal_morpher.phonemeb, i, 0, 29) + else FIELDSET("PHONEMEA_COARSE_TUNING", vocal_morpher.phonemea_coarse_tuning, i, -24, 24) + else FIELDSET("PHONEMEB_COARSE_TUNING", vocal_morpher.phonemeb_coarse_tuning, i, -24, 24) + else FIELDSET_CONSTANT("WAVEFORM", "VOCALMORPH_SIN", "VOCALMORPH_SAW", flanger.waveform, word2, VOCALMORPH_SIN, VOCALMORPH_SAW) + else FIELDSET_FLOAT("RATE", vocal_morpher.rate, j, 0.0f, 10.0f) } else if (fastncmp(word, "PITCHSHIFT_", 11)) { word += 11; - if (fastcmp(word, "COARSE_TUNE")) - { - mapheaderinfo[mapnum]->globalEFX->pitchshift.coarse_tune = i; - } - else if (fastcmp(word, "FINE_TUNE")) - { - mapheaderinfo[mapnum]->globalEFX->pitchshift.fine_tune = i; - } + FIELDSET("COARSE_TUNE", pitchshift.coarse_tune, i, -12, 12) + else FIELDSET("FINE_TUNE", pitchshift.fine_tune, i, -50, 50) } else if (fastncmp(word, "RINGMOD_", 8)) { word += 8; - if (fastcmp(word, "FREQUENCY")) - { - mapheaderinfo[mapnum]->globalEFX->ringmod.frequency = atof(word2); - } - else if (fastcmp(word, "HIGHPASS_CUTOFF")) - { - mapheaderinfo[mapnum]->globalEFX->ringmod.highpass_cutoff = atof(word2); - } - else if (fastcmp(word, "WAVEFORM")) - { - mapheaderinfo[mapnum]->globalEFX->ringmod.waveform = get_number(word2); - } + FIELDSET_FLOAT("FREQUENCY", ringmod.frequency, j, 0.0f, 8000.0f) + else FIELDSET_FLOAT("HIGHPASS_CUTOFF", ringmod.highpass_cutoff, j, 0.0f, 24000.0f) + else FIELDSET_CONSTANT("WAVEFORM", "RINGMOD_SIN", "RINGMOD_SQUARE", ringmod.waveform, word2, RINGMOD_SIN, RINGMOD_SQUARE) } else if (fastncmp(word, "AUTOWAH_", 8)) { word += 8; - if (fastcmp(word, "ATTACK_TIME")) - { - mapheaderinfo[mapnum]->globalEFX->autowah.attack_time = atof(word2); - } - else if (fastcmp(word, "RELEASE_TIME")) - { - mapheaderinfo[mapnum]->globalEFX->autowah.release_time = atof(word2); - } - else if (fastcmp(word, "RESONANCE")) - { - mapheaderinfo[mapnum]->globalEFX->autowah.resonance = atof(word2); - } - else if (fastcmp(word, "PEAK_GAIN")) - { - mapheaderinfo[mapnum]->globalEFX->autowah.peak_gain = atof(word2); - } + FIELDSET_FLOAT("ATTACK_TIME", autowah.attack_time, j, 0.0001f, 1.0f) + else FIELDSET_FLOAT("RELEASE_TIME", autowah.release_time, j, 0.0001f, 1.0f) + else FIELDSET_FLOAT("RESONANCE", autowah.resonance, j, 2.0f, 1000.0f) + else FIELDSET_FLOAT("PEAK_GAIN", autowah.peak_gain, j, 0.00003f, 31621.0f) } else if (fastncmp(word, "COMPRESSOR_", 11)) { word += 11; - if (fastcmp(word, "ONOFF")) - { - if (i || word2[0] == 'T' || word2[0] == 'O') - mapheaderinfo[mapnum]->globalEFX->compressor.onoff = 1; - else - mapheaderinfo[mapnum]->globalEFX->compressor.onoff = 0; - } + FIELDSET_BOOL("ONOFF", compressor.onoff, i, word2) } else if (fastncmp(word, "EQ_", 3)) { word += 3; - if (fastcmp(word, "LOW_GAIN")) - { - mapheaderinfo[mapnum]->globalEFX->eq.low_gain = atof(word2); - } - else if (fastcmp(word, "LOW_CUTOFF")) - { - mapheaderinfo[mapnum]->globalEFX->eq.low_cutoff = atof(word2); - } - else if (fastcmp(word, "MID1_GAIN")) - { - mapheaderinfo[mapnum]->globalEFX->eq.mid1_gain = atof(word2); - } - else if (fastcmp(word, "MID1_CENTER")) - { - mapheaderinfo[mapnum]->globalEFX->eq.mid1_center = atof(word2); - } - else if (fastcmp(word, "MID1_WIDTH")) - { - mapheaderinfo[mapnum]->globalEFX->eq.mid1_width = atof(word2); - } - else if (fastcmp(word, "MID2_GAIN")) - { - mapheaderinfo[mapnum]->globalEFX->eq.mid2_gain = atof(word2); - } - else if (fastcmp(word, "MID2_CENTER")) - { - mapheaderinfo[mapnum]->globalEFX->eq.mid2_center = atof(word2); - } - else if (fastcmp(word, "MID2_WIDTH")) - { - mapheaderinfo[mapnum]->globalEFX->eq.mid2_width = atof(word2); - } - else if (fastcmp(word, "HIGH_GAIN")) - { - mapheaderinfo[mapnum]->globalEFX->eq.high_gain = atof(word2); - } - else if (fastcmp(word, "HIGH_CUTOFF")) - { - mapheaderinfo[mapnum]->globalEFX->eq.high_cutoff = atof(word2); - } + FIELDSET_FLOAT("LOW_GAIN", eq.low_gain, j, 0.126f, 7.943f) + else FIELDSET_FLOAT("LOW_CUTOFF", eq.low_cutoff, j, 50.0f, 800.0f) + else FIELDSET_FLOAT("MID1_GAIN", eq.mid1_gain, j, 0.126f, 7.943f) + else FIELDSET_FLOAT("MID1_CENTER", eq.mid1_center, j, 200.0f, 3000.0f) + else FIELDSET_FLOAT("MID1_WIDTH", eq.mid1_width, j, 0.01f, 1.0f) + else FIELDSET_FLOAT("MID2_GAIN", eq.mid2_gain, j, 0.126f, 7.943f) + else FIELDSET_FLOAT("MID2_CENTER", eq.mid2_center, j, 1000.0f, 8000.0f) + else FIELDSET_FLOAT("MID2_WIDTH", eq.mid2_width, j, 0.01f, 1.0f) + else FIELDSET_FLOAT("HIGH_GAIN", eq.high_gain, j, 0.126f, 7.943f) + else FIELDSET_FLOAT("HIGH_CUTOFF", eq.high_cutoff, j, 4000.0f, 16000.0f) } }