MCPcopy Create free account
hub / github.com/LabSound/LabSound / SfxrNode

Method SfxrNode

src/extended/SfxrNode.cpp:634–696  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

632}
633
634SfxrNode::SfxrNode(AudioContext & ac)
635 : AudioScheduledSourceNode(ac, *desc())
636 , sfxr(new SfxrNode::Sfxr())
637{
638 // Output is always mono.
639 addOutput(std::unique_ptr<AudioNodeOutput>(new AudioNodeOutput(this, 1)));
640
641 _preset = setting("preset");
642 _waveType = setting("waveType");
643 _attack = param("attack");
644 _sustainTime = param("sustain");
645 _sustainPunch = param("sustainPunch");
646 _startFrequency = param("startFrequency");
647 _minFrequency = param("minFrequency");
648 _decayTime = param("decay");
649 _slide = param("slide");
650 _deltaSlide = param("deltaSlide");
651 _vibratoDepth = param("vibratoDepth");
652 _vibratoSpeed = param("vibratoSpeed");
653 _changeAmount = param("changeAmount");
654 _changeSpeed = param("changeSpeed");
655 _squareDuty = param("squareDuty");
656 _dutySweep = param("dutySweep");
657 _repeatSpeed = param("repeatSpeed");
658 _phaserOffset = param("phaserOffset");
659 _phaserSweep = param("phaserSweep");
660 _lpFilterCutoff = param("lpFilterCutoff");
661 _lpFilterCutoffSweep = param("lpFilterCutoffSweep");
662 _lpFilterResonance = param("lpFilterResonance");
663 _hpFilterCutoff = param("hpFilterCutoff");
664 _hpFilterCutoffSweep = param("hpFilterCutoffSweep");
665
666 sfxr->ResetParams();
667 sfxr->ResetSample(true);
668 sfxr->PlaySample();
669
670 _scheduler._onStart = [this](double when)
671 {
672 // when is ignored.
673 this->sfxr->ResetSample(true);
674 this->sfxr->PlaySample();
675 };
676
677 initialize();
678
679 _preset->setValueChanged([this]()
680 {
681 int value = this->_preset->valueUint32();
682 switch (value)
683 {
684 case 0: this->setDefaultBeep(); break;
685 case 1: this->coin(); break;
686 case 2: this->laser(); break;
687 case 3: this->explosion(); break;
688 case 4: this->powerUp(); break;
689 case 5: this->hit(); break;
690 case 6: this->jump(); break;
691 case 7: this->select(); break;

Callers

nothing calls this directly

Calls 15

setDefaultBeepMethod · 0.95
coinMethod · 0.95
laserMethod · 0.95
explosionMethod · 0.95
powerUpMethod · 0.95
hitMethod · 0.95
jumpMethod · 0.95
selectMethod · 0.95
mutateMethod · 0.95
randomizeMethod · 0.95
ResetParamsMethod · 0.80
ResetSampleMethod · 0.80

Tested by

no test coverage detected