Esempio n. 1
0
bool CEES_Node::MH_draw(const gsl_rng *r, int mMH)
{
	vector <bool> new_sample_flag(nBlock, false); 
	if (nBlock <= 1)
	{
		bool local_flag;
		target->draw(x_new, proposal[0], local_flag, r, x_current, mMH);
		new_sample_flag[0] = local_flag;
	}
	else 
		target->draw(x_new, proposal, new_sample_flag, r, x_current, nBlock, blockSize, mMH);
	bool overall_new_sample_flag = false;
	int iBlock = 0; 
	while (iBlock < nBlock && !overall_new_sample_flag)
	{ 
		if (new_sample_flag[iBlock])
			overall_new_sample_flag = true; 
		iBlock ++; 
	}
	if (overall_new_sample_flag)
	{
		x_current = x_new;  
		ring_index_current = GetRingIndex(x_current.GetWeight());
		UpdateMinMaxEnergy(x_current.GetWeight()); 
	}
	return overall_new_sample_flag; 
}
Esempio n. 2
0
void main(void) {
    double xin;
    double yout;
    Tremolo_init(4000,1);

    while(1) {
        if (new_sample_flag()) {
            /*When there's new sample at your ADC or CODEC input*/
            /*Read the sample*/
            xin = read_sample();
            /*Apply the Tremolo_process function to the sample*/
            yout = Tremolo_process(0.7*temp);

            /*Send the output value to your DAC or codec output*/
            write_output(yout);
            /*Makes LFO vary*/
            Tremolo_sweep();
        }                              
    }
}