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

Method laser

src/extended/SfxrNode.cpp:881–924  ·  view source on GitHub ↗

@TODO the audioParams should be read into buffers in the case that they are time varying

Source from the content-addressed store, hash-verified

879
880/// @TODO the audioParams should be read into buffers in the case that they are time varying
881void SfxrNode::laser()
882{
883 setDefaultBeep();
884 _waveType->setEnumeration(rnd(2));
885 if (_waveType->valueUint32() == SINE && rnd(1))
886 _waveType->setEnumeration(rnd(1));
887 if (rnd(2) == 0)
888 {
889 _startFrequency->setValue(0.3f + frnd(0.6f));
890 _minFrequency->setValue(frnd(0.1f));
891 _slide->setValue(-0.35f - frnd(0.3f));
892 }
893 else
894 {
895 ContextRenderLock r(nullptr, "laser");
896 /// @fixme these values should be per sample, not per quantum
897 /// -or- they should be settings if they don't vary per sample
898 _startFrequency->setValue(0.5f + frnd(0.5f));
899 _minFrequency->setValue(_startFrequency->value() - 0.2f - frnd(0.6f));
900 if (_minFrequency->value() < 0.2f) _minFrequency->setValue(0.2f);
901 _slide->setValue(-0.15f - frnd(0.2f));
902 }
903 if (rnd(1))
904 {
905 _squareDuty->setValue(frnd(0.5f));
906 _dutySweep->setValue(frnd(0.2f));
907 }
908 else
909 {
910 _squareDuty->setValue(0.4f + frnd(0.5f));
911 _dutySweep->setValue(-frnd(0.7f));
912 }
913 _attack->setValue(0);
914 _sustainTime->setValue(0.1f + frnd(0.2f));
915 _decayTime->setValue(frnd(0.4f));
916 if (rnd(1))
917 _sustainPunch->setValue(frnd(0.3f));
918 if (rnd(2) == 0)
919 {
920 _phaserOffset->setValue(frnd(0.2f));
921 _phaserSweep->setValue(-frnd(0.2f));
922 }
923 _hpFilterCutoff->setValue(frnd(0.3f));
924}
925
926void SfxrNode::explosion()
927{

Callers 1

SfxrNodeMethod · 0.95

Calls 6

rndFunction · 0.85
frndFunction · 0.85
setEnumerationMethod · 0.80
valueUint32Method · 0.80
setValueMethod · 0.80
valueMethod · 0.45

Tested by

no test coverage detected