projects/aaron/marco_tester.cpp
// The tick() function handles sample computation and scheduling of
// control updates.  It will be called automatically by RtAudio when
// the system needs a new buffer of audio samples.
The tick() function handles sample computation and scheduling of
control updates.  It will be called automatically by RtAudio when
the system needs a new buffer of audio samples.
The tick () function handles sample computation and scheduling of control updates . It will be called automatically by RtAudio when the system needs a new buffer of audio samples .
int tick( void *outputBuffer, void *inputBuffer, unsigned int nBufferFrames,
         double streamTime, RtAudioStreamStatus status, void *dataPointer )
{
  TickData *data = (TickData *) dataPointer;
  register StkFloat *oSamples = (StkFloat *) outputBuffer, *iSamples = (StkFloat *) inputBuffer;
  register StkFloat sample;
  int i, counter, nTicks = (int) nBufferFrames;
  while ( nTicks > 0 && !done ) {
    if ( !data->haveMessage ) {
      data->messager.popMessage( data->message );
      if ( data->message.type > 0 ) {
        data->counter = (long) (data->message.time * Stk::sampleRate());
        data->haveMessage = true;
      }
      else
        data->counter = DELTA_CONTROL_TICKS;
    }
    counter = min( nTicks, data->counter );
    data->counter -= counter;
    for ( i=0; i<counter; i++ ) {
      if (data->effectId==8) {    
		sample = data->filter.tick(*iSamples++);
		*oSamples++ = sample; 
        *oSamples++ = sample;
      }
      else if (data->effectId==9) {    
		sample = data->Matched_filter.tick(*iSamples++);
		*oSamples++ = sample; 
        *oSamples++ = sample;
      }
      else { 
        *oSamples++ = 0;
        *oSamples++ = 0;
      }
      nTicks--;
    }
    if ( nTicks == 0 ) break;
    if ( data->haveMessage ) processMessage( data );
  }
  return 0;
}
int tick ( void * outputBuffer , void * inputBuffer , unsigned int nBufferFrames , double streamTime , RtAudioStreamStatus status , void * dataPointer ) { TickData * data = ( TickData * ) dataPointer ; register StkFloat * oSamples = ( StkFloat * ) outputBuffer , * iSamples = ( StkFloat * ) inputBuffer ; register StkFloat sample ; int i , counter , nTicks = ( int ) nBufferFrames ; while ( nTicks > 0 && ! done ) { if ( ! data -> haveMessage ) { data -> messager . popMessage ( data -> message ) ; if ( data -> message . type > 0 ) { data -> counter = ( long ) ( data -> message . time * Stk :: sampleRate ( ) ) ; data -> haveMessage = true ; } else data -> counter = DELTA_CONTROL_TICKS ; } counter = min ( nTicks , data -> counter ) ; data -> counter -= counter ; for ( i = 0 ; i < counter ; i ++ ) { if ( data -> effectId == 8 ) { sample = data -> filter . tick ( * iSamples ++ ) ; * oSamples ++ = sample ; * oSamples ++ = sample ; } else if ( data -> effectId == 9 ) { sample = data -> Matched_filter . tick ( * iSamples ++ ) ; * oSamples ++ = sample ; * oSamples ++ = sample ; } else { * oSamples ++ = 0 ; * oSamples ++ = 0 ; } nTicks -- ; } if ( nTicks == 0 ) break ; if ( data -> haveMessage ) processMessage ( data ) ; } return 0 ; }
The tick() function handles sample computation and scheduling of
control updates.
The tick () function handles sample computation and scheduling of control updates .
// Effect *effect; // atr - filter // two channels interleaved // atr - matched filter // two channels interleaved // Process control messages.