Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jul 18th, 2012  |  syntax: None  |  size: 1.14 KB  |  hits: 8  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. ACRE_RESULT CFilterRadio::process(short* samples, int sampleCount, int channels) {
  2.         float buffer[4096], *floatPointer[1], random;
  3.         short *shortPointer[1];
  4.         int divisor;
  5.  
  6.         if(this->getValue() > 0.0f) {
  7.                 floatPointer[0] = buffer;
  8.                 shortPointer[0] = samples;     
  9.  
  10.                 Dsp::copy(1, sampleCount, floatPointer, shortPointer);
  11.                 Dsp::normalize(buffer, sampleCount);
  12.  
  13.                 // stuff here?!?
  14.  
  15.                 this->mLowPass.process(sampleCount, floatPointer);
  16.                 this->mHighPass.process(sampleCount, floatPointer);
  17.  
  18.                 for(int i = 0; i < sampleCount; i ++) {
  19.                         buffer[i] = buffer[i] * 1.7;
  20.                 }
  21.  
  22.                 this->mixNoise(buffer, sampleCount);
  23.  
  24.                 Dsp::denormalize(buffer, sampleCount);
  25.                 Dsp::copy(1, sampleCount, shortPointer, floatPointer);
  26.        
  27.                 // do something here?
  28.                 // 5 sounds perfect for good signal, 20 sounds shitty, 30 is basically cant hear it
  29.                 divisor = 13 - (this->getValue() * 10);
  30.                 if(divisor < 5)
  31.                         divisor = 5;
  32.                 for(int i = 0; i < sampleCount; i += divisor) {
  33.                         for(int x = 1; x < divisor; x++ ) {
  34.                                 samples[i+x] = samples[i];
  35.                         }
  36.                 }
  37.  
  38.                 this->reset();
  39.         } else {
  40.                 memset(samples, 0x00, (sampleCount*sizeof(short)));
  41.         }
  42.  
  43.         return ACRE_OK;
  44. }