#ifndef _FLUID_SYNTH_H
#define _FLUID_SYNTH_H
#include "fluid_config.h"
#include "fluidsynth_priv.h"
#include "fluid_list.h"
#include "fluid_rev.h"
#include "fluid_voice.h"
#include "fluid_chorus.h"
#include "fluid_sys.h"
#define FLUID_NUM_PROGRAMS 128
#define DRUM_INST_BANK 128
#if defined(WITH_FLOAT)
#define FLUID_SAMPLE_FORMAT FLUID_SAMPLE_FLOAT
#else
#define FLUID_SAMPLE_FORMAT FLUID_SAMPLE_DOUBLE
#endif
enum fluid_loop {
FLUID_UNLOOPED = 0,
FLUID_LOOP_DURING_RELEASE = 1,
FLUID_NOTUSED = 2,
FLUID_LOOP_UNTIL_RELEASE = 3
};
enum fluid_synth_status
{
FLUID_SYNTH_CLEAN,
FLUID_SYNTH_PLAYING,
FLUID_SYNTH_QUIET,
FLUID_SYNTH_STOPPED
};
typedef struct _fluid_bank_offset_t fluid_bank_offset_t;
struct _fluid_bank_offset_t {
int sfont_id;
int offset;
};
struct _fluid_synth_t
{
fluid_settings_t* settings;
int polyphony;
char with_reverb;
char with_chorus;
char verbose;
char dump;
double sample_rate;
int midi_channels;
int audio_channels;
int audio_groups;
int effects_channels;
unsigned int state;
unsigned int ticks;
fluid_list_t *loaders;
fluid_list_t* sfont;
unsigned int sfont_id;
fluid_list_t* bank_offsets;
#if defined(MACOS9)
fluid_list_t* unloading;
#endif
double gain;
fluid_channel_t** channel;
int num_channels;
int nvoice;
fluid_voice_t** voice;
unsigned int noteid;
unsigned int storeid;
int nbuf;
fluid_real_t** left_buf;
fluid_real_t** right_buf;
fluid_real_t** fx_left_buf;
fluid_real_t** fx_right_buf;
fluid_revmodel_t* reverb;
fluid_chorus_t* chorus;
int cur;
int dither_index;
char outbuf[256];
fluid_tuning_t*** tuning;
fluid_tuning_t* cur_tuning;
unsigned int min_note_length_ticks;
};
int fluid_synth_setstr(fluid_synth_t* synth, char* name, char* str);
int fluid_synth_getstr(fluid_synth_t* synth, char* name, char** str);
int fluid_synth_setnum(fluid_synth_t* synth, char* name, double val);
int fluid_synth_getnum(fluid_synth_t* synth, char* name, double* val);
int fluid_synth_setint(fluid_synth_t* synth, char* name, int val);
int fluid_synth_getint(fluid_synth_t* synth, char* name, int* val);
int fluid_synth_set_reverb_preset(fluid_synth_t* synth, int num);
int fluid_synth_one_block(fluid_synth_t* synth, int do_not_mix_fx_to_out);
fluid_preset_t* fluid_synth_get_preset(fluid_synth_t* synth,
unsigned int sfontnum,
unsigned int banknum,
unsigned int prognum);
fluid_preset_t* fluid_synth_find_preset(fluid_synth_t* synth,
unsigned int banknum,
unsigned int prognum);
int fluid_synth_all_notes_off(fluid_synth_t* synth, int chan);
int fluid_synth_all_sounds_off(fluid_synth_t* synth, int chan);
int fluid_synth_modulate_voices(fluid_synth_t* synth, int chan, int is_cc, int ctrl);
int fluid_synth_modulate_voices_all(fluid_synth_t* synth, int chan);
int fluid_synth_damp_voices(fluid_synth_t* synth, int chan);
int fluid_synth_kill_voice(fluid_synth_t* synth, fluid_voice_t * voice);
void fluid_synth_kill_by_exclusive_class(fluid_synth_t* synth, fluid_voice_t* voice);
void fluid_synth_release_voice_on_same_note(fluid_synth_t* synth, int chan, int key);
void fluid_synth_sfunload_macos9(fluid_synth_t* synth);
void fluid_synth_print_voice(fluid_synth_t* synth);
void fluid_synth_update_presets(fluid_synth_t* synth);
int fluid_synth_update_gain(fluid_synth_t* synth, char* name, double value);
int fluid_synth_update_polyphony(fluid_synth_t* synth, char* name, int value);
fluid_bank_offset_t* fluid_synth_get_bank_offset0(fluid_synth_t* synth, int sfont_id);
void fluid_synth_remove_bank_offset(fluid_synth_t* synth, int sfont_id);
void fluid_synth_dither_s16(int *dither_index, int len, float* lin, float* rin,
void* lout, int loff, int lincr,
void* rout, int roff, int rincr);
void fluid_synth_settings(fluid_settings_t* settings);
#endif