|
|
@ -32,9 +32,15 @@ using namespace std; |
|
|
|
|
|
|
|
SemaphoreHandle_t xPlayingSemaphore = NULL; |
|
|
|
static TaskHandle_t xTaskToNotify = NULL; |
|
|
|
Sound* Sound::instance = NULL; |
|
|
|
|
|
|
|
Sound::Sound() { |
|
|
|
xPlayingSemaphore = xSemaphoreCreateMutex(); |
|
|
|
Sound::instance = this; |
|
|
|
} |
|
|
|
|
|
|
|
Sound* Sound::getInstance() { |
|
|
|
return Sound::instance; |
|
|
|
} |
|
|
|
|
|
|
|
void Sound::init() { |
|
|
@ -117,8 +123,9 @@ void Sound::play_task(void *pvParameter) { |
|
|
|
|
|
|
|
File file = SDCard::open(path); // ToDo: accessing static member function loads 1500 words onto stack!
|
|
|
|
if (!file) { |
|
|
|
xTaskToNotify = NULL; |
|
|
|
Serial.print("Failed to open file: "); Serial.println(path); |
|
|
|
xTaskToNotify = NULL; |
|
|
|
xSemaphoreGive( xPlayingSemaphore ); |
|
|
|
vTaskDelete( NULL ); |
|
|
|
return; |
|
|
|
} |
|
|
|