コード例 #1
0
ファイル: DspLowpassFilter.cpp プロジェクト: rvega/ZenGarden
void DspLowpassFilter::processMessage(int inletIndex, PdMessage *message) {
  switch (inletIndex) {
    case 0: {
      switch (message->getType(0)) {
        case FLOAT: {
          processDspWithIndex(blockIndexOfLastMessage, graph->getBlockIndex(message));
          signalConstant = message->getFloat(0);
          break;
        }
        case SYMBOL: {
          if (message->isSymbol(0, "clear")) {
            processDspWithIndex(blockIndexOfLastMessage, graph->getBlockIndex(message));
            tap_0 = 0.0f;
          }
          break;
        }
        default: {
          break;
        }
      }
      break;
    }
    case 1: {
      if (message->isFloat(0)) {
        processDspWithIndex(blockIndexOfLastMessage, graph->getBlockIndex(message));
        calculateFilterCoefficients(message->getFloat(0));
      }
      break;
    }
    default: {
      break;
    }
  }
}
コード例 #2
0
DspHighpassFilter::DspHighpassFilter(PdMessage *initMessage, PdGraph *graph) : DspObject(2, 1, 0, 1, graph) {
  sampleRate = graph->getSampleRate();
  tapIn = 0.0f;
  tapOut = 0.0f;
  filterInputBuffer = (float *) calloc(blockSizeInt+2, sizeof(float));
  filterOutputBuffer = (float *) calloc(blockSizeInt+2, sizeof(float));
  coefficients = (float *) calloc(5, sizeof(float));
  // by default, the filter is initialised completely open
  calculateFilterCoefficients(initMessage->isFloat(0) ? initMessage->getFloat(0) : 0.0f);
}
コード例 #3
0
void DspHighpassFilter::processMessage(int inletIndex, PdMessage *message) {
  switch (inletIndex) {
    case 0: {
      if (message->isSymbol(0) && strcmp(message->getSymbol(0), "clear") == 0) {
        processDspToIndex(graph->getBlockIndex(message));
        tapIn = 0.0f;
        tapOut = 0.0f;
        memset(filterInputBuffer, 0, (blockSizeInt+2) * sizeof(float));
        memset(filterOutputBuffer, 0, (blockSizeInt+2) * sizeof(float));
      }
      break;
    }
    case 1: {
      if (message->isFloat(0)) {
        processDspToIndex(graph->getBlockIndex(message));
        calculateFilterCoefficients(message->getFloat(0));
      }
      break;
    }
    default: {
      break;
    }
  }
}
コード例 #4
0
ファイル: DspLowpassFilter.cpp プロジェクト: rvega/ZenGarden
DspLowpassFilter::DspLowpassFilter(PdMessage *initMessage, PdGraph *graph) : DspObject(2, 1, 0, 1, graph) {
  tap_0 = 0.0f;
  coefficients = (float *) calloc(5, sizeof(float));
  calculateFilterCoefficients(initMessage->isFloat(0) ? initMessage->getFloat(0) : graph->getSampleRate()/2.0f);
  signalConstant = 0.0f;
}
コード例 #5
0
ファイル: DspVCF.cpp プロジェクト: Kyew/ZenGarden
DspVCF::DspVCF(PdMessage *initMessage, PdGraph *graph) : DspObject(3, 3, 0, 2, graph) {
  sampleRate = graph->getSampleRate();
  calculateFilterCoefficients(this->sampleRate/2.0f, 1.0f); // initialise the filter completely open
  tap_0 = tap_1 = 0.0f;
}