Associate an ID to each set of prompts played by Function Switches so that if the ID is present in the prompts queue, it is not queued again.
This commit is contained in:
@@ -166,8 +166,9 @@ ISR(TIMER4_COMPA_vect) //Every 0.5ms
|
||||
}
|
||||
#endif
|
||||
|
||||
void pushPrompt(uint16_t prompt)
|
||||
void pushPrompt(uint16_t prompt, uint8_t id)
|
||||
{
|
||||
/* TODO id */
|
||||
somo14playlist[somo14WIdx] = prompt;
|
||||
somo14WIdx = (somo14WIdx + 1) % QUEUE_LENGTH;
|
||||
cli();
|
||||
@@ -175,8 +176,9 @@ void pushPrompt(uint16_t prompt)
|
||||
sei();
|
||||
}
|
||||
|
||||
bool isPlaying()
|
||||
bool isPlaying(uint8_t id)
|
||||
{
|
||||
/* TODO id */
|
||||
#if defined(SIMU)
|
||||
return false;
|
||||
#else
|
||||
|
||||
+10
-3
@@ -34,7 +34,14 @@
|
||||
#define PROMPT_SYSTEM_BASE 230
|
||||
#define PROMPT_CUSTOM_BASE 256
|
||||
|
||||
#define pushCustomPrompt(p) pushPrompt(PROMPT_CUSTOM_BASE+(p))
|
||||
extern void pushPrompt(uint16_t prompt);
|
||||
extern bool isPlaying();
|
||||
extern void pushPrompt(uint16_t prompt, uint8_t id=0);
|
||||
extern bool isPlaying(uint8_t id);
|
||||
|
||||
#define PLAY_FUNCTION(x, ...) void x(__VA_ARGS__, uint8_t id)
|
||||
#define PUSH_PROMPT(p) pushPrompt((p), id)
|
||||
#define PUSH_CUSTOM_PROMPT(p, id) pushPrompt(PROMPT_CUSTOM_BASE+(p), (id))
|
||||
#define PLAY_NUMBER(n, u, a) playNumber((n), (u), (a), id)
|
||||
#define PLAY_DURATION(d) playDuration((d), id)
|
||||
#define IS_PLAYING(id) isPlaying((id))
|
||||
#define PLAY_VALUE(v, id) playValue((v), (id))
|
||||
#define PLAY_FILE(f, id) audioQueue.playFile((f), (id))
|
||||
|
||||
Reference in New Issue
Block a user