sp->sample_type = SF_SAMPLETYPE_MONO; sp->sf_sample_link = -1; sp->sf_sample_index = 0; 
void load_module_samples (SAMPLE * s, int numsamples, int ntsc){    int i, j;    for(i = 1; numsamples--; i++, s++)    {	Sample *sp;	char name[23];	if(!s->data)	    continue;	ctl->cmsg(CMSG_INFO, VERB_DEBUG,		  "MOD Sample %d (%.22s)", i, s->samplename);	special_patch[i] =	    (SpecialPatch *)safe_malloc(sizeof(SpecialPatch));	special_patch[i]->type = INST_MOD;	special_patch[i]->samples = 1;	special_patch[i]->sample = sp =	    (Sample *)safe_malloc(sizeof(Sample));	memset(sp, 0, sizeof(Sample));	strncpy(name, s->samplename, 22);	name[22] = '\0';	code_convert(name, NULL, 23, NULL, "ASCII");	if(name[0] == '\0')	    special_patch[i]->name = NULL;	else	    special_patch[i]->name = safe_strdup(name);	special_patch[i]->sample_offset = 0;	sp->data = (sample_t *)s->data;	sp->data_alloced = 1;	sp->data_length = s->length;	sp->loop_start = s->loopstart;	sp->loop_end   = s->loopend;        /* The sample must be padded out by 1 extra sample, so that           the interpolation routines won't cause a "pop" by reading           random data beyond data_length */	sp->data = (sample_t *) realloc(sp->data,					(sp->data_length + 1) *					sizeof(sample_t));        sp->data[sp->data_length] = 0;	/* Stereo instruments (SF_STEREO) are dithered by libunimod into mono */	sp->modes = MODES_UNSIGNED;	if (s->flags & SF_SIGNED)  sp->modes ^= MODES_UNSIGNED;	if (s->flags & SF_LOOP)    sp->modes ^= MODES_LOOPING;	if (s->flags & SF_BIDI)    sp->modes ^= MODES_PINGPONG;	if (s->flags & SF_REVERSE) sp->modes ^= MODES_REVERSE;	if (s->flags & SF_16BITS)  sp->modes ^= MODES_16BIT;#ifdef USE_ENVELOPE	/* envelope (0,1:attack, 2:sustain, 3,4,5:release) */	sp->modes |= MODES_ENVELOPE;	/* attack */	sp->envelope_offset[0] = env_offset(255);	sp->envelope_rate[0]   = env_rate(255, 0.0);	/* fastest */	sp->envelope_offset[1] = sp->envelope_offset[0];	sp->envelope_rate[1]   = 0; /* skip this stage */	/* sustain */	sp->envelope_offset[2] = sp->envelope_offset[1];	sp->envelope_rate[2]   = 0;	/* release */	sp->envelope_offset[3] = env_offset(0);	sp->envelope_rate[3]   = env_rate(255, 80.0);	/* 80 msec */	sp->envelope_offset[4] = sp->envelope_offset[3];	sp->envelope_rate[4]   = 0; /* skip this stage */	sp->envelope_offset[5] = sp->envelope_offset[4];	sp->envelope_rate[5]   = 0; /* skip this stage, then the voice is				       disappeared */#endif 	sp->sample_rate = PAL_RATE >> s->divfactor;	sp->low_freq = 0;	sp->high_freq = 0x7fffffff;	sp->root_freq = freq_table[MOD_ROOT_NOTE];	sp->volume = 1.0;		/* I guess it should use globvol... */	sp->panning = s->panning == PAN_SURROUND ? 64 : s->panning * 128 / 255;	sp->note_to_use = 0;	sp->low_vel = 0;	sp->high_vel = 127;	sp->tremolo_sweep_increment =		sp->tremolo_phase_increment = sp->tremolo_depth =		sp->vibrato_sweep_increment = sp->vibrato_control_ratio = sp->vibrato_depth = 0;	sp->cutoff_freq = sp->resonance = sp->tremolo_to_pitch = 		sp->tremolo_to_fc = sp->modenv_to_pitch = sp->modenv_to_fc =		sp->vel_to_fc = sp->key_to_fc = sp->vel_to_resonance = 0;	sp->envelope_velf_bpo = sp->modenv_velf_bpo =		sp->vel_to_fc_threshold = 64;	sp->key_to_fc_bpo = 60;	sp->scale_tuning = 100;	memset(sp->envelope_velf, 0, sizeof(sp->envelope_velf));	memset(sp->envelope_keyf, 0, sizeof(sp->envelope_keyf));	memset(sp->modenv_velf, 0, sizeof(sp->modenv_velf));	memset(sp->modenv_keyf, 0, sizeof(sp->modenv_keyf));	memset(sp->modenv_rate, 0, sizeof(sp->modenv_rate));	memset(sp->modenv_offset, 0, sizeof(sp->modenv_offset));	sp->envelope_delay = sp->modenv_delay =		sp->tremolo_delay = sp->vibrato_delay = 0;	if (sp->data_length >= (1 << (31 - FRACTION_BITS)) - 1)	    shrink_huge_sample(sp);	else	{	    sp->data_length <<= FRACTION_BITS;	    sp->loop_start <<= FRACTION_BITS;	    sp->loop_end <<= FRACTION_BITS;	}	/* If necessary do some anti-aliasing filtering  */	if (antialiasing_allowed)	  antialiasing((int16 *)sp->data, sp->data_length / 2,		       sp->sample_rate, play_mode->rate);	s->data = NULL;		/* Avoid free-ing */	s->id = i;    }}
4357	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4357/cabf9cb41d3c9ca0cc0993e7d3ded1fc3a5c00c9/mod2midi.c/buggy/timidity/mod2midi.c