From 089663b7337d9a65e08dc59be9543c7cd42e3d8f Mon Sep 17 00:00:00 2001 From: marchingband Date: Tue, 1 Feb 2022 22:02:13 -0800 Subject: [PATCH] audition toggles playback --- src/rpc.c | 2 +- src/wav_player.c | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/rpc.c b/src/rpc.c index bddbd12..85fd195 100644 --- a/src/rpc.c +++ b/src/rpc.c @@ -45,7 +45,7 @@ char* on_rpc_in(cJSON *json) uint8_t voice = cJSON_GetObjectItemCaseSensitive(json, "voice")->valueint; uint8_t note = cJSON_GetObjectItemCaseSensitive(json, "note")->valueint; uint8_t velocity = cJSON_GetObjectItemCaseSensitive(json, "velocity")->valueint; - play_wav(voice, note, velocity); + toggle_wav(voice, note, velocity); char * res = "started wav"; return(res); break; diff --git a/src/wav_player.c b/src/wav_player.c index 5724ac4..394eb8e 100644 --- a/src/wav_player.c +++ b/src/wav_player.c @@ -235,6 +235,18 @@ int16_t IRAM_ATTR scale_sample_clamped_16(int in, uint8_t volume) return (int16_t)(out * lin_float_lut[volume].val); } +bool is_playing(uint8_t voice, uint8_t note) +{ + for(int i=0;i