// --------------------------------------------------------------
// --------------------------------------------------------------
#ifndef _SYNTH_DEFS_H_
#define	_SYNTH_DEFS_H_

#include <limits.h>
#include <math.h>
#include "synth_types.h"

// --------------------------------------------------------------
// Defs
// --------------------------------------------------------------
#define GAIN_EPSILON					10.0
#define MAX_POLYPHONY					256

#define SYNTH_BANDWIDTH					0.833

#define NUM_PROGRAMS					64
#define	NUM_FREQS						128
#define NUM_MIDI_CONTROLLERS			1024

#define	VOICE_NUM_OSC					2
#define	VOICE_NUM_LFO					4
#define	VOICE_NUM_ENV					4

#define FILTER_ORDER					2
#define FILTER_SWEEP_BASE				((synth_float_t)10)
#define FILTER_MAX_ORDER				4
#define FILTER_F_MIN					((synth_float_t)18)
#define FILTER_F_MAX					((synth_float_t)18000)
#define FILTER_Q_MIN					0.7
#define FILTER_Q_MAX					100
#define FILTER_TABLE_SIZE				(4096)
#define FILTER_INTEROLATION_ORDER		1

#define BLIT_NUM_HARM_MAX				(900)
#define BLIT_TABLE_SIZE_MIN				(1024)
#define BLIT_TABLE_SIZE_MAX				(4096)
#define BLIT_TABLE_OVERSAMPLING			(4)
#define BLIT_INTEROLATION_ORDER			(2)

#define SYNTH_LIMITER_RISE_TIME			0.010		//s
#define SYNTH_LIMITER_FALL_TIME			1.000		//s
#define SYNTH_LIMITER_THRESHOLD			-6			// dbFS

#define SYNTH_MAX_BUFSIZE				8192

#ifndef jsy_pi
#define	jsy_pi				3.1415926535897932384626433832795
#define pi_mult_2			(2*jsy_pi)
#define pi_div_2			(0.5*jsy_pi)
#endif

#if defined(__cplusplus)
extern "C" {
#endif
void SynthDebug(const char *fmtstr, ...);
#if defined(__cplusplus)
}
#endif

#ifndef jsy_max
#define jsy_max(a,b)            (((a) > (b)) ? (a) : (b))
#endif

#ifndef jsy_min
#define jsy_min(a,b)            (((a) < (b)) ? (a) : (b))
#endif

#endif // _SYNTH_DEFS_H_

