Exemplo n.º 1
0
  void HelmVoiceHandler::init() {
    // Create modulation and pitch wheels.
    mod_wheel_amount_ = new SmoothValue(0);
    pitch_wheel_amount_ = new SmoothValue(0);

    mod_sources_["pitch_wheel"] = pitch_wheel_amount_->output();
    mod_sources_["mod_wheel"] = mod_wheel_amount_->output();

    // Create all synthesizer voice components.
    createArticulation(note(), velocity(), voice_event());
    createOscillators(current_frequency_->output(),
                      amplitude_envelope_->output(Envelope::kFinished));
    createModulators(amplitude_envelope_->output(Envelope::kFinished));
    createFilter(osc_feedback_->output(0), note_from_center_->output(),
                 amplitude_envelope_->output(Envelope::kFinished), voice_event());

    Value* aftertouch_value = new Value();
    aftertouch_value->plug(aftertouch());

    addProcessor(aftertouch_value);
    mod_sources_["aftertouch"] = aftertouch_value->output();

    output_->plug(formant_container_, 0);
    output_->plug(amplitude_, 1);

    addProcessor(output_);
    addGlobalProcessor(pitch_wheel_amount_);
    addGlobalProcessor(mod_wheel_amount_);

    setVoiceKiller(amplitude_envelope_->output(Envelope::kValue));
    
    HelmModule::init();
  }
    StreamingMhdDemo::StreamingMhdDemo(DataContainer* dc)
        : AutoEvaluationPipeline(dc)
        , _imageReader()
        , _ve(&_canvasSize)
    {
        addProcessor(&_imageReader);
        addProcessor(&_ve);

        addEventListenerToBack(&_ve);
    }
    VolumeExplorerDemo::VolumeExplorerDemo(DataContainer& dc)
        : AutoEvaluationPipeline(dc, getId())
        , _lsp()
        , _imageReader()
        , _ve(&_canvasSize)
    {
        addProcessor(&_lsp);
        addProcessor(&_imageReader);
        addProcessor(&_ve);

        addEventListenerToBack(&_ve);
    }
Exemplo n.º 4
0
BccModule::BccModule()
    : VoreenModule()
{
    setName("BCC");
    setXMLFileName("bcc/bccmodule.xml");

    addProcessor(new BccVolumeRaycaster());
	addProcessor(new FccVolumeRaycaster());
	addProcessor(new UnbiasedVolumeRaycaster());
	addProcessor(new VolumeInterleave());	

	addShaderPath(getModulesPath("bcc/glsl"));
}
    ItkRegistrationDemo::ItkRegistrationDemo(DataContainer& dc)
        : AutoEvaluationPipeline(dc, getId())
        , _lsp()
        , _imageReader()
        , _ve(&_canvasSize)
        , _itkRegistration()
    {
        addProcessor(&_lsp);
        addProcessor(&_imageReader);
        addProcessor(&_ve);
        addProcessor(&_itkRegistration);

        addEventListenerToBack(&_ve);
    }
Exemplo n.º 6
0
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
void Application::addProcessor(const DataModel::WaveformStreamID &wfid,
			       WaveformProcessor *proc) {
	addProcessor(wfid.networkCode(),
		     wfid.stationCode(),
		     wfid.locationCode(),
		     wfid.channelCode(),
		     proc);
}
ImageVis::ImageVis(DataContainer& dc)
    : AutoEvaluationPipeline(dc, getId())
    , _ve(&_canvasSize, new SliceExtractor(nullptr), new ContextPreservingRaycaster(nullptr))
{
    addProcessor(&_ve);

    addEventListenerToBack(&_ve);
}
Exemplo n.º 8
0
OpenCLModule::OpenCLModule()
    : VoreenModule()
    , opencl_(0)
    , context_(0)
    , queue_(0)
    , device_(0)
    , glSharing_(true)
{
    setName("OpenCL");
    setXMLFileName("opencl/openclmodule.xml");
    instance_ = this;

    addProcessor(new DynamicCLProcessor());
    addProcessor(new GrayscaleCL());
    addProcessor(new RaycasterCL());
    addProcessor(new RaytracingEntryExitPoints());
    addProcessor(new VolumeGradientCL());
}
Exemplo n.º 9
0
std::shared_ptr<core::Processor> ExecutionPlan::addProcessor(const std::string &processor_name, const std::string &name, core::Relationship relationship, bool linkToPrevious) {
  if (finalized) {
    return nullptr;
  }
  auto processor = ExecutionPlan::createProcessor(processor_name, name);
  if (!processor) {
    return nullptr;
  }
  return addProcessor(processor, name, relationship, linkToPrevious);
}
Exemplo n.º 10
0
  void HelmVoiceHandler::createModulators(Output* reset) {
    // Poly LFO.
    Processor* lfo_waveform = createPolyModControl("poly_lfo_waveform", true);
    Processor* lfo_free_frequency = createPolyModControl("poly_lfo_frequency", true, false);
    Processor* lfo_free_amplitude = createPolyModControl("poly_lfo_amplitude", true);
    Processor* lfo_frequency = createTempoSyncSwitch("poly_lfo", lfo_free_frequency,
                                                     beats_per_second_, true);
    HelmLfo* lfo = new HelmLfo();
    lfo->plug(reset, HelmLfo::kReset);
    lfo->plug(lfo_waveform, HelmLfo::kWaveform);
    lfo->plug(lfo_frequency, HelmLfo::kFrequency);

    Multiply* scaled_lfo = new Multiply();
    scaled_lfo->setControlRate();
    scaled_lfo->plug(lfo, 0);
    scaled_lfo->plug(lfo_free_amplitude, 1);

    addProcessor(lfo);
    addProcessor(scaled_lfo);
    mod_sources_["poly_lfo"] = scaled_lfo->output();
  }
Exemplo n.º 11
0
  FormantManager::FormantManager(int num_formants) : ProcessorRouter(0, 0) {
    Bypass* audio_input = new Bypass();
    Bypass* reset_input = new Bypass();

    registerInput(audio_input->input(), kAudio);
    registerInput(reset_input->input(), kReset);

    addProcessor(audio_input);
    addProcessor(reset_input);

    Processor* audio_flow = audio_input;
    for (int i = 0; i < num_formants; ++i) {
      Filter* formant = new Filter();
      formant->plug(audio_flow, Filter::kAudio);
      formant->plug(reset_input, Filter::kReset);
      formants_.push_back(formant);
      addProcessor(formant);
      audio_flow = formant;
    }

    registerOutput(audio_flow->output());
  }
Exemplo n.º 12
0
void ProcessChain::addProcessorAt(AbstractImageProcessor *processor, int index)
{
  if (index >= 0 && index < processorList.size())
  {
    int remainCount = 0;
    // Find the first thing to delete
    QList<AbstractImageProcessor *>::Iterator itr1 = processorList.begin();
    QList<MyImage *>::Iterator itr2 = imageList.begin();
    for (;remainCount < index;++remainCount, ++itr1, ++itr2);
    // Delete the things
    while (itr1 != processorList.end())
    {
      if (*itr1 != NULL)
        recycledProcessorList.append(*itr1);
      delete *itr2;
      itr1 = processorList.erase(itr1);
      itr2 = imageList.erase(itr2);
    }
    addProcessor(processor);
  }
  else
    addProcessor(processor);
}
Exemplo n.º 13
0
std::shared_ptr<core::Processor> ExecutionPlan::addCallback(void *obj,
    std::function<void(core::ProcessSession*, core::ProcessContext *)> ontrigger_callback,
    std::function<void(core::ProcessContext *)> onschedule_callback) {

  if (finalized) {
    return nullptr;
  }

  auto proc = createCallback(obj, ontrigger_callback, onschedule_callback);

  if (!proc)
    return nullptr;

  return addProcessor(proc, CallbackProcessorName, core::Relationship("success", "description"), true);
}
Exemplo n.º 14
0
  FormantManager::FormantManager(int num_formants) : ProcessorRouter(0, 0) {
    Bypass* audio_input = new Bypass();
    cr::Bypass* reset_input = new cr::Bypass();

    registerInput(audio_input->input(), kAudio);
    registerInput(reset_input->input(), kReset);

    addProcessor(audio_input);
    addProcessor(reset_input);

    VariableAdd* total = new VariableAdd(num_formants);
    for (int i = 0; i < num_formants; ++i) {
      BiquadFilter* formant = new BiquadFilter();
      formant->plug(audio_input, BiquadFilter::kAudio);
      formant->plug(reset_input, BiquadFilter::kReset);
      formants_.push_back(formant);

      addProcessor(formant);
      total->plugNext(formant);
    }

    addProcessor(total);
    registerOutput(total->output());
  }
    GeometryRendererDemo::GeometryRendererDemo(DataContainer& dc)
        : AutoEvaluationPipeline(dc, getId())
        , _tcp(&_canvasSize)
        , _lsp()
        , _geometryReader()
        , _lvRenderer(&_canvasSize)
        , _teapotRenderer(&_canvasSize)
        , _cubeRenderer(&_canvasSize)
        , _compositor1(&_canvasSize)
        , _compositor2(&_canvasSize)
    {
        addEventListenerToBack(&_tcp);

        addProcessor(&_tcp);
        addProcessor(&_lsp);
        addProcessor(&_geometryReader);
        addProcessor(&_teapotRenderer);
        addProcessor(&_lvRenderer);
        addProcessor(&_cubeRenderer);
        addProcessor(&_compositor1);
        addProcessor(&_compositor2);
    }
    TensorDemo::TensorDemo(DataContainer& dc)
        : AutoEvaluationPipeline(dc, getId())
        , _tcp(&_canvasSize)
        , _lsp()
        , _imageReader()
        , _ta()
        , _glyphRenderer(&_canvasSize)
        , _sliceRenderer(&_canvasSize)
        , _rtc(&_canvasSize)
        , p_sliceNumber("SliceNuber", "Slice Number", 0, 0, 256)

    {
        addProperty(p_sliceNumber);

        addEventListenerToBack(&_tcp);

        addProcessor(&_tcp);
        addProcessor(&_lsp);
        addProcessor(&_imageReader);
        addProcessor(&_ta);
        addProcessor(&_glyphRenderer);
        addProcessor(&_sliceRenderer);
        addProcessor(&_rtc);
    }
Exemplo n.º 17
0
  void HelmVoiceHandler::createOscillators(Output* midi, Output* reset) {
    // Pitch bend.
    Processor* pitch_bend_range = createPolyModControl("pitch_bend_range", false);
    Multiply* pitch_bend = new Multiply();
    pitch_bend->setControlRate();
    pitch_bend->plug(pitch_wheel_amount_, 0);
    pitch_bend->plug(pitch_bend_range, 1);
    Add* bent_midi = new Add();
    bent_midi->plug(midi, 0);
    bent_midi->plug(pitch_bend, 1);

    addProcessor(pitch_bend);
    addProcessor(bent_midi);

    // Oscillator 1.
    HelmOscillators* oscillators = new HelmOscillators();
    Processor* oscillator1_waveform = createPolyModControl("osc_1_waveform", true);
    Processor* oscillator1_transpose = createPolyModControl("osc_1_transpose", false);
    Processor* oscillator1_tune = createPolyModControl("osc_1_tune", false);
    Processor* oscillator1_unison_voices = createPolyModControl("osc_1_unison_voices", true);
    Processor* oscillator1_unison_detune = createPolyModControl("osc_1_unison_detune", true);
    Processor* oscillator1_unison_harmonize = createBaseControl("unison_1_harmonize");

    Add* oscillator1_transposed = new Add();
    oscillator1_transposed->plug(bent_midi, 0);
    oscillator1_transposed->plug(oscillator1_transpose, 1);
    Add* oscillator1_midi = new Add();
    oscillator1_midi->plug(oscillator1_transposed, 0);
    oscillator1_midi->plug(oscillator1_tune, 1);

    MidiScale* oscillator1_frequency = new MidiScale();
    oscillator1_frequency->plug(oscillator1_midi);
    FrequencyToPhase* oscillator1_phase_inc = new FrequencyToPhase();
    oscillator1_phase_inc->plug(oscillator1_frequency);

    oscillators->plug(oscillator1_waveform, HelmOscillators::kOscillator1Waveform);
    oscillators->plug(reset, HelmOscillators::kReset);
    oscillators->plug(oscillator1_phase_inc, HelmOscillators::kOscillator1PhaseInc);
    oscillators->plug(oscillator1_unison_detune, HelmOscillators::kUnisonDetune1);
    oscillators->plug(oscillator1_unison_voices, HelmOscillators::kUnisonVoices1);
    oscillators->plug(oscillator1_unison_harmonize, HelmOscillators::kHarmonize1);

    Processor* cross_mod = createPolyModControl("cross_modulation", false, true);
    oscillators->plug(cross_mod, HelmOscillators::kCrossMod);

    addProcessor(oscillator1_transposed);
    addProcessor(oscillator1_midi);
    addProcessor(oscillator1_frequency);
    addProcessor(oscillator1_phase_inc);
    addProcessor(oscillators);

    // Oscillator 2.
    Processor* oscillator2_waveform = createPolyModControl("osc_2_waveform", true);
    Processor* oscillator2_transpose = createPolyModControl("osc_2_transpose", false);
    Processor* oscillator2_tune = createPolyModControl("osc_2_tune", false);
    Processor* oscillator2_unison_voices = createPolyModControl("osc_2_unison_voices", true);
    Processor* oscillator2_unison_detune = createPolyModControl("osc_2_unison_detune", true);
    Processor* oscillator2_unison_harmonize = createBaseControl("unison_2_harmonize");

    Add* oscillator2_transposed = new Add();
    oscillator2_transposed->plug(bent_midi, 0);
    oscillator2_transposed->plug(oscillator2_transpose, 1);
    Add* oscillator2_midi = new Add();
    oscillator2_midi->plug(oscillator2_transposed, 0);
    oscillator2_midi->plug(oscillator2_tune, 1);

    MidiScale* oscillator2_frequency = new MidiScale();
    oscillator2_frequency->plug(oscillator2_midi);
    FrequencyToPhase* oscillator2_phase_inc = new FrequencyToPhase();
    oscillator2_phase_inc->plug(oscillator2_frequency);

    oscillators->plug(oscillator2_waveform, HelmOscillators::kOscillator2Waveform);
    oscillators->plug(oscillator2_phase_inc, HelmOscillators::kOscillator2PhaseInc);
    oscillators->plug(oscillator2_unison_detune, HelmOscillators::kUnisonDetune2);
    oscillators->plug(oscillator2_unison_voices, HelmOscillators::kUnisonVoices2);
    oscillators->plug(oscillator2_unison_harmonize, HelmOscillators::kHarmonize2);

    addProcessor(oscillator2_transposed);
    addProcessor(oscillator2_midi);
    addProcessor(oscillator2_frequency);
    addProcessor(oscillator2_phase_inc);

    // Oscillator mix.
    Processor* oscillator_mix_amount = createPolyModControl("osc_mix", false, true);
    Clamp* clamp_mix = new Clamp(0, 1);
    clamp_mix->plug(oscillator_mix_amount);
    oscillators->plug(clamp_mix, HelmOscillators::kMix);
    addProcessor(clamp_mix);

    // Sub Oscillator.
    Add* sub_midi = new Add();
    Value* sub_transpose = new Value(-2 * NOTES_PER_OCTAVE);
    sub_midi->plug(bent_midi, 0);
    sub_midi->plug(sub_transpose, 1);

    MidiScale* sub_frequency = new MidiScale();
    sub_frequency->plug(sub_midi);
    FrequencyToPhase* sub_phase_inc = new FrequencyToPhase();
    sub_phase_inc->plug(sub_frequency);

    Processor* sub_waveform = createPolyModControl("sub_waveform", true);
    Processor* sub_shuffle = createPolyModControl("sub_shuffle", false, true);
    FixedPointOscillator* sub_oscillator = new FixedPointOscillator();
    sub_oscillator->plug(sub_phase_inc, FixedPointOscillator::kPhaseInc);
    sub_oscillator->plug(sub_shuffle, FixedPointOscillator::kShuffle);
    sub_oscillator->plug(sub_waveform, FixedPointOscillator::kWaveform);
    sub_oscillator->plug(reset, FixedPointOscillator::kReset);

    Processor* sub_volume = createPolyModControl("sub_volume", false, true);
    Multiply* scaled_sub_oscillator = new Multiply();
    scaled_sub_oscillator->plug(sub_oscillator, 0);
    scaled_sub_oscillator->plug(sub_volume, 1);

    addProcessor(sub_midi);
    addProcessor(sub_frequency);
    addProcessor(sub_phase_inc);
    addProcessor(sub_oscillator);
    addProcessor(scaled_sub_oscillator);

    Add *oscillator_sum = new Add();
    oscillator_sum->plug(oscillators, 0);
    oscillator_sum->plug(scaled_sub_oscillator, 1);

    addProcessor(oscillator_sum);

    // Noise Oscillator.
    NoiseOscillator* noise_oscillator = new NoiseOscillator();

    Processor* noise_volume = createPolyModControl("noise_volume", false);
    Multiply* scaled_noise_oscillator = new Multiply();
    scaled_noise_oscillator->plug(noise_oscillator, 0);
    scaled_noise_oscillator->plug(noise_volume, 1);

    addProcessor(noise_oscillator);
    addProcessor(scaled_noise_oscillator);

    Add *oscillator_noise_sum = new Add();
    oscillator_noise_sum->plug(oscillator_sum, 0);
    oscillator_noise_sum->plug(scaled_noise_oscillator, 1);

    addProcessor(oscillator_noise_sum);

    // Oscillator feedback.
    Processor* osc_feedback_transpose = createPolyModControl("osc_feedback_transpose", false, true);
    Processor* osc_feedback_amount = createPolyModControl("osc_feedback_amount", false);
    Processor* osc_feedback_tune = createPolyModControl("osc_feedback_tune", true);
    Add* osc_feedback_transposed = new Add();
    osc_feedback_transposed->setControlRate();
    osc_feedback_transposed->plug(bent_midi, 0);
    osc_feedback_transposed->plug(osc_feedback_transpose, 1);
    Add* osc_feedback_midi = new Add();
    osc_feedback_midi->setControlRate();
    osc_feedback_midi->plug(osc_feedback_transposed, 0);
    osc_feedback_midi->plug(osc_feedback_tune, 1);

    MidiScale* osc_feedback_frequency = new MidiScale();
    osc_feedback_frequency->setControlRate();
    osc_feedback_frequency->plug(osc_feedback_midi);

    FrequencyToSamples* osc_feedback_samples = new FrequencyToSamples();
    osc_feedback_samples->plug(osc_feedback_frequency);

    SampleAndHoldBuffer* osc_feedback_samples_audio = new SampleAndHoldBuffer();
    osc_feedback_samples_audio->plug(osc_feedback_samples);

    addProcessor(osc_feedback_transposed);
    addProcessor(osc_feedback_midi);
    addProcessor(osc_feedback_frequency);
    addProcessor(osc_feedback_samples);
    addProcessor(osc_feedback_samples_audio);

    Clamp* osc_feedback_amount_clamped = new Clamp();
    osc_feedback_amount_clamped->plug(osc_feedback_amount);

    osc_feedback_ = new SimpleDelay(MAX_FEEDBACK_SAMPLES);
    osc_feedback_->plug(oscillator_noise_sum, SimpleDelay::kAudio);
    osc_feedback_->plug(osc_feedback_samples_audio, SimpleDelay::kSampleDelay);
    osc_feedback_->plug(osc_feedback_amount_clamped, SimpleDelay::kFeedback);
    addProcessor(osc_feedback_);
    addProcessor(osc_feedback_amount_clamped);
  }
Exemplo n.º 18
0
ConfigurationDefault::ConfigurationDefault(const Options& iOptions, const Data& iData) : Configuration(iOptions, iData),
      mNumOffsetsSpreadObs(0) {

   // Selector
   {
      std::string tag;
      //! Which scheme should be used to select the ensemble?
      iOptions.getRequiredValue("selector", tag);
      mSelector = Selector::getScheme(tag, mData);
      addProcessor(mSelector);
   }
   // Correctors
   {
      std::vector<std::string> tags;
      //! Which correction schemes should be used?
      iOptions.getValues("correctors", tags);
      for(int i = 0; i < (int) tags.size(); i++) {
         const Corrector* corrector = Corrector::getScheme(tags[i], mData);
         mCorrectors.push_back(corrector);
         addProcessor(corrector);
      }
   }
   // Averager
   {
      std::string tag;
      //! Which scheme should be used to collapse distribution to deterministic forecast?
      //! Default to distribution mean
      if(iOptions.getValue("averager", tag)) {
         mAverager = Averager::getScheme(tag, mData);
      }
      else {
         // Default to enseble median
         mAverager = new AveragerQuantile(Options("quantile=0.5"), mData);
      }
      addProcessor(mAverager);
   }
   // Updaters
   {
      std::vector<std::string> tags;
      //! Which scheme should be used to update the probability distribution using recent
      //! observations?
      iOptions.getValues("updaters", tags);
      for(int i = 0; i < (int) tags.size(); i++) {
         Updater* updater = Updater::getScheme(tags[i], mData);
         mUpdaters.push_back(updater);
         addProcessor(updater);
      }
   }
   // Smoother
   {
      std::vector<std::string> tags;
      //! Which scheme should be used to smooth the timeseries at the end?
      iOptions.getValues("smoothers", tags);
      for(int i = 0; i < (int) tags.size(); i++) {
         Smoother* smoother = Smoother::getScheme(tags[i], mData);
         mSmoothers.push_back(smoother);
         addProcessor(smoother);
      }
   }
   // Set up uncertainty object. In the future different ways of combining continuous and discretes
   // can be supported, but for now use UncertaintyCombine.
   {
      std::stringstream ss;
      ss << "tag=unc class=UncertaintyCombine ";
      std::string tag;
      bool continuous = false;
      bool lower      = false;
      bool upper      = false;
      bool discrete   = false;

      //! Which scheme should be used to create the continuous part of the distribution?
      if(iOptions.getValue("continuous", tag)) {
         ss << "continuous=" << tag << " ";
         continuous = true;
      }
      //! Which scheme should be used to create discrete probability at the lower boundary?
      //! Can be used together with 'continuous' and discreteUpper
      if(iOptions.getValue("discreteLower", tag)) {
         ss << "discreteLower=" << tag << " ";
         lower = true;
      }
      //! Which scheme should be used to create discrete probability at the upper boundary?
      //! Can be used together with 'continuous' and discreteLower
      if(iOptions.getValue("discreteUpper", tag)) {
         ss << "discreteUpper=" << tag << " ";
         upper = true;
      }
      //! Which scheme should be used to create discrete probability?
      //! Only valid for pure discrete variables, and cannot be used together with 'continuous'
      if(iOptions.getValue("discrete", tag)) {
         ss << "discrete=" << tag << " ";
         discrete = true;
      }

      if(!continuous && !lower && !upper && !discrete) {
         std::stringstream ss;
         ss << "Configuration " << mName << " has no continuous or discrete models specified";
         Global::logger->write(ss.str(), Logger::error);
      }
      if(!continuous && (lower || upper)) {
         std::stringstream ss;
         ss << "Configuration " << mName << " has lower/upperDiscrete defined but no continuous ";
         ss << "model defined. Either provide a) 'continuous' and ('lowerDiscrete' and/or ";
         ss << "'upperDiscrete') or b) 'discrete'.";
      }
      if(continuous && discrete) {
         std::stringstream ss;
         ss << "Configuration " << mName << " has 'continuous' and 'discrete' specified'. ";
         ss << "Use 'lowerDiscrete' and/or 'upperDiscrete' instead of 'discrete'";
         Global::logger->write(ss.str(), Logger::error);
      }

      Options opt = ss.str();
      mUncertainty = new UncertaintyCombine(opt, mData);
      addProcessor(mUncertainty);
   }

   // Calibrator
   {
      std::vector<std::string> tags;
      //! Which scheme should be used to calibrate the distributions?
      iOptions.getValues("calibrators", tags);
      for(int i = 0; i < (int) tags.size(); i++) {
         const Calibrator* calibrator = Calibrator::getScheme(tags[i], mData);
         mCalibrators.push_back(calibrator);
         addProcessor(calibrator);
      }
   }

   addExtraComponent(mData.getDownscaler());

   //! Across how many offsets should observations be allowed to be spread?
   //! For some stations, the obs occur less frequent than the output offsets. In these cases
   //! Parameters are usually never updated. Allow obs to be taken from neighbouring offsets.
   iOptions.getValue("numOffsetsSpreadObs", mNumOffsetsSpreadObs);

   init();
}
Exemplo n.º 19
0
PlottingModule::PlottingModule()
    : VoreenModule()
{
    setName("Plotting");
    setXMLFileName("plotting/plottingmodule.xml");

    addProcessor(new PlotDataSource());
    addProcessor(new PlotFunctionSource());
    addProcessor(new BarPlot());
    addProcessor(new HemispherePlot());
    addProcessor(new ImageAnalyzer());
    addProcessor(new LinePlot());
    addProcessor(new PlotDataExport());
    addProcessor(new PlotDataExportText());
    addProcessor(new PlotDataFitFunction());
    addProcessor(new PlotDataGroup());
    addProcessor(new PlotDataMerge());
    addProcessor(new PlotDataSelect());
    addProcessor(new PlotFunctionDiscret());
    addProcessor(new ScatterPlot());
    addProcessor(new SurfacePlot());

    addSerializerFactory(new AggregationFunctionFactory());
    addSerializerFactory(PlotPredicateFactory::getInstance());
}
Exemplo n.º 20
0
  void HelmVoiceHandler::createFilter(
      Output* audio, Output* keytrack, Output* reset, Output* note_event) {
    // Filter envelope.
    Processor* filter_attack = createPolyModControl("fil_attack", false, false);
    Processor* filter_decay = createPolyModControl("fil_decay", true, false);
    Processor* filter_sustain = createPolyModControl("fil_sustain", false);
    Processor* filter_release = createPolyModControl("fil_release", true, false);

    TriggerFilter* note_off = new TriggerFilter(kVoiceOff);
    note_off->plug(note_event);
    TriggerCombiner* filter_env_trigger = new TriggerCombiner();
    filter_env_trigger->plug(note_off, 0);
    filter_env_trigger->plug(reset, 1);

    filter_envelope_ = new Envelope();
    filter_envelope_->plug(filter_attack, Envelope::kAttack);
    filter_envelope_->plug(filter_decay, Envelope::kDecay);
    filter_envelope_->plug(filter_sustain, Envelope::kSustain);
    filter_envelope_->plug(filter_release, Envelope::kRelease);
    filter_envelope_->plug(filter_env_trigger, Envelope::kTrigger);

    Processor* filter_envelope_depth = createPolyModControl("fil_env_depth", false);
    Multiply* scaled_envelope = new Multiply();
    scaled_envelope->setControlRate();
    scaled_envelope->plug(filter_envelope_, 0);
    scaled_envelope->plug(filter_envelope_depth, 1);

    addProcessor(filter_envelope_);
    addProcessor(note_off);
    addProcessor(filter_env_trigger);
    addProcessor(scaled_envelope);

    // Filter.
    Processor* filter_type = createBaseControl("filter_type");
    Processor* keytrack_amount = createPolyModControl("keytrack", false);
    Multiply* current_keytrack = new Multiply();
    current_keytrack->setControlRate();
    current_keytrack->plug(keytrack, 0);
    current_keytrack->plug(keytrack_amount, 1);

    Processor* base_cutoff = createPolyModControl("cutoff", true, true);
    Add* keytracked_cutoff = new Add();
    keytracked_cutoff->setControlRate();
    keytracked_cutoff->plug(base_cutoff, 0);
    keytracked_cutoff->plug(current_keytrack, 1);

    Add* midi_cutoff = new Add();
    midi_cutoff->setControlRate();
    midi_cutoff->plug(keytracked_cutoff, 0);
    midi_cutoff->plug(scaled_envelope, 1);

    MidiScale* frequency_cutoff = new MidiScale();
    frequency_cutoff->setControlRate();
    frequency_cutoff->plug(midi_cutoff);

    Processor* resonance = createPolyModControl("resonance", true);
    ResonanceScale* scaled_resonance = new ResonanceScale();
    scaled_resonance->setControlRate();
    scaled_resonance->plug(resonance);

    ResonanceCancel* final_resonance = new ResonanceCancel();
    final_resonance->setControlRate();
    final_resonance->plug(scaled_resonance, ResonanceCancel::kResonance);
    final_resonance->plug(filter_type, ResonanceCancel::kFilterType);

    Value* min_db = new Value(MIN_GAIN_DB);
    Value* max_db = new Value(MAX_GAIN_DB);
    Interpolate* decibals = new Interpolate();
    decibals->setControlRate();
    decibals->plug(min_db, Interpolate::kFrom);
    decibals->plug(max_db, Interpolate::kTo);
    decibals->plug(resonance, Interpolate::kFractional);
    MagnitudeScale* final_gain = new MagnitudeScale();
    final_gain->setControlRate();
    final_gain->plug(decibals);

    Processor* filter_saturation = createPolyModControl("filter_saturation", true);
    MagnitudeScale* saturation_magnitude = new MagnitudeScale();
    saturation_magnitude->setControlRate();
    saturation_magnitude->plug(filter_saturation);

    LinearSmoothBuffer* smooth_saturation_magnitude = new LinearSmoothBuffer();
    smooth_saturation_magnitude->plug(saturation_magnitude);

    Multiply* saturated_audio = new Multiply();
    saturated_audio->plug(audio, 0);
    saturated_audio->plug(smooth_saturation_magnitude, 1);

    Filter* filter = new Filter();
    filter->plug(saturated_audio, Filter::kAudio);
    filter->plug(filter_type, Filter::kType);
    filter->plug(reset, Filter::kReset);
    filter->plug(frequency_cutoff, Filter::kCutoff);
    filter->plug(final_resonance, Filter::kResonance);
    filter->plug(final_gain, Filter::kGain);

    distorted_filter_ = new Distortion();
    Value* distortion_type = new Value(Distortion::kTanh);
    Value* distortion_threshold = new Value(0.5);
    distorted_filter_->plug(filter, Distortion::kAudio);
    distorted_filter_->plug(distortion_type, Distortion::kType);
    distorted_filter_->plug(distortion_threshold, Distortion::kThreshold);

    addProcessor(current_keytrack);
    addProcessor(saturated_audio);
    addProcessor(keytracked_cutoff);
    addProcessor(midi_cutoff);
    addProcessor(scaled_resonance);
    addProcessor(final_resonance);
    addProcessor(decibals);
    addProcessor(final_gain);
    addProcessor(frequency_cutoff);
    addProcessor(filter);

    addProcessor(saturation_magnitude);
    addProcessor(smooth_saturation_magnitude);
    addProcessor(distorted_filter_);

    mod_sources_["fil_envelope"] = filter_envelope_->output();

    // Stutter.
    BypassRouter* stutter_container = new BypassRouter();
    Processor* stutter_on = createBaseControl("stutter_on");
    stutter_container->plug(stutter_on, BypassRouter::kOn);
    stutter_container->plug(distorted_filter_, BypassRouter::kAudio);

    Stutter* stutter = new Stutter(44100);
    Processor* stutter_frequency = createPolyModControl("stutter_frequency", true);
    Processor* stutter_softness = createPolyModControl("stutter_softness", false);
    Processor* resample_frequency = createPolyModControl("stutter_resample_frequency", true);
    stutter_container->addProcessor(stutter);
    stutter_container->registerOutput(stutter->output());

    stutter->plug(distorted_filter_, Stutter::kAudio);
    stutter->plug(stutter_frequency, Stutter::kStutterFrequency);
    stutter->plug(resample_frequency, Stutter::kResampleFrequency);
    stutter->plug(stutter_softness, Stutter::kWindowSoftness);
    stutter->plug(reset, Stutter::kReset);

    addProcessor(stutter_container);

    // Formant Filter.
    formant_container_ = new BypassRouter();
    Processor* formant_on = createBaseControl("formant_on");
    formant_container_->plug(formant_on, BypassRouter::kOn);
    formant_container_->plug(stutter_container, BypassRouter::kAudio);

    formant_filter_ = new FormantManager(NUM_FORMANTS);
    formant_filter_->plug(stutter_container, FormantManager::kAudio);
    formant_filter_->plug(reset, FormantManager::kReset);

    Processor* formant_x = createPolyModControl("formant_x", false, true);
    Processor* formant_y = createPolyModControl("formant_y", false, true);

    for (int i = 0; i < NUM_FORMANTS; ++i) {
      BilinearInterpolate* formant_gain = new BilinearInterpolate();
      formant_gain->setControlRate();
      BilinearInterpolate* formant_q = new BilinearInterpolate();
      formant_q->setControlRate();
      BilinearInterpolate* formant_midi = new BilinearInterpolate();
      formant_midi->setControlRate();

      formant_gain->plug(formant_u[i].gain, BilinearInterpolate::kTopLeft);
      formant_gain->plug(formant_a[i].gain, BilinearInterpolate::kTopRight);
      formant_gain->plug(formant_e[i].gain, BilinearInterpolate::kBottomLeft);
      formant_gain->plug(formant_uu[i].gain, BilinearInterpolate::kBottomRight);

      formant_q->plug(formant_u[i].resonance, BilinearInterpolate::kTopLeft);
      formant_q->plug(formant_a[i].resonance, BilinearInterpolate::kTopRight);
      formant_q->plug(formant_e[i].resonance, BilinearInterpolate::kBottomLeft);
      formant_q->plug(formant_uu[i].resonance, BilinearInterpolate::kBottomRight);

      formant_midi->plug(formant_u[i].midi_cutoff, BilinearInterpolate::kTopLeft);
      formant_midi->plug(formant_a[i].midi_cutoff, BilinearInterpolate::kTopRight);
      formant_midi->plug(formant_e[i].midi_cutoff, BilinearInterpolate::kBottomLeft);
      formant_midi->plug(formant_uu[i].midi_cutoff, BilinearInterpolate::kBottomRight);

      formant_gain->plug(formant_x, BilinearInterpolate::kXPosition);
      formant_q->plug(formant_x, BilinearInterpolate::kXPosition);
      formant_midi->plug(formant_x, BilinearInterpolate::kXPosition);

      formant_gain->plug(formant_y, BilinearInterpolate::kYPosition);
      formant_q->plug(formant_y, BilinearInterpolate::kYPosition);
      formant_midi->plug(formant_y, BilinearInterpolate::kYPosition);

      MagnitudeScale* formant_magnitude = new MagnitudeScale();
      formant_magnitude->plug(formant_gain);
      formant_magnitude->setControlRate();

      MidiScale* formant_frequency = new MidiScale();
      formant_frequency->plug(formant_midi);
      formant_frequency->setControlRate();

      formant_filter_->getFormant(i)->plug(&formant_filter_types[i], Filter::kType);
      formant_filter_->getFormant(i)->plug(formant_magnitude, Filter::kGain);
      formant_filter_->getFormant(i)->plug(formant_q, Filter::kResonance);
      formant_filter_->getFormant(i)->plug(formant_frequency, Filter::kCutoff);

      addProcessor(formant_gain);
      addProcessor(formant_magnitude);
      addProcessor(formant_q);
      addProcessor(formant_midi);
      addProcessor(formant_frequency);
    }

    BilinearInterpolate* formant_decibals = new BilinearInterpolate();
    formant_decibals->plug(&formant_u_decibals, BilinearInterpolate::kTopLeft);
    formant_decibals->plug(&formant_a_decibals, BilinearInterpolate::kTopRight);
    formant_decibals->plug(&formant_e_decibals, BilinearInterpolate::kBottomLeft);
    formant_decibals->plug(&formant_uu_decibals, BilinearInterpolate::kBottomRight);
    formant_decibals->plug(formant_x, BilinearInterpolate::kXPosition);
    formant_decibals->plug(formant_y, BilinearInterpolate::kYPosition);

    MagnitudeScale* formant_gain = new MagnitudeScale();
    formant_gain->plug(formant_decibals);

    Multiply* formant_output = new Multiply();
    formant_output->plug(formant_gain, 0);
    formant_output->plug(formant_filter_, 1);

    formant_container_->addProcessor(formant_decibals);
    formant_container_->addProcessor(formant_gain);
    formant_container_->addProcessor(formant_filter_);
    formant_container_->addProcessor(formant_output);
    formant_container_->registerOutput(formant_output->output());

    addProcessor(formant_container_);
  }
Exemplo n.º 21
0
  LogTestController::getInstance().setTrace<processors::LogAttribute>();

  auto plan = testController.createPlan();
  auto repo = std::make_shared<TestRepository>();

  // Define directory for input
  std::string in_dir("/tmp/gt.XXXXXX");
  REQUIRE(testController.createTempDirectory(&in_dir[0]) != nullptr);

  // Define test input file
  std::string in_file(in_dir);
  in_file.append("/testfifo");

  // Build MiNiFi processing graph
  auto get_file = plan->addProcessor(
      "GetFile",
      "Get");
  plan->setProperty(
      get_file,
      processors::GetFile::Directory.getName(), in_dir);
  plan->setProperty(
      get_file,
      processors::GetFile::KeepSourceFile.getName(),
      "true");
  plan->addProcessor(
      "LogAttribute",
      "Log",
      core::Relationship("success", "description"),
      true);

  // Write test input
Exemplo n.º 22
0
  void HelmVoiceHandler::createArticulation(
      Output* note, Output* velocity, Output* trigger) {
    // Legato.
    Processor* legato = createBaseControl("legato");
    LegatoFilter* legato_filter = new LegatoFilter();
    legato_filter->plug(legato, LegatoFilter::kLegato);
    legato_filter->plug(trigger, LegatoFilter::kTrigger);

    addProcessor(legato_filter);

    // Amplitude envelope.
    Processor* amplitude_attack = createPolyModControl("amp_attack", false, false);
    Processor* amplitude_decay = createPolyModControl("amp_decay", true, false);
    Processor* amplitude_sustain = createPolyModControl("amp_sustain", false);
    Processor* amplitude_release = createPolyModControl("amp_release", true, false);

    amplitude_envelope_ = new Envelope();
    amplitude_envelope_->plug(legato_filter->output(LegatoFilter::kRetrigger),
                              Envelope::kTrigger);
    amplitude_envelope_->plug(amplitude_attack, Envelope::kAttack);
    amplitude_envelope_->plug(amplitude_decay, Envelope::kDecay);
    amplitude_envelope_->plug(amplitude_sustain, Envelope::kSustain);
    amplitude_envelope_->plug(amplitude_release, Envelope::kRelease);
    addProcessor(amplitude_envelope_);

    // Voice and frequency resetting logic.
    TriggerCombiner* note_change_trigger = new TriggerCombiner();
    note_change_trigger->plug(legato_filter->output(LegatoFilter::kRemain), 0);
    note_change_trigger->plug(amplitude_envelope_->output(Envelope::kFinished), 1);

    TriggerWait* note_wait = new TriggerWait();
    Value* current_note = new Value();
    note_wait->plug(note, TriggerWait::kWait);
    note_wait->plug(note_change_trigger, TriggerWait::kTrigger);
    current_note->plug(note_wait);

    Value* max_midi_invert = new Value(1.0 / (MIDI_SIZE - 1));
    Multiply* note_percentage = new Multiply();
    note_percentage->setControlRate();
    note_percentage->plug(max_midi_invert, 0);
    note_percentage->plug(current_note, 1);

    addProcessor(note_change_trigger);
    addProcessor(note_wait);
    addProcessor(current_note);

    // Key tracking.
    Value* center_adjust = new Value(-MIDI_SIZE / 2);
    note_from_center_ = new Add();
    note_from_center_->plug(center_adjust, 0);
    note_from_center_->plug(current_note, 1);

    addProcessor(note_from_center_);
    addProcessor(note_percentage);
    addGlobalProcessor(center_adjust);

    // Velocity tracking.
    TriggerWait* velocity_wait = new TriggerWait();
    Value* current_velocity = new Value();
    velocity_wait->plug(velocity, TriggerWait::kWait);
    velocity_wait->plug(note_change_trigger, TriggerWait::kTrigger);
    current_velocity->plug(velocity_wait);

    addProcessor(velocity_wait);
    addProcessor(current_velocity);

    Processor* velocity_track_amount = createPolyModControl("velocity_track", false);
    Interpolate* velocity_track_mult = new Interpolate();
    velocity_track_mult->plug(&utils::value_one, Interpolate::kFrom);
    velocity_track_mult->plug(current_velocity, Interpolate::kTo);
    velocity_track_mult->plug(velocity_track_amount, Interpolate::kFractional);
    addProcessor(velocity_track_mult);

    // Current amplitude using envelope and velocity.
    amplitude_ = new Multiply();
    amplitude_->plug(amplitude_envelope_->output(Envelope::kValue), 0);
    amplitude_->plug(velocity_track_mult, 1);

    addProcessor(amplitude_);

    // Portamento.
    Processor* portamento = createPolyModControl("portamento", false, false);
    Processor* portamento_type = createBaseControl("portamento_type");
    PortamentoFilter* portamento_filter = new PortamentoFilter();
    portamento_filter->plug(portamento_type, PortamentoFilter::kPortamento);
    portamento_filter->plug(note_change_trigger, PortamentoFilter::kFrequencyTrigger);
    portamento_filter->plug(trigger, PortamentoFilter::kVoiceTrigger);
    addProcessor(portamento_filter);

    current_frequency_ = new LinearSlope();
    current_frequency_->plug(current_note, LinearSlope::kTarget);
    current_frequency_->plug(portamento, LinearSlope::kRunSeconds);
    current_frequency_->plug(portamento_filter, LinearSlope::kTriggerJump);

    addProcessor(current_frequency_);

    mod_sources_["amp_envelope"] = amplitude_envelope_->output();
    mod_sources_["note"] = note_percentage->output();
    mod_sources_["velocity"] = current_velocity->output();
  }
Exemplo n.º 23
0
TEST_P(ProcessorCreationTests, ProcesorCreateAndResetAndAddToNetwork) {
    create();
    initialize();
    resetAllPoperties();
    addProcessor();
}
    DVRVis::DVRVis(DataContainer& dc)
        : AutoEvaluationPipeline(dc, getId())
        , _tcp(&_canvasSize)
        , _lsp()
        , _imageReader()
        , _pgGenerator()
        , _vmgGenerator()
        , _vmRenderer(&_canvasSize)
        , _eepGenerator(&_canvasSize)
        , _vmEepGenerator(&_canvasSize)
        , _dvrNormal(&_canvasSize)
        , _dvrVM(&_canvasSize)
        , _depthDarkening(&_canvasSize)
        , _combine(&_canvasSize)
    {
        _tcp.addLqModeProcessor(&_dvrNormal);
        _tcp.addLqModeProcessor(&_dvrVM);
        _tcp.addLqModeProcessor(&_depthDarkening);
        addEventListenerToBack(&_tcp);

        addProcessor(&_tcp);
        addProcessor(&_lsp);
        addProcessor(&_imageReader);
        addProcessor(&_pgGenerator);
        addProcessor(&_vmgGenerator);
        addProcessor(&_vmRenderer);
        addProcessor(&_eepGenerator);
        addProcessor(&_vmEepGenerator);
        addProcessor(&_dvrNormal);
        addProcessor(&_dvrVM);
        addProcessor(&_depthDarkening);
        addProcessor(&_combine);
    }
    XTT::XTT(DataContainer& dc)
        : AutoEvaluationPipeline(dc, getId())
        , _tcp(&_canvasSize)
        , _lsp()
		, _ampReader()
		, _vr(&_canvasSize)
		, _tensorReader()
        , _ta()
		, _vectorFieldRenderer(&_canvasSize)
        , _glyphRenderer(&_canvasSize)
		, _glyphRendererFromFiberTracking3D(&_canvasSize)
		, _sliceRenderer(&_canvasSize)
        , _rtc(&_canvasSize)
		, _rtc2(&_canvasSize)
		, _rtc3(&_canvasSize)
		, _rtc4(&_canvasSize)
		, _rtc5(&_canvasSize)

		, p_sliceNumber("SliceNumber", "Slice Number", 0, 0, 256)
		, _fiberTracker()
		, _fiberRenderer(&_canvasSize)
		, _dataContainerXTT(0)
    {
        addProperty(p_sliceNumber);

        addEventListenerToBack(&_tcp);

        addProcessor(&_tcp);
        addProcessor(&_lsp);
		addProcessor(&_ampReader);
		addProcessor(&_tensorReader);
        addProcessor(&_ta);
		addProcessor(&_vr);
		addProcessor(&_vectorFieldRenderer);
		addProcessor(&_fiberTracker);
		addProcessor(&_fiberRenderer);
		addProcessor(&_glyphRenderer);
		addProcessor(&_glyphRendererFromFiberTracking3D);
		addProcessor(&_sliceRenderer);
        addProcessor(&_rtc);
		addProcessor(&_rtc2);
		addProcessor(&_rtc3);
		addProcessor(&_rtc4);
		addProcessor(&_rtc5);
	}
 ImageLoading::ImageLoading(DataContainer& dc)
     : AutoEvaluationPipeline(dc, getId())
     , _imageReader()
 {
     addProcessor(&_imageReader);
 }
Exemplo n.º 27
0
  void HelmEngine::init() {
    static const Value* minutes_per_second = new Value(1.0 / 60.0);

#ifdef FE_DFL_DISABLE_SSE_DENORMS_ENV
    fesetenv(FE_DFL_DISABLE_SSE_DENORMS_ENV);
#endif

    Processor* beats_per_minute = createMonoModControl("beats_per_minute", false);
    Multiply* beats_per_second = new Multiply();
    beats_per_second->plug(beats_per_minute, 0);
    beats_per_second->plug(minutes_per_second, 1);
    addProcessor(beats_per_second);

    // Voice Handler.
    Processor* polyphony = createMonoModControl("polyphony", true);

    voice_handler_ = new HelmVoiceHandler(beats_per_second);
    addSubmodule(voice_handler_);
    voice_handler_->setPolyphony(32);
    voice_handler_->plug(polyphony, VoiceHandler::kPolyphony);

    // Monophonic LFO 1.
    Processor* lfo_1_waveform = createMonoModControl("mono_lfo_1_waveform", true);
    Processor* lfo_1_free_frequency = createMonoModControl("mono_lfo_1_frequency", true, false);
    Processor* lfo_1_free_amplitude = createMonoModControl("mono_lfo_1_amplitude", true);
    Processor* lfo_1_frequency = createTempoSyncSwitch("mono_lfo_1", lfo_1_free_frequency,
                                                       beats_per_second, false);

    lfo_1_ = new HelmLfo();
    lfo_1_->plug(lfo_1_waveform, HelmLfo::kWaveform);
    lfo_1_->plug(lfo_1_frequency, HelmLfo::kFrequency);

    Multiply* scaled_lfo_1 = new Multiply();
    scaled_lfo_1->setControlRate();
    scaled_lfo_1->plug(lfo_1_, 0);
    scaled_lfo_1->plug(lfo_1_free_amplitude, 1);

    addProcessor(lfo_1_);
    addProcessor(scaled_lfo_1);
    mod_sources_["mono_lfo_1"] = scaled_lfo_1->output();
    mod_sources_["mono_lfo_1_phase"] = lfo_1_->output(Oscillator::kPhase);

    // Monophonic LFO 2.
    Processor* lfo_2_waveform = createMonoModControl("mono_lfo_2_waveform", true);
    Processor* lfo_2_free_frequency = createMonoModControl("mono_lfo_2_frequency", true, false);
    Processor* lfo_2_free_amplitude = createMonoModControl("mono_lfo_2_amplitude", true);
    Processor* lfo_2_frequency = createTempoSyncSwitch("mono_lfo_2", lfo_2_free_frequency,
                                                       beats_per_second, false);

    lfo_2_ = new HelmLfo();
    lfo_2_->plug(lfo_2_waveform, HelmLfo::kWaveform);
    lfo_2_->plug(lfo_2_frequency, HelmLfo::kFrequency);

    Multiply* scaled_lfo_2 = new Multiply();
    scaled_lfo_2->setControlRate();
    scaled_lfo_2->plug(lfo_2_, 0);
    scaled_lfo_2->plug(lfo_2_free_amplitude, 1);

    addProcessor(lfo_2_);
    addProcessor(scaled_lfo_2);
    mod_sources_["mono_lfo_2"] = scaled_lfo_2->output();
    mod_sources_["mono_lfo_2_phase"] = lfo_2_->output(Oscillator::kPhase);

    // Step Sequencer.
    Processor* num_steps = createMonoModControl("num_steps", true);
    Processor* step_smoothing = createMonoModControl("step_smoothing", true);
    Processor* step_free_frequency = createMonoModControl("step_frequency", false, false);
    Processor* step_frequency = createTempoSyncSwitch("step_sequencer", step_free_frequency,
                                                      beats_per_second, false);

    step_sequencer_ = new StepGenerator(MAX_STEPS);
    step_sequencer_->plug(num_steps, StepGenerator::kNumSteps);
    step_sequencer_->plug(step_frequency, StepGenerator::kFrequency);

    for (int i = 0; i < MAX_STEPS; ++i) {
      std::stringstream stream;
      stream << i;
      std::string num = stream.str();
      if (num.length() == 1)
        num = "0" + num;
      Processor* step = createBaseControl(std::string("step_seq_") + num);
      step_sequencer_->plug(step, StepGenerator::kSteps + i);
    }

    SmoothFilter* smoothed_step_sequencer = new SmoothFilter();
    smoothed_step_sequencer->plug(step_sequencer_, SmoothFilter::kTarget);
    smoothed_step_sequencer->plug(step_smoothing, SmoothFilter::kHalfLife);

    addProcessor(step_sequencer_);
    addProcessor(smoothed_step_sequencer);

    mod_sources_["step_sequencer"] = smoothed_step_sequencer->output();
    mod_sources_["step_sequencer_step"] = step_sequencer_->output(StepGenerator::kStep);

    // Arpeggiator.
    Processor* arp_free_frequency = createMonoModControl("arp_frequency", true, false);
    Processor* arp_frequency = createTempoSyncSwitch("arp", arp_free_frequency,
                                                     beats_per_second, false);
    Processor* arp_octaves = createMonoModControl("arp_octaves", true);
    Processor* arp_pattern = createMonoModControl("arp_pattern", true);
    Processor* arp_gate = createMonoModControl("arp_gate", true);
    arp_on_ = createBaseControl("arp_on");
    arpeggiator_ = new Arpeggiator(voice_handler_);
    arpeggiator_->plug(arp_frequency, Arpeggiator::kFrequency);
    arpeggiator_->plug(arp_octaves, Arpeggiator::kOctaves);
    arpeggiator_->plug(arp_pattern, Arpeggiator::kPattern);
    arpeggiator_->plug(arp_gate, Arpeggiator::kGate);

    addProcessor(arpeggiator_);
    addProcessor(voice_handler_);

    // Delay effect.
    Processor* delay_free_frequency = createMonoModControl("delay_frequency", false, false);
    Processor* delay_frequency = createTempoSyncSwitch("delay", delay_free_frequency,
                                                       beats_per_second, false);
    Processor* delay_feedback = createMonoModControl("delay_feedback", false, true);
    Processor* delay_wet = createMonoModControl("delay_dry_wet", false, true);
    Value* delay_on = createBaseControl("delay_on");

    Clamp* delay_feedback_clamped = new Clamp(-1, 1);
    delay_feedback_clamped->plug(delay_feedback);

    SmoothFilter* delay_frequency_smoothed = new SmoothFilter();
    delay_frequency_smoothed->plug(delay_frequency, SmoothFilter::kTarget);
    delay_frequency_smoothed->plug(&utils::value_half, SmoothFilter::kHalfLife);
    FrequencyToSamples* delay_samples = new FrequencyToSamples();
    delay_samples->plug(delay_frequency_smoothed);

    Delay* delay = new Delay(MAX_DELAY_SAMPLES);
    delay->plug(voice_handler_, Delay::kAudio);
    delay->plug(delay_samples, Delay::kSampleDelay);
    delay->plug(delay_feedback_clamped, Delay::kFeedback);
    delay->plug(delay_wet, Delay::kWet);

    BypassRouter* delay_container = new BypassRouter();
    delay_container->plug(delay_on, BypassRouter::kOn);
    delay_container->plug(voice_handler_, BypassRouter::kAudio);
    delay_container->addProcessor(delay_feedback_clamped);
    delay_container->addProcessor(delay_frequency_smoothed);
    delay_container->addProcessor(delay_samples);
    delay_container->addProcessor(delay);
    delay_container->registerOutput(delay->output());

    addProcessor(delay_container);

    // Reverb Effect.
    Processor* reverb_feedback = createMonoModControl("reverb_feedback", false, true);
    Processor* reverb_damping = createMonoModControl("reverb_damping", false, true);
    Processor* reverb_wet = createMonoModControl("reverb_dry_wet", false, true);
    Value* reverb_on = createBaseControl("reverb_on");

    Clamp* reverb_feedback_clamped = new Clamp(-1, 1);
    reverb_feedback_clamped->plug(reverb_feedback);

    Reverb* reverb = new Reverb();
    reverb->plug(delay, Reverb::kAudio);
    reverb->plug(reverb_feedback_clamped, Reverb::kFeedback);
    reverb->plug(reverb_damping, Reverb::kDamping);
    reverb->plug(reverb_wet, Reverb::kWet);

    BypassRouter* reverb_container = new BypassRouter();
    reverb_container->plug(reverb_on, BypassRouter::kOn);
    reverb_container->plug(delay, BypassRouter::kAudio);
    reverb_container->addProcessor(reverb);
    reverb_container->addProcessor(reverb_feedback_clamped);
    reverb_container->registerOutput(reverb->output(0));
    reverb_container->registerOutput(reverb->output(1));

    addProcessor(reverb_container);

    // Soft Clipping.
    Distortion* distorted_clamp_left = new Distortion();
    Value* distortion_type = new Value(Distortion::kTanh);
    Value* distortion_threshold = new Value(0.9);
    distorted_clamp_left->plug(reverb_container->output(0), Distortion::kAudio);
    distorted_clamp_left->plug(distortion_type, Distortion::kType);
    distorted_clamp_left->plug(distortion_threshold, Distortion::kThreshold);

    Distortion* distorted_clamp_right = new Distortion();
    distorted_clamp_right->plug(reverb_container->output(1), Distortion::kAudio);
    distorted_clamp_right->plug(distortion_type, Distortion::kType);
    distorted_clamp_right->plug(distortion_threshold, Distortion::kThreshold);

    // Volume.
    Processor* volume = createMonoModControl("volume", false, true);
    Multiply* scaled_audio_left = new Multiply();
    scaled_audio_left->plug(distorted_clamp_left, 0);
    scaled_audio_left->plug(volume, 1);

    Multiply* scaled_audio_right = new Multiply();
    scaled_audio_right->plug(distorted_clamp_right, 0);
    scaled_audio_right->plug(volume, 1);

    addProcessor(distorted_clamp_left);
    addProcessor(distorted_clamp_right);
    addProcessor(scaled_audio_left);
    addProcessor(scaled_audio_right);
    registerOutput(scaled_audio_left->output());
    registerOutput(scaled_audio_right->output());

    HelmModule::init();
  }
Exemplo n.º 28
0
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
bool Envelope::init() {
	if ( !Application::init() ) return false;

	// Construct stream firewall
	for ( size_t i = 0; i < _config.streamsWhiteList.size(); ++i ) {
		Core::trim(_config.streamsWhiteList[i]);
		if ( !_config.streamsWhiteList[i].empty() ) {
			SEISCOMP_DEBUG("Adding pattern to stream whitelist: %s",
			               _config.streamsWhiteList[i].c_str());
			_streamFirewall.allow.insert(_config.streamsWhiteList[i]);
		}
	}

	for ( size_t i = 0; i < _config.streamsBlackList.size(); ++i ) {
		Core::trim(_config.streamsBlackList[i]);
		if ( !_config.streamsBlackList[i].empty() ) {
			SEISCOMP_DEBUG("Adding pattern to stream blacklist: %s",
			               _config.streamsBlackList[i].c_str());
			_streamFirewall.deny.insert(_config.streamsBlackList[i]);
		}
	}

	Inventory *inv = Client::Inventory::Instance()->inventory();
	if ( inv == NULL ) {
		SEISCOMP_ERROR("Inventory not available");
		return false;
	}

	Core::Time now = Core::Time::GMT();

	for ( size_t n = 0; n < inv->networkCount(); ++n ) {
		Network *net = inv->network(n);
		try { if ( net->end() < now ) continue; }
		catch ( ... ) {}

		for ( size_t s = 0; s < net->stationCount(); ++s ) {
			Station *sta = net->station(s);
			try { if ( sta->end() < now ) continue; }
			catch ( ... ) {}

			// Find velocity and strong-motion streams
			DataModel::WaveformStreamID tmp(net->code(), sta->code(), "", "", "");

			Stream *maxVel, *maxAcc;
			maxVel = Private::findStreamMaxSR(sta, now,
			                                  Processing::WaveformProcessor::MeterPerSecond,
			                                  &_streamFirewall);
			maxAcc = Private::findStreamMaxSR(sta, now,
			                                  Processing::WaveformProcessor::MeterPerSecondSquared,
			                                  &_streamFirewall);

			if ( !maxAcc && !maxVel ) {
				SEISCOMP_WARNING("%s.%s: no usable velocity and acceleration channel found",
				                 net->code().c_str(), sta->code().c_str());
				continue;
			}

			// Add velocity data if available
			if ( maxVel ) {
				tmp.setLocationCode(maxVel->sensorLocation()->code());
				tmp.setChannelCode(maxVel->code().substr(0,2));
				addProcessor(maxVel->sensorLocation(), tmp, now, "velocity", "vel");
			}

			// Add velocity data if available
			if ( maxAcc ) {
				tmp.setLocationCode(maxAcc->sensorLocation()->code());
				tmp.setChannelCode(maxAcc->code().substr(0,2));
				addProcessor(maxAcc->sensorLocation(), tmp, now, "accelerometric", "acc");
			}
		}
	}

	if ( _config.ts.valid() ) recordStream()->setStartTime(_config.ts);
	if ( _config.te.valid() ) recordStream()->setEndTime(_config.te);

	_creationInfo.setAgencyID(agencyID());
	_creationInfo.setAuthor(author());

	// We do not need lookup objects by publicID
	PublicObject::SetRegistrationEnabled(false);

	_sentMessages = 0;
	_sentMessagesTotal = 0;

#ifndef SC3_SYNC_VERSION
	_mpsReset.setCallback(boost::bind(&Envelope::resetMPSCount, this));
	_mpsReset.setTimeout(1);
	_mpsReset.start();
#endif

	return true;
}
    ViscontestDemo::ViscontestDemo(DataContainer& dc)
        : AutoEvaluationPipeline(dc, getId())
        , _lsp()
        , _tcp(&_canvasSize)
        , _fiberReader()
        , _fiberRenderer(&_canvasSize)
        , _t1PostReader()
        , _t1PreReader()
        , _flairReader()
        , _mvmpr2D(&_canvasSize)
        , _mvmpr3D(&_canvasSize)
        , _mvr(&_canvasSize)
        , _rtc1(&_canvasSize)
        , _rtc2(&_canvasSize)
        , _horizontalSplitter(2, ViewportSplitter::HORIZONTAL, &_canvasSize)
        , _slicePositionEventHandler(&_mvmpr2D.p_planeDistance)
    {
        _tcp.addLqModeProcessor(&_mvr);
        addEventListenerToBack(&_horizontalSplitter);

        addProcessor(&_lsp);
        addProcessor(&_tcp);
        addProcessor(&_fiberReader);
        addProcessor(&_fiberRenderer);
        addProcessor(&_t1PostReader);
        addProcessor(&_t1PreReader);
        addProcessor(&_flairReader);
        addProcessor(&_mvmpr2D);
        addProcessor(&_mvmpr3D);
        addProcessor(&_mvr);
        addProcessor(&_rtc1);
        addProcessor(&_rtc2);

        _horizontalSplitter.p_outputImageId.setValue("ViscontestDemo");
        _horizontalSplitter.setInputImageIdProperty(0, &_mvmpr2D.p_outputImageId);
        _horizontalSplitter.setInputImageIdProperty(1, &_rtc2.p_targetImageId);

        _tcp.setViewportSizeProperty(&_horizontalSplitter.p_subViewViewportSize);
        _mvmpr2D.setViewportSizeProperty(&_horizontalSplitter.p_subViewViewportSize);
        _mvmpr3D.setViewportSizeProperty(&_horizontalSplitter.p_subViewViewportSize);
        _mvr.setViewportSizeProperty(&_horizontalSplitter.p_subViewViewportSize);
        _rtc1.setViewportSizeProperty(&_horizontalSplitter.p_subViewViewportSize);
        _rtc2.setViewportSizeProperty(&_horizontalSplitter.p_subViewViewportSize);
    }