#include "config.h"
/* $Id: def_pars.c,v 1.13 1994/11/08 13:30:50 a904209 Exp a904209 $
 */
#include <stdio.h>
#include "useconfig.h"
#include <math.h>
#include "proto.h"
#include "getargs.h"
#include "nsynth.h"

static int32_t samp_rate = 8000;/* moved here from misc.c */

klatt_global_t klatt_global;

/* default values for pars array from .doc file */
klatt_frame_t def_pars =
{
#include "pars.define"
};

int init_synth(int argc, const char **argv)
{
	double mSec_per_frame = 10;
	int impulse = 0;
	int casc = 0;
	klatt_global.samrate = samp_rate;
	klatt_global.quiet_flag = TRUE;
	klatt_global.glsource = NATURAL;
	klatt_global.f0_flutter = 0;

	argc = getargs( "Synth paramters",argc, argv,
	                "q", NULL, &klatt_global.quiet_flag, "Quiet - minimal messages",
	                "I", NULL, &impulse,                 "Impulse glottal source",
	                "c", "%d", &casc,                    "Number cascade formants",
	                "F", "%d", &klatt_global.f0_flutter, "F0 flutter",
	                "f", "%lg", &mSec_per_frame,         "mSec per frame",
	                "t", "%d", &def_pars.TLTdb,          "Tilt dB",
	                "x", "%d", &def_pars.F0hz10,         "Base F0 in 0.1Hz",
	                NULL );

	if (casc > 0)
	{
		klatt_global.synthesis_model = CASCADE_PARALLEL;
		klatt_global.nfcascade = casc;
	}
	else
		klatt_global.synthesis_model = ALL_PARALLEL;

	if (impulse)
		klatt_global.glsource = IMPULSIVE;

	klatt_global.nspfr = (int32_t) (klatt_global.samrate * mSec_per_frame) / 1000;
#ifdef HAVE_NONSTDARITH
	/* turn off strict IEEE compliance in favour of speed */
	nonstandard_arithmetic();
#endif
	return argc;
}

