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