Skip to content

Commit bfc2f21

Browse files
Some minor fixes (#481)
- effect_envelope.cpp: don't re-start release if noteOff() call in release phase - effect_granular.h: add guard macros - effect_reverb.cpp: don't just return on NULL block received, process silent data (otherwise the reverb cuts off in a nasty fashion...)
1 parent 83434c7 commit bfc2f21

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

effect_envelope.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ void AudioEffectEnvelope::noteOn(void)
6161
void AudioEffectEnvelope::noteOff(void)
6262
{
6363
__disable_irq();
64-
if (state != STATE_IDLE && state != STATE_FORCED) {
64+
if (state != STATE_RELEASE && state != STATE_IDLE && state != STATE_FORCED) {
6565
state = STATE_RELEASE;
6666
count = release_count;
6767
inc_hires = (-mult_hires) / (int32_t)count;

effect_granular.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121
* SOFTWARE.
2222
*/
2323

24+
#ifndef _effect_granular_h_
25+
#define _effect_granular_h_
26+
2427
#include <AudioStream.h> // github.com/PaulStoffregen/cores/blob/master/teensy4/AudioStream.h
2528

2629
class AudioEffectGranular : public AudioStream
@@ -63,3 +66,4 @@ class AudioEffectGranular : public AudioStream
6366
bool sample_req;
6467
};
6568

69+
#endif // _effect_granular_h_

effect_reverb.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -222,15 +222,17 @@ AudioEffectReverb::update(void)
222222
{
223223
audio_block_t *block;
224224

225-
if (!(block = receiveWritable()))
226-
return;
227-
228-
if (!block->data)
229-
return;
225+
if (nullptr == (block = receiveWritable()))
226+
{
227+
if (nullptr == (block = allocate()))
228+
return;
229+
else
230+
memset(block->data,0,sizeof block->data);
231+
}
230232

231233
arm_q15_to_q31(block->data, q31_buf, AUDIO_BLOCK_SAMPLES);
232234
provide_guard_bits_q31(q31_buf, AUDIO_BLOCK_SAMPLES, 8);
233-
235+
234236
_do_comb_apf(&apf[0], q31_buf, q31_buf);
235237
_do_comb_apf(&apf[1], q31_buf, q31_buf);
236238

0 commit comments

Comments
 (0)