/*
  ==============================================================================

    This file was generated by user!

  ==============================================================================
*/

#include <math.h>

#include <synth/synth_defs.h>
#include "JaySynthSound.h"

JaySynthSound::JaySynthSound()
{
	name = String("Default");

	// Default is "Jump" sound
	setParameter(SYNTH_PARAM_VOLUME, 100);
	setParameter(SYNTH_PARAM_VOICE_PAN_SPREAD, 50);
	setParameter(SYNTH_PARAM_TUNE, 0);
	setParameter(SYNTH_PARAM_TOTAL_NUM_VOICES, MAX_POLYPHONY);
	setParameter(SYNTH_PARAM_HUMANIZE_ENABLE, 0);
	setParameter(SYNTH_PARAM_HUMANIZE_VAR_VCO, 0);
	setParameter(SYNTH_PARAM_HUMANIZE_VAR_VCF, 0);
	setParameter(SYNTH_PARAM_HUMANIZE_VAR_ENV, 0);
	setParameter(SYNTH_PARAM_MONOPHONIC_ENABLE, 0);
	setParameter(SYNTH_PARAM_MONOPHONIC_RETRIGGER_ENABLE, 0);
	setParameter(SYNTH_PARAM_UNISONO_ENABLE, 0);
	setParameter(SYNTH_PARAM_UNISONO_NUM_VOICES, 8);
	setParameter(SYNTH_PARAM_PORTAMENTO_TIME, 0.0);
	setParameter(SYNTH_PARAM_OSC_0_ENABLE, 1);
	setParameter(SYNTH_PARAM_OSC_1_ENABLE, 1);
	setParameter(SYNTH_PARAM_OSC_0_RESTART_ON_TRIGGER, 0);
	setParameter(SYNTH_PARAM_OSC_1_RESTART_ON_TRIGGER, 0);
	setParameter(SYNTH_PARAM_OSC_0_LEVEL, 100);
	setParameter(SYNTH_PARAM_OSC_1_LEVEL, 100);
	setParameter(SYNTH_PARAM_OSC_0_DUTYCYCLE, 50);
	setParameter(SYNTH_PARAM_OSC_1_DUTYCYCLE, 50);
	setParameter(SYNTH_PARAM_OSC_0_DETUNE, -4);
	setParameter(SYNTH_PARAM_OSC_1_DETUNE, +4);
	setParameter(SYNTH_PARAM_OSC_0_TRANSPOSE, 0);
	setParameter(SYNTH_PARAM_OSC_1_TRANSPOSE, 0);
	setParameter(SYNTH_PARAM_OSC_0_WAVEFORM, 0);
	setParameter(SYNTH_PARAM_OSC_1_WAVEFORM, 0);
	setParameter(SYNTH_PARAM_OSC_0_PB_RANGE_MIN, -12);
	setParameter(SYNTH_PARAM_OSC_1_PB_RANGE_MIN, -12);
	setParameter(SYNTH_PARAM_OSC_0_PB_RANGE_MAX, +12);
	setParameter(SYNTH_PARAM_OSC_1_PB_RANGE_MAX, +12);
	setParameter(SYNTH_PARAM_OSC_0_FM_AMT_0, 0);
	setParameter(SYNTH_PARAM_OSC_1_FM_AMT_0, 0);
	setParameter(SYNTH_PARAM_OSC_0_FM_AMT_1, 0);
	setParameter(SYNTH_PARAM_OSC_1_FM_AMT_1, 0);
	setParameter(SYNTH_PARAM_OSC_0_FM_SRC_0, 0);
	setParameter(SYNTH_PARAM_OSC_1_FM_SRC_0, 0);
	setParameter(SYNTH_PARAM_OSC_0_FM_SRC_1, 0);
	setParameter(SYNTH_PARAM_OSC_1_FM_SRC_1, 0);
	setParameter(SYNTH_PARAM_OSC_0_FM_SRC_OP, VOICE_MOD_SRC_OP_ADD);
	setParameter(SYNTH_PARAM_OSC_1_FM_SRC_OP, VOICE_MOD_SRC_OP_ADD);
	setParameter(SYNTH_PARAM_OSC_0_AM_AMT_0, 0);
	setParameter(SYNTH_PARAM_OSC_1_AM_AMT_0, 0);
	setParameter(SYNTH_PARAM_OSC_0_AM_AMT_1, 0);
	setParameter(SYNTH_PARAM_OSC_1_AM_AMT_1, 0);
	setParameter(SYNTH_PARAM_OSC_0_AM_SRC_0, 0);
	setParameter(SYNTH_PARAM_OSC_1_AM_SRC_0, 0);
	setParameter(SYNTH_PARAM_OSC_0_AM_SRC_1, 0);
	setParameter(SYNTH_PARAM_OSC_1_AM_SRC_1, 0);
	setParameter(SYNTH_PARAM_OSC_0_AM_SRC_OP, VOICE_MOD_SRC_OP_ADD);
	setParameter(SYNTH_PARAM_OSC_1_AM_SRC_OP, VOICE_MOD_SRC_OP_ADD);
	setParameter(SYNTH_PARAM_OSC_0_PWM_AMT_0, 0);
	setParameter(SYNTH_PARAM_OSC_1_PWM_AMT_0, 0);
	setParameter(SYNTH_PARAM_OSC_0_PWM_AMT_1, 0);
	setParameter(SYNTH_PARAM_OSC_1_PWM_AMT_1, 0);
	setParameter(SYNTH_PARAM_OSC_0_PWM_SRC_0, 0);
	setParameter(SYNTH_PARAM_OSC_1_PWM_SRC_0, 0);
	setParameter(SYNTH_PARAM_OSC_0_PWM_SRC_1, 0);
	setParameter(SYNTH_PARAM_OSC_1_PWM_SRC_1, 0);
	setParameter(SYNTH_PARAM_OSC_0_PWM_SRC_OP, VOICE_MOD_SRC_OP_ADD);
	setParameter(SYNTH_PARAM_OSC_1_PWM_SRC_OP, VOICE_MOD_SRC_OP_ADD);
	setParameter(SYNTH_PARAM_NOISE_ENABLE, 0);
	setParameter(SYNTH_PARAM_NOISE_LEVEL, 50);
	setParameter(SYNTH_PARAM_NOISE_SHAPE, VOICE_NOISE_SHAPE_WHITE);
	setParameter(SYNTH_PARAM_VCA_ENV_AMT, 100);
	setParameter(SYNTH_PARAM_VCA_ENV_A, 1);
	setParameter(SYNTH_PARAM_VCA_ENV_D, 1000);
	setParameter(SYNTH_PARAM_VCA_ENV_S, 0);
	setParameter(SYNTH_PARAM_VCA_ENV_R, 150);
	setParameter(SYNTH_PARAM_VCF_ENV_A, 1);
	setParameter(SYNTH_PARAM_VCF_ENV_D, 1000);
	setParameter(SYNTH_PARAM_VCF_ENV_S, 0);
	setParameter(SYNTH_PARAM_VCF_ENV_R, 500);
	setParameter(SYNTH_PARAM_ENV_2_A, 1);
	setParameter(SYNTH_PARAM_ENV_2_D, 1000);
	setParameter(SYNTH_PARAM_ENV_2_S, 0);
	setParameter(SYNTH_PARAM_ENV_2_R, 500);
	setParameter(SYNTH_PARAM_ENV_3_A, 1);
	setParameter(SYNTH_PARAM_ENV_3_D, 1000);
	setParameter(SYNTH_PARAM_ENV_3_S, 0);
	setParameter(SYNTH_PARAM_ENV_3_R, 500);
	setParameter(SYNTH_PARAM_VCF_TYPE, VCF_FILTERTYPE_LOWPASS);
	setParameter(SYNTH_PARAM_VCF_ORDER, VCF_FILTERORDER_4);
	setParameter(SYNTH_PARAM_VCF_F, FILTER_F_MAX);
	setParameter(SYNTH_PARAM_VCF_Q, 1.0);
	setParameter(SYNTH_PARAM_VCF_ENV_AMT, 0);
	setParameter(SYNTH_PARAM_LFO_0_SPEED, 1.f);
	setParameter(SYNTH_PARAM_LFO_1_SPEED, 1.f);
	setParameter(SYNTH_PARAM_LFO_2_SPEED, 1.f);
	setParameter(SYNTH_PARAM_LFO_3_SPEED, 1.f);
	setParameter(SYNTH_PARAM_LFO_0_SMOOTH, 0.0);
	setParameter(SYNTH_PARAM_LFO_1_SMOOTH, 0.0);
	setParameter(SYNTH_PARAM_LFO_2_SMOOTH, 0.0);
	setParameter(SYNTH_PARAM_LFO_3_SMOOTH, 0.0);
	setParameter(SYNTH_PARAM_LFO_0_DELAY, 0.0);
	setParameter(SYNTH_PARAM_LFO_1_DELAY, 0.0);
	setParameter(SYNTH_PARAM_LFO_2_DELAY, 0.0);
	setParameter(SYNTH_PARAM_LFO_3_DELAY, 0.0);
	setParameter(SYNTH_PARAM_LFO_0_ATTACK, 0.0);
	setParameter(SYNTH_PARAM_LFO_1_ATTACK, 0.0);
	setParameter(SYNTH_PARAM_LFO_2_ATTACK, 0.0);
	setParameter(SYNTH_PARAM_LFO_3_ATTACK, 0.0);
	setParameter(SYNTH_PARAM_LFO_0_SHAPE, LFO_WAVEFORM_SINE);
	setParameter(SYNTH_PARAM_LFO_1_SHAPE, LFO_WAVEFORM_SINE);
	setParameter(SYNTH_PARAM_LFO_2_SHAPE, LFO_WAVEFORM_SINE);
	setParameter(SYNTH_PARAM_LFO_3_SHAPE, LFO_WAVEFORM_SINE);
	setParameter(SYNTH_PARAM_LFO_0_MODE, VOICE_LFO_MODE_GLOBAL);
	setParameter(SYNTH_PARAM_LFO_1_MODE, VOICE_LFO_MODE_GLOBAL);
	setParameter(SYNTH_PARAM_LFO_2_MODE, VOICE_LFO_MODE_GLOBAL);
	setParameter(SYNTH_PARAM_LFO_3_MODE, VOICE_LFO_MODE_GLOBAL);
	setParameter(SYNTH_PARAM_LFO_0_SYNC, VOICE_LFO_SYNC_FREE);
	setParameter(SYNTH_PARAM_LFO_1_SYNC, VOICE_LFO_SYNC_FREE);
	setParameter(SYNTH_PARAM_LFO_2_SYNC, VOICE_LFO_SYNC_FREE);
	setParameter(SYNTH_PARAM_LFO_3_SYNC, VOICE_LFO_SYNC_FREE);
	setParameter(SYNTH_PARAM_LFO_0_SYMMETRY, 0);
	setParameter(SYNTH_PARAM_LFO_1_SYMMETRY, 0);
	setParameter(SYNTH_PARAM_LFO_2_SYMMETRY, 0);
	setParameter(SYNTH_PARAM_LFO_3_SYMMETRY, 0);
	setParameter(SYNTH_PARAM_VCF_F_AMT_0, 0);
	setParameter(SYNTH_PARAM_VCF_F_AMT_1, 0);
	setParameter(SYNTH_PARAM_VCF_F_SRC_0, 0);
	setParameter(SYNTH_PARAM_VCF_F_SRC_1, 0);
	setParameter(SYNTH_PARAM_VCF_F_SRC_OP, 0);
	setParameter(SYNTH_PARAM_VCF_Q_AMT_0, 0);
	setParameter(SYNTH_PARAM_VCF_Q_AMT_1, 0);
	setParameter(SYNTH_PARAM_VCF_Q_SRC_0, 0);
	setParameter(SYNTH_PARAM_VCF_Q_SRC_1, 0);
	setParameter(SYNTH_PARAM_VCF_Q_SRC_OP, 0);
	setParameter(SYNTH_PARAM_VCA_AM_AMT_0, 0);
	setParameter(SYNTH_PARAM_VCA_AM_SRC_0, 0);
	setParameter(SYNTH_PARAM_VCA_PAN_AMT_0, 0);
	setParameter(SYNTH_PARAM_VCA_PAN_SRC_0, 0);

}

JaySynthSound::~JaySynthSound()
{
}

const JaySynthMidiCC* JaySynthSound::getMidiCC() const
{
	return &m_midiCC;
}

void JaySynthSound::setName(String ProgramName)
{
	name = ProgramName;
}

String JaySynthSound::getName(void) const
{
	return name;
}

void JaySynthSound::setParameter(int index, synth_float_t param)
{
	parameter[index] = param;
}

synth_float_t JaySynthSound::getParameter(int index) const
{
	return parameter[index];
}

