Exemplo n.º 1
0
// frame callback
void module_process_frame(void) {

  calc_frame();

  // we could shift to fract16 at a cost of only 1b resolution

  /*

  slew32_calc(cvSlew[cvChan]);

  if( !(slew32_sync(cvSlew[cvChan])) ) { 
    dac_update(cvChan, cvSlew[cvChan].y );
  }

  */


  // something really weird going on, reverting
  if(cvSlew[cvChan].sync) { ;; } else {
    cvVal[cvChan] = filter_1p_lo_next(&(cvSlew[cvChan]));
    dac_update(cvChan, cvVal[cvChan]);
  }
 
  if(++cvChan == 4) {
    cvChan = 0;
  }
  
  /* dac_update(cvChan, cvSlew[cvChan].x); */


     
  /* cvChan++; */
  /* if(cvChan == 4) { cvChan = 0; } */
  //  cvChan = (cvChan + 1) & 3;
}
Exemplo n.º 2
0
void
system_sound_update(int nframes)
{
    int i;
    int consumed;

    /* SDL_LockAudio(); */

    /* number of unread frames  */
    i = FRAME_DIFF(sound_frame_write, sound_frame_read);
    /* number of frames read since last call */
    consumed = FRAME_DIFF(sound_frame_read, sound_frame_read_old);
    sound_frame_read_old = sound_frame_read;

    /* SDL_UnlockAudio(); */

    for (; i<nframes; i++) {
	if (mute || paused)
	    memset(sound_buffer+sound_frame_write, silence_value, bpf);
	else {
	    dac_update(dac_data, dac_bpf);
	    /* convert to standard format */
	    acvt.buf = dac_data;
	    acvt.len = dac_bpf;
	    if (SDL_ConvertAudio(&acvt) == -1) {
		fprintf(stderr,
			"DAC data conversion failed: %s\n", SDL_GetError());
		return;
	    }
	    
	    /* get sound data */
	    sound_update((_u16 *)(sound_buffer+sound_frame_write), bpf);
	    
	    /* mix both streams into one */
	    SDL_MixAudio(sound_buffer+sound_frame_write,
			 dac_data, bpf, SDL_MIX_MAXVOLUME);
	}
	
	sound_frame_write = FRAME_INC(sound_frame_write);
	if (sound_frame_write == sound_frame_read) {
	    fprintf(stderr, "your machine is much too slow.\n");
	    /* XXX: handle this */
	    exit(1);
	}

	SDL_SemPost(rsem);
    }

    if (nframes > 1) {
	for (i=0; i<consumed; i++)
	    SDL_SemWait(wsem);
    }
    else
	SDL_SemWait(wsem);
}
Exemplo n.º 3
0
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;
  }
}
Exemplo n.º 4
0
// frame callback
void module_process_frame(void) {

  calc_frame();

  /* out[0] = add_fr1x32(frameVal, mult_fr1x32x32(in[0], ioAmp0)); */
  /* out[1] = add_fr1x32(frameVal, mult_fr1x32x32(in[1], ioAmp1)); */
  /* out[2] = add_fr1x32(frameVal, mult_fr1x32x32(in[2], ioAmp2)); */
  /* out[3] = add_fr1x32(frameVal, mult_fr1x32x32(in[3], ioAmp3)); */
  
  if(cvSlew[cvChan].sync) { ;; } else {
    cvVal[cvChan] = filter_1p_lo_next(&(cvSlew[cvChan]));
    dac_update(cvChan, cvVal[cvChan]);
  }
 
  if(++cvChan == 4) {
    cvChan = 0;
  }
  
}