40 #define FLUID_NUM_PROGRAMS 129 263 void setGen(
int n,
float v,
char a) { gen[n] = v; gen_abs[n] = a; }
264 float getGen(
int n)
const {
return gen[n]; }
268 void setCC(
int n,
int val) { cc[n] = val; }
270 void setPreset(
Preset* p);
278 void setcc(
int ctrl,
int val);
279 void pitchBend(
int val);
281 void pitchWheelSens(
int val);
311 int _loadProgress = 0;
312 bool _loadWasCanceled =
false;
315 void updatePatchList();
318 bool _globalTerminate =
false;
329 SFont* get_sfont_by_name(
const QString& name);
330 SFont* get_sfont_by_id(
int id);
332 bool sfunload(
int id);
333 int sfload(
const QString& filename);
338 virtual void init(
float sampleRate);
340 virtual const char*
name()
const {
return "Fluid"; }
343 virtual const QList<MidiPatch*>&
getPatchInfo()
const {
return patches; }
349 virtual void allSoundsOff(
int);
350 virtual void allNotesOff(
int);
357 Preset* get_preset(
unsigned int sfontnum,
unsigned int banknum,
unsigned int prognum);
358 Preset* find_preset(
unsigned int banknum,
unsigned int prognum);
359 void modulate_voices(
int chan,
bool is_cc,
int ctrl);
360 void modulate_voices_all(
int chan);
361 void damp_voices(
int chan);
362 int kill_voice(
Voice * voice);
368 void update_presets();
370 int get_cc(
int chan,
int num)
const {
return channel[chan]->cc[num]; }
373 void program_change(
int chan,
int prognum);
375 void set_gen2(
int chan,
int param,
float value,
int absolute,
int normalized);
376 float get_gen(
int chan,
int param);
377 void set_gen(
int chan,
int param,
float value);
378 void set_interp_method(
int chan,
int interp_method);
382 virtual bool loadSoundFonts(
const QStringList& s);
383 virtual bool addSoundFont(
const QString& s);
384 virtual bool removeSoundFont(
const QString& s);
385 QStringList soundFonts()
const;
386 std::vector<SoundFontInfo> soundFontsInfo()
const override;
388 void start_voice(
Voice* voice);
389 Voice* alloc_voice(
unsigned id,
Sample* sample,
int chan,
int key,
int vel,
double vt);
390 void free_voice_by_kill();
392 virtual void process(
unsigned len,
float* out,
float* effect1,
float* effect2);
394 bool program_select(
int chan,
unsigned sfont_id,
unsigned bank_num,
unsigned preset_num);
395 void get_program(
int chan,
unsigned* sfont_id,
unsigned* bank_num,
unsigned* preset_num);
399 void get_pitch_wheel_sens(
int chan,
int* pval);
400 void pitch_wheel_sens(
int chan,
int val);
401 void get_pitch_bend(
int chan,
int* ppitch_bend);
403 void freeVoice(
Voice* v);
405 double getPitch(
int k)
const {
return _tuning[k]; }
406 float ct2hz_real(
float cents) {
return powf(2.0f, (cents - 6900.0f) / 1200.0f) * _masterTuning; }
408 float act2hz(
float c) {
return 8.176 * pow(2.0, (
double) c / 1200.0); }
409 float ct2hz(
float cents) {
return act2hz(qBound(1500.0f, cents, 13500.0f)); }
414 QString
error()
const {
return _error; }
418 static QFileInfoList sfFiles();
439 #define FLUID_CHORUS_DEFAULT_N 3 440 #define FLUID_CHORUS_DEFAULT_LEVEL 2.0f 441 #define FLUID_CHORUS_DEFAULT_SPEED 0.3f 442 #define FLUID_CHORUS_DEFAULT_DEPTH 8.0f 443 #define FLUID_CHORUS_DEFAULT_TYPE FLUID_CHORUS_MOD_SINE 466 #define fluid_sample_refcount(_sample) ((_sample)->refcount) 485 unsigned int nbframes,
short copy_data,
int rootkey);
493 #define FLUID_NUM_MOD 64 532 #define fluid_check_fpe(expl) 540 float a0, a1, a2,
a3;
574 void clone(
Mod* mod)
const;
577 return (((src1 == ctrl) && (flags1 &
FLUID_MOD_CC) && cc)
578 || (((src1 == ctrl) && (!(flags1 & FLUID_MOD_CC)) && !cc)))
579 || (((src2 == ctrl) && (flags2 & FLUID_MOD_CC) && cc)
580 || (((src2 == ctrl) && (!(flags2 &
FLUID_MOD_CC)) && !cc)));
582 void set_source1(
int src,
int flags);
583 void set_source2(
int src,
int flags);
614 #define fluid_mod_has_source(mod,cc,ctrl) \ 615 ( ((((mod)->src1 == ctrl) && (((mod)->flags1 & FLUID_MOD_CC) != 0) && (cc != 0)) \ 616 || ((((mod)->src1 == ctrl) && (((mod)->flags1 & FLUID_MOD_CC) == 0) && (cc == 0)))) \ 617 || ((((mod)->src2 == ctrl) && (((mod)->flags2 & FLUID_MOD_CC) != 0) && (cc != 0)) \ 618 || ((((mod)->src2 == ctrl) && (((mod)->flags2 & FLUID_MOD_CC) == 0) && (cc == 0))))) 620 #define fluid_mod_has_dest(mod,gen) ((mod)->dest == gen) 626 #define FLUID_INTERP_BITS 8 627 #define FLUID_INTERP_BITS_MASK 0xff000000 628 #define FLUID_INTERP_BITS_SHIFT 24 629 #define FLUID_INTERP_MAX 256 631 #define FLUID_FRACT_MAX ((double)4294967296.0) 653 void setInt(qint32 b) { data = qint64(b) << 32; }
655 data = (((qint64)(b)) << 32) | (quint32) (((
double)(b) - (
int)(b)) * (double)
FLUID_FRACT_MAX);
660 int index()
const {
return data >> 32; }
661 quint32
fract()
const {
return quint32(data & 0xffffffff); }
662 quint32
index_round()
const {
return quint32((data+0x80000000) >> 32); }
675 #define fluid_phase_fract_to_tablerow(_x) \ 676 ((int)(((_x).fract() & FLUID_INTERP_BITS_MASK) >> FLUID_INTERP_BITS_SHIFT)) 678 #define fluid_phase_double(_x) \ 679 ((double)((_x).index()) + ((double)((_x).fract()) / FLUID_FRACT_MAX)) 685 #define fluid_phase_steps(_phase,_idx,_incr) \ 686 (int)(((double)(_idx) - fluid_phase_double(_phase)) / (double)_incr) 691 #define fluid_phase_index_plusplus(a) (((a)._index)++) 695 #endif // __FLUID_S_H__
short pitch_bend
Definition: fluid.h:228
#define FLUID_FRACT_MAX
Definition: fluid.h:631
Reserved.
Definition: fluid.h:199
Chorus send amount.
Definition: fluid.h:159
Instrument ID (shouldn't be set by user)
Definition: fluid.h:185
void setLoadWasCanceled(bool status)
Definition: fluid.h:355
QList< SFont * > sfonts
Definition: fluid.h:298
QMutex mutex
Definition: fluid.h:314
unsigned char flags
Is the generator set or not (fluid_gen_flags)
Definition: fluid.h:500
void fluid_gen_set_default_values(Generator *gen)
Set an array of generators to their default values.
Definition: gen.cpp:97
int getPrognum() const
Definition: fluid.h:277
Fluid * synth
Definition: fluid.h:217
virtual const QList< MidiPatch * > & getPatchInfo() const
Definition: fluid.h:343
Unused.
Definition: fluid.h:164
bool globalTerminate()
Definition: fluid.h:420
int get_flags1() const
Definition: fluid.h:587
Sample end address offset (-32767-0)
Definition: fluid.h:145
Volume envelope delay.
Definition: fluid.h:177
Phase(qint64 v)
Definition: fluid.h:665
int get_source2() const
Definition: fluid.h:588
unsigned int sfontnum
Definition: fluid.h:219
Definition: synthesizer.h:41
Modulation envelope attack.
Definition: fluid.h:170
Fixed MIDI note number.
Definition: fluid.h:190
bool loadWasCanceled()
Definition: fluid.h:354
Sample start address offset (0-32767)
Definition: fluid.h:144
double mod
Change by modulators.
Definition: fluid.h:502
Modulation envelope decay.
Definition: fluid.h:172
Volume envelope release.
Definition: fluid.h:182
Modulation envelope hold.
Definition: fluid.h:171
Modulation LFO frequency.
Definition: fluid.h:166
void operator-=(int b)
Definition: fluid.h:659
virtual const char * name() const
Definition: fluid.h:340
int interp_method
Definition: fluid.h:235
Stereo panning.
Definition: fluid.h:161
Key to modulation envelope hold.
Definition: fluid.h:175
float ct2hz(float cents)
Definition: fluid.h:409
Key to volume envelope hold.
Definition: fluid.h:183
Volume envelope attack.
Definition: fluid.h:178
fluid_mod_src
Definition: fluid.h:598
Modulation envelope sustain.
Definition: fluid.h:173
Sample root note override.
Definition: fluid.h:202
MIDI note range.
Definition: fluid.h:187
Modulation LFO to filter cutoff.
Definition: fluid.h:154
void setGen(int n, float v, char a)
Definition: fluid.h:263
void operator-=(const Phase &b)
Definition: fluid.h:658
Sample loop end address offset (-32767-32767)
Definition: fluid.h:147
int fluid_sample_set_sound_data(Sample *sample, short *data, unsigned int nbframes, short copy_data, int rootkey)
Initial volume attenuation.
Definition: fluid.h:192
unsigned char src1
Definition: fluid.h:568
bool sustained() const
Definition: fluid.h:262
Generator value is set.
Definition: fluid.h:514
Filter Q.
Definition: fluid.h:153
Modulation envelope delay.
Definition: fluid.h:169
double nrpn
Change by NRPN messages.
Definition: fluid.h:503
short key_pressure
Definition: fluid.h:226
Modulation envelope to filter cutoff.
Definition: fluid.h:155
fluid_mod_flags
Definition: fluid.h:548
unsigned char bank_msb
Definition: fluid.h:234
fluid_gen_type
Generator (effect) numbers (SoundFont 2.01 specifications section 8.1.3)
Definition: fluid.h:143
float act2hz(float c)
Definition: fluid.h:408
Unused.
Definition: fluid.h:162
virtual void setMasterTuning(double f)
Definition: fluid.h:412
Unused.
Definition: fluid.h:158
Sample loop start address offset (-32767-32767)
Definition: fluid.h:146
unsigned int banknum
Definition: fluid.h:220
int get_cc(int chan, int num) const
Definition: fluid.h:370
fluid_chorus_mod
Definition: fluid.h:433
Fine tuning.
Definition: fluid.h:196
Volume envelope sustain.
Definition: fluid.h:181
fluid_loop
Definition: fluid.h:42
Sample end loop address coarse offset (X 32768)
Definition: fluid.h:194
short pitch_wheel_sensitivity
Definition: fluid.h:229
Vibrato LFO frequency.
Definition: fluid.h:168
Definition: synthesizergui.h:24
QList< Voice * > freeVoices
Definition: fluid.h:301
void setFloat(double b)
Definition: fluid.h:654
fluid_interp
Definition: fluid.h:453
fluid_midi_control_change
Definition: fluid.h:65
Sample end address coarse offset (X 32768)
Definition: fluid.h:156
int loadProgress()
Definition: fluid.h:352
Modulation LFO delay.
Definition: fluid.h:165
unsigned char flags1
Definition: fluid.h:569
void operator+=(const Phase &p)
Definition: fluid.h:652
Sample start loop address coarse offset (X 32768)
Definition: fluid.h:189
float _masterTuning
Definition: fluid.h:308
int get_source1() const
Definition: fluid.h:586
void set_nrpn(double _val)
Definition: fluid.h:506
qint64 data
Definition: fluid.h:650
Coarse tuning.
Definition: fluid.h:195
void setCC(int n, int val)
Definition: fluid.h:268
Volume envelope hold.
Definition: fluid.h:179
unsigned int sfont_id
Definition: fluid.h:323
unsigned char dest
Definition: fluid.h:567
void setSfontnum(unsigned int s)
Definition: fluid.h:273
Value defines the count of generators (fluid_gen_type)
Definition: fluid.h:209
int index() const
Definition: fluid.h:660
float ct2hz_real(float cents)
Definition: fluid.h:406
Modulation envelope to pitch.
Definition: fluid.h:151
Vibrato LFO to pitch.
Definition: fluid.h:150
double getPitch(int k) const
Definition: fluid.h:405
Unused.
Definition: fluid.h:163
void setInt(qint32 b)
Definition: fluid.h:653
MIDI velocity range.
Definition: fluid.h:188
float getGen(int n) const
Definition: fluid.h:264
QString _error
Definition: fluid.h:303
int sfont_id
Definition: fluid.h:61
void setBanknum(unsigned int b)
Definition: fluid.h:275
unsigned char src2
Definition: fluid.h:570
void setInterpMethod(int m)
Definition: fluid.h:284
Definition: aeolus.cpp:26
QList< MidiPatch * > patches
Definition: fluid.h:299
Preset * preset() const
Definition: fluid.h:271
int _state
Definition: fluid.h:321
unsigned int prognum
Definition: fluid.h:221
int getNum() const
Definition: fluid.h:283
Modulation LFO to pitch.
Definition: fluid.h:149
Scale tuning.
Definition: fluid.h:200
void setGlobalTerminate(bool terminate=true)
Definition: fluid.h:421
float a3
Definition: fluid.h:540
short channel_pressure
Definition: fluid.h:227
int get_dest() const
Definition: fluid.h:590
fluid_synth_status
Definition: fluid.h:49
unsigned int fluid_check_fpe_i386(char *explanation_in_case_of_fpe)
QList< Voice * > activeVoices
Definition: fluid.h:302
double val
The nominal value.
Definition: fluid.h:501
Definition: synthesizerstate.h:40
int channum
Definition: fluid.h:225
Sample ID (shouldn't be set by user)
Definition: fluid.h:197
unsigned int noteid
Definition: fluid.h:327
double sample_rate
Definition: fluid.h:307
bool test_identity(const Mod *mod1, const Mod *mod2)
Definition: mod.cpp:307
int get_flags2() const
Definition: fluid.h:589
void fluid_dump_modulator(Mod *mod)
int getInterpMethod() const
Definition: fluid.h:285
QList< Channel * > channel
Definition: fluid.h:325
SFont * get_sfont(int idx) const
Definition: fluid.h:331
Reserved.
Definition: fluid.h:186
quint32 index_round() const
Definition: fluid.h:662
Phase()
Definition: fluid.h:664
unsigned char flags2
Definition: fluid.h:571
Definition: instrument.h:100
short nrpn_select
Definition: fluid.h:238
Modulation LFO to volume.
Definition: fluid.h:157
Modulation envelope release.
Definition: fluid.h:174
void set_amount(double val)
Definition: fluid.h:585
void set_dest(int val)
Definition: fluid.h:584
Exclusive class number.
Definition: fluid.h:201
Filter cutoff.
Definition: fluid.h:152
SoundFont generator structure.
Definition: fluid.h:498
Vibrato LFO delay.
Definition: fluid.h:167
unsigned int getSfontnum() const
Definition: fluid.h:272
void setPrognum(int p)
Definition: fluid.h:276
Key to volume envelope decay.
Definition: fluid.h:184
Pitch (NOTE: Not a real SoundFont generator)
Definition: fluid.h:208
QString error() const
Definition: fluid.h:414
double amount
Definition: fluid.h:572
Volume envelope decay.
Definition: fluid.h:180
virtual double masterTuning() const
Definition: fluid.h:411
int offset
Definition: fluid.h:62
fluid_voice_add_mod
Definition: fluid.h:525
DOCME.
Definition: fluid.h:515
Sample start address coarse offset (X 32768)
Definition: fluid.h:148
void set_mod(double _val)
Definition: fluid.h:505
unsigned int getBanknum() const
Definition: fluid.h:274
Fixed MIDI velocity value.
Definition: fluid.h:191
Reverb send amount.
Definition: fluid.h:160
Preset * get_channel_preset(int chan) const
Definition: fluid.h:380
Sample mode flags.
Definition: fluid.h:198
Key to modulation envelope decay.
Definition: fluid.h:176
Reserved.
Definition: fluid.h:193
void setLoadProgress(int val)
Definition: fluid.h:353
static bool initialized
Definition: fluid.h:305
double get_amount() const
Definition: fluid.h:591
int getPitchBend() const
Definition: fluid.h:280
quint32 fract() const
Definition: fluid.h:661
fluid_gen_flags
Enum value for 'flags' field of #_Generator (not really flags).
Definition: fluid.h:512
Preset * _preset
Definition: fluid.h:222
int has_source(bool cc, int ctrl)
Definition: fluid.h:576
Generator value is not set.
Definition: fluid.h:513
char getGenAbs(int n) const
Definition: fluid.h:265