// --------------------------------------------------------------
// --------------------------------------------------------------
#ifndef _PARAM_SCALE_H_
#define	_PARAM_SCALE_H_

#include "synth_types.h"

enum
{
	SYNTH_PARAM_VOLUME = 0,
	SYNTH_PARAM_TUNE,
	SYNTH_PARAM_TOTAL_NUM_VOICES,
	SYNTH_PARAM_VOICE_PAN_SPREAD,
	SYNTH_PARAM_HUMANIZE_ENABLE,
	SYNTH_PARAM_MONOPHONIC_ENABLE,
	SYNTH_PARAM_MONOPHONIC_RETRIGGER_ENABLE,
	SYNTH_PARAM_UNISONO_ENABLE,
	SYNTH_PARAM_UNISONO_NUM_VOICES,
	SYNTH_PARAM_HUMANIZE_VAR_VCO,
	SYNTH_PARAM_HUMANIZE_VAR_VCF,
	SYNTH_PARAM_HUMANIZE_VAR_ENV,
	SYNTH_PARAM_PORTAMENTO_TIME,
	SYNTH_PARAM_OSC_0_RESTART_ON_TRIGGER,
	SYNTH_PARAM_OSC_1_RESTART_ON_TRIGGER,
	SYNTH_PARAM_OSC_0_ENABLE,
	SYNTH_PARAM_OSC_1_ENABLE,
	SYNTH_PARAM_OSC_0_LEVEL,
	SYNTH_PARAM_OSC_1_LEVEL,
	SYNTH_PARAM_OSC_0_DUTYCYCLE,
	SYNTH_PARAM_OSC_1_DUTYCYCLE,
	SYNTH_PARAM_OSC_0_DETUNE,
	SYNTH_PARAM_OSC_1_DETUNE,
	SYNTH_PARAM_OSC_0_TRANSPOSE,
	SYNTH_PARAM_OSC_1_TRANSPOSE,
	SYNTH_PARAM_OSC_0_PB_RANGE_MIN,
	SYNTH_PARAM_OSC_1_PB_RANGE_MIN,
	SYNTH_PARAM_OSC_0_PB_RANGE_MAX,
	SYNTH_PARAM_OSC_1_PB_RANGE_MAX,
	SYNTH_PARAM_OSC_0_WAVEFORM,
	SYNTH_PARAM_OSC_1_WAVEFORM,
	SYNTH_PARAM_OSC_0_FM_AMT_0,
	SYNTH_PARAM_OSC_1_FM_AMT_0,
	SYNTH_PARAM_OSC_0_FM_AMT_1,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------------------------------------------------
// Types
// --------------------------------------------------------------
typedef struct _sparam_info_t
{
	UINT32 id;
	int midiControllerId;
	char *pName;
	synth_float_t base, kexp, scenter, pmin, pcenter, pmax, pinterval;

} param_info_t;

// --------------------------------------------------------------
#if defined(__cplusplus)
extern "C" {
#endif

// --------------------------------------------------------------
// Exported functions
// --------------------------------------------------------------
void paramInfoInit(param_info_t *pObj, UINT32 id, const char *pName);
void paramInfoFree(param_info_t *pObj);
void paramInfoSetPMIN(param_info_t *pObj, synth_float_t value);
void paramInfoSetPMAX(param_info_t *pObj, synth_float_t value);
void paramInfoSet(param_info_t *pObj, 
							synth_float_t base, 
							synth_float_t kexp, 
							synth_float_t scenter, 
							synth_float_t pmin, 
							synth_float_t pcenter, 
							synth_float_t pmax, 
							synth_float_t pinterval);

void paramInfoCopy(param_info_t *pDst, param_info_t const *pSrc);
synth_float_t clampParam(param_info_t *pObj, synth_float_t p);
synth_float_t toParam(param_info_t *pObj, synth_float_t s);
synth_float_t toSlider(param_info_t *pObj, synth_float_t p);
param_info_t* getParamInfo(UINT32 type);

#if defined(__cplusplus)
}
#endif
// --------------------------------------------------------------

#endif // _PARAM_SCALE_H_
