예제 #1
0
파일: lines.c 프로젝트: Someone101/aleph
void module_process_frame(void) { 
  static fract32 tmpDel, tmpSvf;
  u8 i;

  tmpDel = 0;
  tmpSvf = 0;

  // mix inputs to delay lines
  mix_del_inputs();

  /// TEST

  for(i=0; i<NLINES; i++) {
    // process fade integrator
    //    lines[i].fadeWr = filter_ramp_tog_next(&(lpFadeWr[i]));
    lines[i].fadeRd = filter_ramp_tog_next(&(lpFadeRd[i]));

    // process delay line
    tmpDel = delayFadeN_next( &(lines[i]), in_del[i]);	    
    // process filters
    // check integrators for filter params
    if( !(svfCutSlew[i].sync) ) {
      filter_svf_set_coeff( &(svf[i]), filter_1p_lo_next(&(svfCutSlew[i])) );
    }
    if( !(svfRqSlew[i].sync) ) {
      filter_svf_set_rq( &(svf[i]), filter_1p_lo_next(&(svfRqSlew[i])) );
    }
    tmpSvf = filter_svf_next( &(svf[i]), tmpDel);  
    // mix
    tmpDel = mult_fr1x32x32( tmpDel, mix_fdry[i] );
    tmpDel = add_fr1x32(tmpDel, mult_fr1x32x32(tmpSvf, mix_fwet[i]) );

    out_del[i] = tmpDel;

  } // end lines loop 

  // mix outputs to DACs
  /// TEST
  /* out[0] = in[0]; */
  /* out[1] = in[1]; */
  /* out[2] = in[2]; */
  /* out[3] = in[3]; */
  out[0] = out[1] = out[2] = out[3] = 0x00000000;
  mix_outputs();

  /// do CV output
  if( cvSlew[cvChan].sync ) { ;; } else { 
    cvVal[cvChan] = filter_1p_lo_next(&(cvSlew[cvChan]));
    dac_update(cvChan, cvVal[cvChan]);
  }
 
  if(++cvChan == 4) {
    cvChan = 0;
  }
}
예제 #2
0
파일: waves.c 프로젝트: bensteinberg/aleph
// frame calculation
static void calc_frame(void) {
#if 1
  u8 i;
  wavesVoice* v;

  for(i=0; i<WAVES_NVOICES; i++) {
    v = &(voice[i]);
    // oscillator class includes hz and mod integrators
    v->oscOut = shr_fr1x32( osc_next( &(v->osc) ), 2);
    // phase mod with fixed 1-frame delay
    osc_pm_in( &(v->osc), v->pmIn );
    // shape mod with fixed 1-frame delay
    osc_wm_in( &(v->osc), v->wmIn );
    // process filter integrators and set 
    filter_svf_set_coeff( &(v->svf), filter_1p_lo_next( &(v->cutSlew) ) );
    filter_svf_set_rq( &(v->svf), filter_1p_lo_next( &(v->rqSlew) ) );
    // process filter
    v->svfOut = filter_svf_next( &(v->svf), shr_fr1x32(v->oscOut, 1) );
    // process amp smoother
    v->amp  = filter_1p_lo_next( &(v->ampSlew) );
    // mix to output bus
    v->out = mult_fr1x32x32(v->amp,
			    add_fr1x32(mult_fr1x32x32( v->oscOut, v->fDry),
				       mult_fr1x32x32( v->svfOut, v->fWet)
				       )
			    );
  } // end voice loop

  /// FIXME: later, more voices, mod matrix, arbitrary mod delay.
  /// for now, simple direct mod feedback routing and 1-frame delay.
  voice[0].pmIn = voice[1].oscOut;
  //  voice[0].wmIn = voice[1].oscOut << 1;
  voice[1].pmIn = voice[0].oscOut;
  //  voice[1].wmIn = voice[0].oscOut << 1;
  
  // mix outputs using matrix
    mix_outputs();
  
  

#else
  /* //  fract32 out1, out0; */
 
  /* // osc output */
  /* oscOut1 = shr_fr1x32(osc_next( &(osc1) ), 2); */
  /* oscOut0 = shr_fr1x32(osc_next( &(osc0) ), 2); */

  /* // phase mod feedback with 1frame delay */
  /* osc_pm_in( &osc1, oscOut0 ); */
  /* osc_pm_in( &osc0, oscOut1 ); */
  /* // shape mod feedback with 1frame delay */
  /* osc_wm_in( &osc1, oscOut0 ); */
  /* osc_wm_in( &osc0, oscOut1 ); */

  /* /////////// */
  /* /////////// */
  /* // apply filters */

  /* if( !(svfCutSlew[i].sync) ) { */
  /*   filter_svf_set_coeff( &(svf[i]), filter_1p_lo_next(&(svfCutSlew[i])) ); */
  /* } */
  /* if( !(svfRqSlew[i].sync) ) { */
  /*   filter_svf_set_rq( &(svf[i]), filter_1p_lo_next(&(svfRqSlew[i])) ); */
  /* } */

  /* //  svfOut1 = shl_fr1x32(filter_svf_next( &(svf1), shr_fr1x32(oscOut1, 1)), 1); */
  /* //  svfOut2 = shl_fr1x32(filter_svf_next( &(svf2), shr_fr1x32(oscOut2, 1)), 1); */
  /* svfOut1 = filter_svf_next( &(svf1), shr_fr1x32(oscOut1, 1)); */
  /* svfOut0 = filter_svf_next( &(svf0), shr_fr1x32(oscOut0, 1)); */

  /* ///////// */
  /* ///////// */

  /* // amp smoothers */
  /* oscAmp1 = filter_1p_lo_next(amp1Lp); */
  /* oscAmp0 = filter_1p_lo_next(amp0Lp); */

  /* // apply osc amplitudes and sum  */
  /* oscOut1 = mult_fr1x32x32(oscAmp1, */
  /* 			add_fr1x32(mult_fr1x32x32( oscOut1, fdry1), */
  /* 				   mult_fr1x32x32( svfOut1, fwet1) */
  /* 				   )); */
  
  /* oscOut0 = mult_fr1x32x32(oscAmp0, */
  /* 			add_fr1x32(mult_fr1x32x32( oscOut0, fdry0), */
  /* 				   mult_fr1x32x32( svfOut0, fwet0) */
  /* 				   )); */

  /* //// */
  /* /// fixme: mono */
  /* frameVal = add_fr1x32( oscOut0, oscOut1); */

  /* // mix to output */
  /* //...todo */
  #endif
}