Пример #1
0
interrupt void c_int11()	 // interrupt service routine
{
 	input = input_left_sample(); //read new input sample
	for(i=0; i < taps; i++) {
		rpf = rp + i*size/taps;
		if(rpf > dsize) rpf -= disze;
		rpi = (int) rpf;
		frac = rpf - rpi;
		if(rpi != dsize-1) next = delay[rpi+1];
		else next = delay[0];
		// envelop index
		ep = rpi - wp;
		if(ep < 0) ep += dsize;
		s += (delay[rpi] + frac*(next - delay[rpi]))*env[ep];
	}
	// inc reader pointer and check bounds
	rp += p;
	rp = rp < dsize ? rp : rp - dsize;
	// feed the delay line
	delay[wp] = input + s*fdb;
	// output the signal
	output = (s/taps)*gain;
 	//output = input + delayed;    //output sum of new and delayed samples
  	//delay[i] = input;           //replace delayed sample with  
  	//if(++i >= BUF_SIZE) i=0;     //new input sample then increment
  	if(++wp >= dsize) wp = 0;
  	 
  	output_left_sample(output);  //buffer index
  	output_right_sample(output);
  	return;                      //return from ISR
}
Пример #2
0
void c_int11()         //ISR - AD535 codec interrupts at 8kHz
{  
  x[0] = (float)(input_left_sample()); //get new input into delay line
  output_left_sample((short)(yn));     //output to codec
  SWI_post(&SWI_fir_isr);
  return;
}
Пример #3
0
void c_int11(void)
{
	input[bufferindex] = (fixedp)input_left_sample();	
	output_left_sample((short)output[bufferindex]);
	if(++bufferindex >= N) {
		bufferindex = 0;
		bufferflag = 1;
		SWI_post(&SWI_process_isr);
	}
	return;
}
Пример #4
0
interrupt void c_int11(void)      //ISR
{
  output_left_sample((short)((output_ptr + buffercount)->real));
  outbuffer[buffercount] = -(short)((output_ptr + buffercount)->real);
  (input_ptr + buffercount)->real = (float)(input_left_sample());
  (input_ptr + buffercount++)->imag = 0.0;
  if (buffercount >= N)       //for overlap-add method iobuffer
  {                             // is half size of FFT used
    buffercount = 0;
    bufferfull = 1;
  }
}
Пример #5
0
interrupt void c_int11()	    //ISR
{
  short i;
 
  yn = 0;                     //initialize filter's output

#if METHOD == 'A' 	          
  dly[0] = input_left_sample();    
  for (i = 0; i< N; i++) yn += (h[i] * dly[i]);
  for (i = N-1; i > 0; i--) dly[i] = dly[i-1];
#elif METHOD == 'B'               
  *dly_ptr = input_left_sample(); 
  if (++dly_ptr > end_ptr) dly_ptr = start_ptr;
  for (i = 0; i < N ; i++)  
  {
    dly_ptr++;
    if (dly_ptr > end_ptr) dly_ptr = start_ptr;
    yn += *(h_ptr + i)* *dly_ptr;
  }  
#endif
  output_left_sample((short)(yn>>15));      //output filter
  return;				    //return from ISR
}
Пример #6
0
void c_int11()    //interrupt service routine
{
    int gain = (int)(*(unsigned volatile int *)GAINADRESS);

    in = (fixedp)input_left_sample();
    in = BiQuad_do(lpf, in);

    chin = qfpart(in);
    output_left_sample(chin);

    /*if(HPI_FLAG) {
    	//output_left_sample(f * 16000.0); //gain*sine_table[loopindex]);	// output look up table value
    }
    else {
    	//output_left_sample(sine_table[loopindex]);
    }*/
    if (++loopindex >= LOOPLENGTH) loopindex = 0; // check for end of look up table
    return;					//return from interrupt
}
Пример #7
0
interrupt void c_int11()	 //interrupt service routine
{
  int section;   // index for section number
  float input;   // input to each section
  float wn,yn;   // intermediate and output values in each stage

  input = ((float)input_left_sample());
  
  for (section=0 ; section< NUM_SECTIONS ; section++)
  {
    wn = input - a[section][0]*w[section][0] - a[section][1]*w[section][1];
    yn = b[section][0]*wn + b[section][1]*w[section][0] + b[section][2]*w[section][1];
    w[section][1] = w[section][0];
    w[section][0] = wn;
    input = yn;              // output of current section will be input to next
  }

  output_left_sample((short)(yn)); // before writing to codec

  return;                       //return from ISR
}
Пример #8
0
interrupt void c_int11()               //interrupt service routine
{                         
 int i;
 float adaptfir_out = 0.0;             //initialise adaptive filter output
 float fir_out = 0.0;
 float E;                              //error=difference of fixed/adapt out

 fir_out = (float)(input_left_sample());    //read output from external system
 dly_adapt[0]=prand();          	   //pseudo-random noise sample used as 
 output_left_sample((short)(dly_adapt[0])); //input to adaptive filter and output
                                       //to external system
 for (i = 0; i < WLENGTH; i++)
   adaptfir_out +=(w[i]*dly_adapt[i]); //compute adaptive filter output 
 
 E = fir_out - adaptfir_out;           //error signal           
 
 for (i = WLENGTH-1; i >= 0; i--)         
  {
   w[i] = w[i]+(beta*E*dly_adapt[i]);  //update weights of adaptive FIR  
   dly_adapt[i+1] = dly_adapt[i];      //update samples of adaptive FIR   
  } 
 return;
}
Пример #9
0
interrupt void c_int11() {  // Interrupt Service Routine
     if (index < N) {
         output_sample((int)io_buffer[index]);
        io_buffer[index++]=(float)input_left_sample();
    }
}