diff --git a/include/bw_note_queue.h b/include/bw_note_queue.h
index 68b44bb..d92eb40 100644
--- a/include/bw_note_queue.h
+++ b/include/bw_note_queue.h
@@ -32,6 +32,7 @@
*
* - Version 1.1.0:
*
+ * - Added
bw_note_queue_all_notes_off
.
* - Added support for
BW_INCLUDE_WITH_QUOTES
,
* BW_NO_CXX
, and
* BW_CXX_NO_EXTERN_C
.
@@ -162,6 +163,15 @@ static inline void bw_note_queue_add(
* If `force_went_off` is set to non-`0`, `went_off` is always set to
* non-`0`.
*
+ * #### bw_note_queue_all_notes_off()
+ * ```>>> */
+static inline void bw_note_queue_all_notes_off(
+ bw_note_queue * BW_RESTRICT queue,
+ float velocity);
+/*! <<<```
+ * Turns all notes off in `queue`, adding note off events as needed with the
+ * given `velocity`.
+ *
* #### bw_note_queue_is_valid()
* ```>>> */
static inline char bw_note_queue_is_valid(
@@ -243,6 +253,20 @@ static inline void bw_note_queue_add(
BW_ASSERT_DEEP(bw_note_queue_is_valid(queue));
}
+static inline void bw_note_queue_all_notes_off(
+ bw_note_queue * BW_RESTRICT queue,
+ float velocity) {
+ BW_ASSERT(queue != BW_NULL);
+ BW_ASSERT_DEEP(bw_note_queue_is_valid(queue));
+ BW_ASSERT(bw_is_finite(velocity) && velocity <= 1.f);
+
+ for (unsigned char i = 0; i < 128; i++)
+ if (queue->status[i].pressed)
+ bw_note_queue_add(queue, i, 0, velocity, 0);
+
+ BW_ASSERT_DEEP(bw_note_queue_is_valid(queue));
+}
+
static inline char bw_note_queue_is_valid(
const bw_note_queue * BW_RESTRICT queue) {
BW_ASSERT(queue != BW_NULL);