From 5855eb3da09ec0e6353ea07d2b48ca730e43dbde Mon Sep 17 00:00:00 2001 From: Stuart Longland Date: Sun, 9 Apr 2017 10:06:11 +1000 Subject: [PATCH] adsr: Add test for "ADSR done" event. --- adsr.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/adsr.h b/adsr.h index 724c94f..636ff47 100644 --- a/adsr.h +++ b/adsr.h @@ -104,6 +104,14 @@ static inline void adsr_config(struct adsr_env_gen_t* const adsr, * Compute the ADSR amplitude */ uint8_t adsr_next(struct adsr_env_gen_t* const adsr); + +/*! + * Test to see if the ADSR is done. + */ +static inline uint8_t adsr_is_done(struct adsr_env_gen_t* const adsr) { + return (adsr->state == ADSR_STATE_DONE); +} + #endif /* * vim: set sw=8 ts=8 noet si tw=72