Browse Source

Add isActive() and isSustain() to envelope

dds
PaulStoffregen 6 years ago
parent
commit
4d98116e6f
4 changed files with 26 additions and 0 deletions
  1. +14
    -0
      effect_envelope.cpp
  2. +2
    -0
      effect_envelope.h
  3. +8
    -0
      gui/index.html
  4. +2
    -0
      keywords.txt

+ 14
- 0
effect_envelope.cpp View File

@@ -180,3 +180,17 @@ void AudioEffectEnvelope::update(void)
release(block);
}

bool AudioEffectEnvelope::isActive()
{
uint8_t current_state = *(volatile uint8_t *)&state;
if (current_state == STATE_IDLE) return false;
return true;
}

bool AudioEffectEnvelope::isSustain()
{
uint8_t current_state = *(volatile uint8_t *)&state;
if (current_state == STATE_SUSTAIN) return true;
return false;
}


+ 2
- 0
effect_envelope.h View File

@@ -74,6 +74,8 @@ public:
release_forced_count = milliseconds2count(milliseconds);
if (release_count == 0) release_count = 1;
}
bool isActive();
bool isSustain();
using AudioStream::release;
virtual void update(void);
private:

+ 8
- 0
gui/index.html View File

@@ -2463,6 +2463,14 @@ double s_freq = .0625;</p>
disable this feature (never extra latency). Longer times help
reduce clicks or pops. The default is 5 millisecond.
</p>
<p class=func><span class=keyword>isActive</span>();</p>
<p class=desc>Returns true when the envelope is currently in any of
its 6 phases.
</p>
<p class=func><span class=keyword>isSustain</span>();</p>
<p class=desc>Returns true when the envelope is currently in the
sustain phase.
</p>
<h3>Examples</h3>
<p class=exam>File &gt; Examples &gt; Audio &gt; Synthesis &gt; PlaySynthMusic
</p>

+ 2
- 0
keywords.txt View File

@@ -119,6 +119,8 @@ decay KEYWORD2
sustain KEYWORD2
release KEYWORD2
releaseNoteOn KEYWORD2
isActive KEYWORD2
isSustain KEYWORD2
inputLevel KEYWORD2
inputSelect KEYWORD2
muteHeadphone KEYWORD2

Loading…
Cancel
Save