当前位置: 首页>>代码示例>>C++>>正文


C++ Delay::plug方法代码示例

本文整理汇总了C++中Delay::plug方法的典型用法代码示例。如果您正苦于以下问题:C++ Delay::plug方法的具体用法?C++ Delay::plug怎么用?C++ Delay::plug使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Delay的用法示例。


在下文中一共展示了Delay::plug方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: init

  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);
//.........这里部分代码省略.........
开发者ID:hztirf,项目名称:helm,代码行数:101,代码来源:helm_engine.cpp


注:本文中的Delay::plug方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。