00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef _FLUIDSYNTH_SYNTH_H
00022 #define _FLUIDSYNTH_SYNTH_H
00023
00024
00025 #ifdef __cplusplus
00026 extern "C" {
00027 #endif
00028
00029
00056 FLUIDSYNTH_API fluid_synth_t* new_fluid_synth(fluid_settings_t* settings);
00057
00058
00065 FLUIDSYNTH_API int delete_fluid_synth(fluid_synth_t* synth);
00066
00067
00073 FLUIDSYNTH_API fluid_settings_t* fluid_synth_get_settings(fluid_synth_t* synth);
00074
00075
00076
00077
00078
00079
00080
00081
00083 FLUIDSYNTH_API int fluid_synth_noteon(fluid_synth_t* synth, int chan, int key, int vel);
00084
00086 FLUIDSYNTH_API int fluid_synth_noteoff(fluid_synth_t* synth, int chan, int key);
00087
00089 FLUIDSYNTH_API int fluid_synth_cc(fluid_synth_t* synth, int chan, int ctrl, int val);
00090
00092 FLUIDSYNTH_API int fluid_synth_get_cc(fluid_synth_t* synth, int chan, int ctrl, int* pval);
00093
00095 FLUIDSYNTH_API int fluid_synth_pitch_bend(fluid_synth_t* synth, int chan, int val);
00096
00098 FLUIDSYNTH_API
00099 int fluid_synth_get_pitch_bend(fluid_synth_t* synth, int chan, int* ppitch_bend);
00100
00102 FLUIDSYNTH_API int fluid_synth_pitch_wheel_sens(fluid_synth_t* synth, int chan, int val);
00103
00105 FLUIDSYNTH_API int fluid_synth_get_pitch_wheel_sens(fluid_synth_t* synth, int chan, int* pval);
00106
00108 FLUIDSYNTH_API int fluid_synth_program_change(fluid_synth_t* synth, int chan, int program);
00109
00111 FLUIDSYNTH_API
00112 int fluid_synth_bank_select(fluid_synth_t* synth, int chan, unsigned int bank);
00113
00115 FLUIDSYNTH_API
00116 int fluid_synth_sfont_select(fluid_synth_t* synth, int chan, unsigned int sfont_id);
00117
00130 FLUIDSYNTH_API
00131 int fluid_synth_program_select(fluid_synth_t* synth, int chan,
00132 unsigned int sfont_id,
00133 unsigned int bank_num,
00134 unsigned int preset_num);
00135
00138 FLUIDSYNTH_API
00139 int fluid_synth_get_program(fluid_synth_t* synth, int chan,
00140 unsigned int* sfont_id,
00141 unsigned int* bank_num,
00142 unsigned int* preset_num);
00143
00148 FLUIDSYNTH_API int fluid_synth_program_reset(fluid_synth_t* synth);
00149
00152 FLUIDSYNTH_API int fluid_synth_system_reset(fluid_synth_t* synth);
00153
00154
00155
00156
00157
00158
00159
00160
00163 FLUIDSYNTH_API int fluid_synth_start(fluid_synth_t* synth, unsigned int id,
00164 fluid_preset_t* preset, int audio_chan,
00165 int midi_chan, int key, int vel);
00166
00168 FLUIDSYNTH_API int fluid_synth_stop(fluid_synth_t* synth, unsigned int id);
00169
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00194 FLUIDSYNTH_API
00195 int fluid_synth_sfload(fluid_synth_t* synth, const char* filename, int reset_presets);
00196
00204 FLUIDSYNTH_API int fluid_synth_sfreload(fluid_synth_t* synth, unsigned int id);
00205
00213 FLUIDSYNTH_API int fluid_synth_sfunload(fluid_synth_t* synth, unsigned int id, int reset_presets);
00214
00222 FLUIDSYNTH_API int fluid_synth_add_sfont(fluid_synth_t* synth, fluid_sfont_t* sfont);
00223
00231 FLUIDSYNTH_API void fluid_synth_remove_sfont(fluid_synth_t* synth, fluid_sfont_t* sfont);
00232
00238 FLUIDSYNTH_API int fluid_synth_sfcount(fluid_synth_t* synth);
00239
00247 FLUIDSYNTH_API fluid_sfont_t* fluid_synth_get_sfont(fluid_synth_t* synth, unsigned int num);
00248
00255 FLUIDSYNTH_API fluid_sfont_t* fluid_synth_get_sfont_by_id(fluid_synth_t* synth, unsigned int id);
00256
00257
00259 FLUIDSYNTH_API fluid_preset_t* fluid_synth_get_channel_preset(fluid_synth_t* synth, int chan);
00260
00261
00262
00263
00264
00265
00266
00267
00268
00269
00271 FLUIDSYNTH_API void fluid_synth_set_reverb(fluid_synth_t* synth, double roomsize,
00272 double damping, double width, double level);
00273
00275 FLUIDSYNTH_API void fluid_synth_set_reverb_on(fluid_synth_t* synth, int on);
00276
00277
00279 FLUIDSYNTH_API double fluid_synth_get_reverb_roomsize(fluid_synth_t* synth);
00280 FLUIDSYNTH_API double fluid_synth_get_reverb_damp(fluid_synth_t* synth);
00281 FLUIDSYNTH_API double fluid_synth_get_reverb_level(fluid_synth_t* synth);
00282 FLUIDSYNTH_API double fluid_synth_get_reverb_width(fluid_synth_t* synth);
00283
00284
00285 #define FLUID_REVERB_DEFAULT_ROOMSIZE 0.2f
00286 #define FLUID_REVERB_DEFAULT_DAMP 0.0f
00287 #define FLUID_REVERB_DEFAULT_WIDTH 0.5f
00288 #define FLUID_REVERB_DEFAULT_LEVEL 0.9f
00289
00290
00291
00292
00293
00294
00295
00296
00297
00298 enum fluid_chorus_mod {
00299 FLUID_CHORUS_MOD_SINE = 0,
00300 FLUID_CHORUS_MOD_TRIANGLE = 1
00301 };
00302
00307 FLUIDSYNTH_API void fluid_synth_set_chorus(fluid_synth_t* synth, int nr, double level,
00308 double speed, double depth_ms, int type);
00309
00311 FLUIDSYNTH_API void fluid_synth_set_chorus_on(fluid_synth_t* synth, int on);
00312
00314 FLUIDSYNTH_API int fluid_synth_get_chorus_nr(fluid_synth_t* synth);
00315 FLUIDSYNTH_API double fluid_synth_get_chorus_level(fluid_synth_t* synth);
00316 FLUIDSYNTH_API double fluid_synth_get_chorus_speed_Hz(fluid_synth_t* synth);
00317 FLUIDSYNTH_API double fluid_synth_get_chorus_depth_ms(fluid_synth_t* synth);
00318 FLUIDSYNTH_API int fluid_synth_get_chorus_type(fluid_synth_t* synth);
00319
00320
00321 #define FLUID_CHORUS_DEFAULT_N 3
00322 #define FLUID_CHORUS_DEFAULT_LEVEL 2.0f
00323 #define FLUID_CHORUS_DEFAULT_SPEED 0.3f
00324 #define FLUID_CHORUS_DEFAULT_DEPTH 8.0f
00325 #define FLUID_CHORUS_DEFAULT_TYPE FLUID_CHORUS_MOD_SINE
00326
00327
00328
00329
00330
00331
00332
00333
00334
00337 FLUIDSYNTH_API int fluid_synth_count_midi_channels(fluid_synth_t* synth);
00338
00341 FLUIDSYNTH_API int fluid_synth_count_audio_channels(fluid_synth_t* synth);
00342
00345 FLUIDSYNTH_API int fluid_synth_count_audio_groups(fluid_synth_t* synth);
00346
00349 FLUIDSYNTH_API int fluid_synth_count_effects_channels(fluid_synth_t* synth);
00350
00351
00352
00353
00354
00355
00356
00357
00358
00360 FLUIDSYNTH_API void fluid_synth_set_gain(fluid_synth_t* synth, float gain);
00361
00363 FLUIDSYNTH_API float fluid_synth_get_gain(fluid_synth_t* synth);
00364
00374 FLUIDSYNTH_API int fluid_synth_get_internal_bufsize(fluid_synth_t* synth);
00375
00377 FLUIDSYNTH_API
00378 int fluid_synth_set_interp_method(fluid_synth_t* synth, int chan, int interp_method);
00379
00380
00381 enum fluid_interp {
00382
00383 FLUID_INTERP_NONE = 0,
00384
00385 FLUID_INTERP_LINEAR = 1,
00386
00387
00388 FLUID_INTERP_DEFAULT = 4,
00389 FLUID_INTERP_4THORDER = 4,
00390 FLUID_INTERP_7THORDER = 7,
00391 FLUID_INTERP_HIGHEST=7
00392 };
00393
00394
00395
00396
00397
00398
00399
00400
00401
00402
00417 FLUIDSYNTH_API
00418 int fluid_synth_set_gen(fluid_synth_t* synth, int chan, int param, float value);
00419
00420
00429 FLUIDSYNTH_API float fluid_synth_get_gen(fluid_synth_t* synth, int chan, int param);
00430
00431
00432
00433
00434
00435
00436
00437
00438
00439
00451 FLUIDSYNTH_API
00452 int fluid_synth_create_key_tuning(fluid_synth_t* synth, int tuning_bank, int tuning_prog,
00453 char* name, double* pitch);
00454
00467 FLUIDSYNTH_API
00468 int fluid_synth_create_octave_tuning(fluid_synth_t* synth, int tuning_bank, int tuning_prog,
00469 char* name, double* pitch);
00470
00485 FLUIDSYNTH_API
00486 int fluid_synth_tune_notes(fluid_synth_t* synth, int tuning_bank, int tuning_prog,
00487 int len, int *keys, double* pitch, int apply);
00488
00496 FLUIDSYNTH_API
00497 int fluid_synth_select_tuning(fluid_synth_t* synth, int chan, int tuning_bank, int tuning_prog);
00498
00504 FLUIDSYNTH_API int fluid_synth_reset_tuning(fluid_synth_t* synth, int chan);
00505
00510 FLUIDSYNTH_API void fluid_synth_tuning_iteration_start(fluid_synth_t* synth);
00511
00512
00522 FLUIDSYNTH_API
00523 int fluid_synth_tuning_iteration_next(fluid_synth_t* synth, int* bank, int* prog);
00524
00525
00537 FLUIDSYNTH_API int fluid_synth_tuning_dump(fluid_synth_t* synth, int bank, int prog,
00538 char* name, int len, double* pitch);
00539
00540
00541
00542
00543
00544
00545
00546
00547
00548
00554 FLUIDSYNTH_API double fluid_synth_get_cpu_load(fluid_synth_t* synth);
00555
00557 FLUIDSYNTH_API char* fluid_synth_error(fluid_synth_t* synth);
00558
00559
00560
00561
00562
00563
00564
00565
00566
00567
00568
00569
00570
00586 FLUIDSYNTH_API int fluid_synth_write_s16(fluid_synth_t* synth, int len,
00587 void* lout, int loff, int lincr,
00588 void* rout, int roff, int rincr);
00589
00590
00606 FLUIDSYNTH_API int fluid_synth_write_float(fluid_synth_t* synth, int len,
00607 void* lout, int loff, int lincr,
00608 void* rout, int roff, int rincr);
00609
00610 FLUIDSYNTH_API int fluid_synth_nwrite_float(fluid_synth_t* synth, int len,
00611 float** left, float** right,
00612 float** fx_left, float** fx_right);
00613
00628 FLUIDSYNTH_API int fluid_synth_process(fluid_synth_t* synth, int len,
00629 int nin, float** in,
00630 int nout, float** out);
00631
00632
00633
00634
00635 typedef int (*fluid_audio_callback_t)(fluid_synth_t* synth, int len,
00636 void* out1, int loff, int lincr,
00637 void* out2, int roff, int rincr);
00638
00639
00640
00641
00642
00643
00644
00645
00646
00647
00651 FLUIDSYNTH_API void fluid_synth_add_sfloader(fluid_synth_t* synth, fluid_sfloader_t* loader);
00652
00659 FLUIDSYNTH_API fluid_voice_t* fluid_synth_alloc_voice(fluid_synth_t* synth, fluid_sample_t* sample,
00660 int channum, int key, int vel);
00661
00667 FLUIDSYNTH_API void fluid_synth_start_voice(fluid_synth_t* synth, fluid_voice_t* voice);
00668
00669
00672 FLUIDSYNTH_API void fluid_synth_get_voicelist(fluid_synth_t* synth,
00673 fluid_voice_t* buf[], int bufsize, int ID);
00674
00675
00677 FLUIDSYNTH_API int fluid_synth_handle_midi_event(void* data, fluid_midi_event_t* event);
00678
00679
00681 FLUIDSYNTH_API void fluid_synth_set_midi_router(fluid_synth_t* synth,
00682 fluid_midi_router_t* router);
00683
00684 #ifdef __cplusplus
00685 }
00686 #endif
00687
00688 #endif