MCPcopy Create free account
hub / github.com/BespokeSynth/BespokeSynth / Process

Method Process

Source/TriggerDetector.cpp:34–52  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32}
33
34void TriggerDetector::Process(float sample)
35{
36 if (mSharpness > 0)
37 {
38 float filter = 1 - mSharpness * .001f;
39 mAvg = filter * mAvg + (1 - filter) * sample;
40 sample -= mAvg; //highpass
41 }
42
43 if (sample - mHistory.GetSample(100, 0) > mThreshold && sample > .1f && mWaitingForFall == false)
44 {
45 mTriggered = true;
46 mWaitingForFall = true;
47 }
48 if (sample < mHistory.GetSample(100, 0))
49 mWaitingForFall = false;
50
51 mHistory.Write(sample, 0);
52}
53
54float TriggerDetector::GetValue()
55{

Callers

nothing calls this directly

Calls 2

GetSampleMethod · 0.45
WriteMethod · 0.45

Tested by

no test coverage detected