diff --git a/src/hcr.cpp b/src/hcr.cpp index dc8cd90..9c1cedc 100644 --- a/src/hcr.cpp +++ b/src/hcr.cpp @@ -462,6 +462,15 @@ void HCRVocalizer::PlayWAV(int ch,String file) { } } +void HCRVocalizer::PlayRandomWAV(int ch,String file1, String file2) { + if (millis() > lastPlayWAV) { + lastPlayWAV = millis() + 5000; + char channel[] = "VAB"; + String msg = "C" + ToString((char) channel[ch]) + file1 + "C" + file2 + ",QP" + ToString((char) channel[ch]); + sendCommand(msg); + } +} + void HCRVocalizer::StopWAV(int ch) { char channel[] = "VAB"; String msg = "PS" + ToString((char) channel[ch]) + ",QP" + ToString((char) channel[ch]); diff --git a/src/hcr.h b/src/hcr.h index aa307f9..c7abe11 100644 --- a/src/hcr.h +++ b/src/hcr.h @@ -211,6 +211,15 @@ class HCRVocalizer */ void PlayWAV(int v,String file); + /** + * @brief Plays a WAV file by file name + * + * @param v the channel (CH_A|CH_B) + * @param file1 the file name prefix (e.g. "0000") + * @param file2 the file name prefix (e.g. "0001") + */ + void PlayRandomWAV(int v,String file1, String file2); + /** * @brief Stops the WAV playing on the specified channel *