mirror of
https://github.com/ZDoom/fluidsynth.git
synced 2024-12-03 09:32:02 +00:00
Add ability to get name of generator from gen index
Used in dump_sfont test utility.
This commit is contained in:
parent
522b751f4f
commit
736caf9d21
3 changed files with 76 additions and 65 deletions
|
@ -23,73 +23,76 @@
|
|||
#include "fluid_chan.h"
|
||||
|
||||
|
||||
#define _GEN(_name) GEN_ ## _name, #_name
|
||||
|
||||
|
||||
/* See SFSpec21 $8.1.3 */
|
||||
static const fluid_gen_info_t fluid_gen_info[] =
|
||||
{
|
||||
/* number/name init nrpn-scale min max def */
|
||||
{ GEN_STARTADDROFS, 1, 1, 0.0f, 1e10f, 0.0f },
|
||||
{ GEN_ENDADDROFS, 1, 1, -1e10f, 0.0f, 0.0f },
|
||||
{ GEN_STARTLOOPADDROFS, 1, 1, -1e10f, 1e10f, 0.0f },
|
||||
{ GEN_ENDLOOPADDROFS, 1, 1, -1e10f, 1e10f, 0.0f },
|
||||
{ GEN_STARTADDRCOARSEOFS, 0, 1, 0.0f, 1e10f, 0.0f },
|
||||
{ GEN_MODLFOTOPITCH, 1, 2, -12000.0f, 12000.0f, 0.0f },
|
||||
{ GEN_VIBLFOTOPITCH, 1, 2, -12000.0f, 12000.0f, 0.0f },
|
||||
{ GEN_MODENVTOPITCH, 1, 2, -12000.0f, 12000.0f, 0.0f },
|
||||
{ GEN_FILTERFC, 1, 2, 1500.0f, 13500.0f, 13500.0f },
|
||||
{ GEN_FILTERQ, 1, 1, 0.0f, 960.0f, 0.0f },
|
||||
{ GEN_MODLFOTOFILTERFC, 1, 2, -12000.0f, 12000.0f, 0.0f },
|
||||
{ GEN_MODENVTOFILTERFC, 1, 2, -12000.0f, 12000.0f, 0.0f },
|
||||
{ GEN_ENDADDRCOARSEOFS, 0, 1, -1e10f, 0.0f, 0.0f },
|
||||
{ GEN_MODLFOTOVOL, 1, 1, -960.0f, 960.0f, 0.0f },
|
||||
{ GEN_UNUSED1, 0, 0, 0.0f, 0.0f, 0.0f },
|
||||
{ GEN_CHORUSSEND, 1, 1, 0.0f, 1000.0f, 0.0f },
|
||||
{ GEN_REVERBSEND, 1, 1, 0.0f, 1000.0f, 0.0f },
|
||||
{ GEN_PAN, 1, 1, -500.0f, 500.0f, 0.0f },
|
||||
{ GEN_UNUSED2, 0, 0, 0.0f, 0.0f, 0.0f },
|
||||
{ GEN_UNUSED3, 0, 0, 0.0f, 0.0f, 0.0f },
|
||||
{ GEN_UNUSED4, 0, 0, 0.0f, 0.0f, 0.0f },
|
||||
{ GEN_MODLFODELAY, 1, 2, -12000.0f, 5000.0f, -12000.0f },
|
||||
{ GEN_MODLFOFREQ, 1, 4, -16000.0f, 4500.0f, 0.0f },
|
||||
{ GEN_VIBLFODELAY, 1, 2, -12000.0f, 5000.0f, -12000.0f },
|
||||
{ GEN_VIBLFOFREQ, 1, 4, -16000.0f, 4500.0f, 0.0f },
|
||||
{ GEN_MODENVDELAY, 1, 2, -12000.0f, 5000.0f, -12000.0f },
|
||||
{ GEN_MODENVATTACK, 1, 2, -12000.0f, 8000.0f, -12000.0f },
|
||||
{ GEN_MODENVHOLD, 1, 2, -12000.0f, 5000.0f, -12000.0f },
|
||||
{ GEN_MODENVDECAY, 1, 2, -12000.0f, 8000.0f, -12000.0f },
|
||||
{ GEN_MODENVSUSTAIN, 0, 1, 0.0f, 1000.0f, 0.0f },
|
||||
{ GEN_MODENVRELEASE, 1, 2, -12000.0f, 8000.0f, -12000.0f },
|
||||
{ GEN_KEYTOMODENVHOLD, 0, 1, -1200.0f, 1200.0f, 0.0f },
|
||||
{ GEN_KEYTOMODENVDECAY, 0, 1, -1200.0f, 1200.0f, 0.0f },
|
||||
{ GEN_VOLENVDELAY, 1, 2, -12000.0f, 5000.0f, -12000.0f },
|
||||
{ GEN_VOLENVATTACK, 1, 2, -12000.0f, 8000.0f, -12000.0f },
|
||||
{ GEN_VOLENVHOLD, 1, 2, -12000.0f, 5000.0f, -12000.0f },
|
||||
{ GEN_VOLENVDECAY, 1, 2, -12000.0f, 8000.0f, -12000.0f },
|
||||
{ GEN_VOLENVSUSTAIN, 0, 1, 0.0f, 1440.0f, 0.0f },
|
||||
{ GEN_VOLENVRELEASE, 1, 2, -12000.0f, 8000.0f, -12000.0f },
|
||||
{ GEN_KEYTOVOLENVHOLD, 0, 1, -1200.0f, 1200.0f, 0.0f },
|
||||
{ GEN_KEYTOVOLENVDECAY, 0, 1, -1200.0f, 1200.0f, 0.0f },
|
||||
{ GEN_INSTRUMENT, 0, 0, 0.0f, 0.0f, 0.0f },
|
||||
{ GEN_RESERVED1, 0, 0, 0.0f, 0.0f, 0.0f },
|
||||
{ GEN_KEYRANGE, 0, 0, 0.0f, 127.0f, 0.0f },
|
||||
{ GEN_VELRANGE, 0, 0, 0.0f, 127.0f, 0.0f },
|
||||
{ GEN_STARTLOOPADDRCOARSEOFS, 0, 1, -1e10f, 1e10f, 0.0f },
|
||||
{ GEN_KEYNUM, 1, 0, 0.0f, 127.0f, -1.0f },
|
||||
{ GEN_VELOCITY, 1, 1, 0.0f, 127.0f, -1.0f },
|
||||
{ GEN_ATTENUATION, 1, 1, 0.0f, 1440.0f, 0.0f },
|
||||
{ GEN_RESERVED2, 0, 0, 0.0f, 0.0f, 0.0f },
|
||||
{ GEN_ENDLOOPADDRCOARSEOFS, 0, 1, -1e10f, 1e10f, 0.0f },
|
||||
{ GEN_COARSETUNE, 0, 1, -120.0f, 120.0f, 0.0f },
|
||||
{ GEN_FINETUNE, 0, 1, -99.0f, 99.0f, 0.0f },
|
||||
{ GEN_SAMPLEID, 0, 0, 0.0f, 0.0f, 0.0f },
|
||||
{ GEN_SAMPLEMODE, 0, 0, 0.0f, 0.0f, 0.0f },
|
||||
{ GEN_RESERVED3, 0, 0, 0.0f, 0.0f, 0.0f },
|
||||
{ GEN_SCALETUNE, 0, 1, 0.0f, 1200.0f, 100.0f },
|
||||
{ GEN_EXCLUSIVECLASS, 0, 0, 0.0f, 0.0f, 0.0f },
|
||||
{ GEN_OVERRIDEROOTKEY, 1, 0, 0.0f, 127.0f, -1.0f },
|
||||
{ GEN_PITCH, 1, 0, 0.0f, 127.0f, 0.0f },
|
||||
{ GEN_CUSTOM_BALANCE, 1, 0, -960.0f, 960.0f, 0.0f },
|
||||
{ GEN_CUSTOM_FILTERFC, 1, 2, 0.0f, 22050.0f, 0.0f },
|
||||
{ GEN_CUSTOM_FILTERQ, 1, 1, 0.0f, 960.0f, 0.0f }
|
||||
{ _GEN(STARTADDROFS), 1, 1, 0.0f, 1e10f, 0.0f },
|
||||
{ _GEN(ENDADDROFS), 1, 1, -1e10f, 0.0f, 0.0f },
|
||||
{ _GEN(STARTLOOPADDROFS), 1, 1, -1e10f, 1e10f, 0.0f },
|
||||
{ _GEN(ENDLOOPADDROFS), 1, 1, -1e10f, 1e10f, 0.0f },
|
||||
{ _GEN(STARTADDRCOARSEOFS), 0, 1, 0.0f, 1e10f, 0.0f },
|
||||
{ _GEN(MODLFOTOPITCH), 1, 2, -12000.0f, 12000.0f, 0.0f },
|
||||
{ _GEN(VIBLFOTOPITCH), 1, 2, -12000.0f, 12000.0f, 0.0f },
|
||||
{ _GEN(MODENVTOPITCH), 1, 2, -12000.0f, 12000.0f, 0.0f },
|
||||
{ _GEN(FILTERFC), 1, 2, 1500.0f, 13500.0f, 13500.0f },
|
||||
{ _GEN(FILTERQ), 1, 1, 0.0f, 960.0f, 0.0f },
|
||||
{ _GEN(MODLFOTOFILTERFC), 1, 2, -12000.0f, 12000.0f, 0.0f },
|
||||
{ _GEN(MODENVTOFILTERFC), 1, 2, -12000.0f, 12000.0f, 0.0f },
|
||||
{ _GEN(ENDADDRCOARSEOFS), 0, 1, -1e10f, 0.0f, 0.0f },
|
||||
{ _GEN(MODLFOTOVOL), 1, 1, -960.0f, 960.0f, 0.0f },
|
||||
{ _GEN(UNUSED1), 0, 0, 0.0f, 0.0f, 0.0f },
|
||||
{ _GEN(CHORUSSEND), 1, 1, 0.0f, 1000.0f, 0.0f },
|
||||
{ _GEN(REVERBSEND), 1, 1, 0.0f, 1000.0f, 0.0f },
|
||||
{ _GEN(PAN), 1, 1, -500.0f, 500.0f, 0.0f },
|
||||
{ _GEN(UNUSED2), 0, 0, 0.0f, 0.0f, 0.0f },
|
||||
{ _GEN(UNUSED3), 0, 0, 0.0f, 0.0f, 0.0f },
|
||||
{ _GEN(UNUSED4), 0, 0, 0.0f, 0.0f, 0.0f },
|
||||
{ _GEN(MODLFODELAY), 1, 2, -12000.0f, 5000.0f, -12000.0f },
|
||||
{ _GEN(MODLFOFREQ), 1, 4, -16000.0f, 4500.0f, 0.0f },
|
||||
{ _GEN(VIBLFODELAY), 1, 2, -12000.0f, 5000.0f, -12000.0f },
|
||||
{ _GEN(VIBLFOFREQ), 1, 4, -16000.0f, 4500.0f, 0.0f },
|
||||
{ _GEN(MODENVDELAY), 1, 2, -12000.0f, 5000.0f, -12000.0f },
|
||||
{ _GEN(MODENVATTACK), 1, 2, -12000.0f, 8000.0f, -12000.0f },
|
||||
{ _GEN(MODENVHOLD), 1, 2, -12000.0f, 5000.0f, -12000.0f },
|
||||
{ _GEN(MODENVDECAY), 1, 2, -12000.0f, 8000.0f, -12000.0f },
|
||||
{ _GEN(MODENVSUSTAIN), 0, 1, 0.0f, 1000.0f, 0.0f },
|
||||
{ _GEN(MODENVRELEASE), 1, 2, -12000.0f, 8000.0f, -12000.0f },
|
||||
{ _GEN(KEYTOMODENVHOLD), 0, 1, -1200.0f, 1200.0f, 0.0f },
|
||||
{ _GEN(KEYTOMODENVDECAY), 0, 1, -1200.0f, 1200.0f, 0.0f },
|
||||
{ _GEN(VOLENVDELAY), 1, 2, -12000.0f, 5000.0f, -12000.0f },
|
||||
{ _GEN(VOLENVATTACK), 1, 2, -12000.0f, 8000.0f, -12000.0f },
|
||||
{ _GEN(VOLENVHOLD), 1, 2, -12000.0f, 5000.0f, -12000.0f },
|
||||
{ _GEN(VOLENVDECAY), 1, 2, -12000.0f, 8000.0f, -12000.0f },
|
||||
{ _GEN(VOLENVSUSTAIN), 0, 1, 0.0f, 1440.0f, 0.0f },
|
||||
{ _GEN(VOLENVRELEASE), 1, 2, -12000.0f, 8000.0f, -12000.0f },
|
||||
{ _GEN(KEYTOVOLENVHOLD), 0, 1, -1200.0f, 1200.0f, 0.0f },
|
||||
{ _GEN(KEYTOVOLENVDECAY), 0, 1, -1200.0f, 1200.0f, 0.0f },
|
||||
{ _GEN(INSTRUMENT), 0, 0, 0.0f, 0.0f, 0.0f },
|
||||
{ _GEN(RESERVED1), 0, 0, 0.0f, 0.0f, 0.0f },
|
||||
{ _GEN(KEYRANGE), 0, 0, 0.0f, 127.0f, 0.0f },
|
||||
{ _GEN(VELRANGE), 0, 0, 0.0f, 127.0f, 0.0f },
|
||||
{ _GEN(STARTLOOPADDRCOARSEOFS), 0, 1, -1e10f, 1e10f, 0.0f },
|
||||
{ _GEN(KEYNUM), 1, 0, 0.0f, 127.0f, -1.0f },
|
||||
{ _GEN(VELOCITY), 1, 1, 0.0f, 127.0f, -1.0f },
|
||||
{ _GEN(ATTENUATION), 1, 1, 0.0f, 1440.0f, 0.0f },
|
||||
{ _GEN(RESERVED2), 0, 0, 0.0f, 0.0f, 0.0f },
|
||||
{ _GEN(ENDLOOPADDRCOARSEOFS), 0, 1, -1e10f, 1e10f, 0.0f },
|
||||
{ _GEN(COARSETUNE), 0, 1, -120.0f, 120.0f, 0.0f },
|
||||
{ _GEN(FINETUNE), 0, 1, -99.0f, 99.0f, 0.0f },
|
||||
{ _GEN(SAMPLEID), 0, 0, 0.0f, 0.0f, 0.0f },
|
||||
{ _GEN(SAMPLEMODE), 0, 0, 0.0f, 0.0f, 0.0f },
|
||||
{ _GEN(RESERVED3), 0, 0, 0.0f, 0.0f, 0.0f },
|
||||
{ _GEN(SCALETUNE), 0, 1, 0.0f, 1200.0f, 100.0f },
|
||||
{ _GEN(EXCLUSIVECLASS), 0, 0, 0.0f, 0.0f, 0.0f },
|
||||
{ _GEN(OVERRIDEROOTKEY), 1, 0, 0.0f, 127.0f, -1.0f },
|
||||
{ _GEN(PITCH), 1, 0, 0.0f, 127.0f, 0.0f },
|
||||
{ _GEN(CUSTOM_BALANCE), 1, 0, -960.0f, 960.0f, 0.0f },
|
||||
{ _GEN(CUSTOM_FILTERFC), 1, 2, 0.0f, 22050.0f, 0.0f },
|
||||
{ _GEN(CUSTOM_FILTERQ), 1, 1, 0.0f, 960.0f, 0.0f }
|
||||
};
|
||||
|
||||
/* fluid_gen_init
|
||||
|
@ -122,3 +125,9 @@ fluid_real_t fluid_gen_scale_nrpn(int gen, int data)
|
|||
fluid_clip(data, -8192, 8192);
|
||||
return (fluid_real_t)(data * fluid_gen_info[gen].nrpn_scale);
|
||||
}
|
||||
|
||||
|
||||
const char *fluid_gen_name(int gen)
|
||||
{
|
||||
return fluid_gen_info[gen].name;
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
typedef struct _fluid_gen_info_t
|
||||
{
|
||||
char num; /* Generator number */
|
||||
char *name;
|
||||
char init; /* Does the generator need to be initialized (not used) */
|
||||
char nrpn_scale; /* The scale to convert from NRPN (cfr. fluid_gen_map_nrpn()) */
|
||||
float min; /* The minimum value */
|
||||
|
@ -60,6 +61,7 @@ enum fluid_gen_flags
|
|||
fluid_real_t fluid_gen_scale(int gen, float value);
|
||||
fluid_real_t fluid_gen_scale_nrpn(int gen, int nrpn);
|
||||
void fluid_gen_init(fluid_gen_t *gen, fluid_channel_t *channel);
|
||||
const char *fluid_gen_name(int gen);
|
||||
|
||||
|
||||
#endif /* _FLUID_GEN_H */
|
||||
|
|
|
@ -145,7 +145,7 @@ static void dump_gens(const fluid_gen_t gen[])
|
|||
{
|
||||
if (gen[i].flags)
|
||||
{
|
||||
fmt("%d: %.2f", i, gen[i].val);
|
||||
fmt("%s: %.2f", fluid_gen_name(i), gen[i].val);
|
||||
}
|
||||
}
|
||||
outdent();
|
||||
|
@ -153,7 +153,7 @@ static void dump_gens(const fluid_gen_t gen[])
|
|||
|
||||
static void dump_mod(const fluid_mod_t *mod)
|
||||
{
|
||||
fmt("dest: %u", mod->dest);
|
||||
fmt("dest: %s", fluid_gen_name(mod->dest));
|
||||
fmt("src1: %u", mod->src1);
|
||||
fmt("flags1: %u", mod->flags1);
|
||||
fmt("src2: %u", mod->src2);
|
||||
|
|
Loading…
Reference in a new issue