simu compilation

This commit is contained in:
bsongis
2012-07-04 12:57:35 +00:00
parent 602ff6ca46
commit a761db40a2
+17 -1
View File
@@ -301,11 +301,15 @@ void AudioQueue::pause(uint8_t tLen)
play(0, 0, tLen); // a pause play(0, 0, tLen); // a pause
} }
#ifndef SIMU
extern OS_MutexID audioMutex; extern OS_MutexID audioMutex;
#endif
void AudioQueue::play(uint8_t tFreq, uint8_t tLen, uint8_t tPause, uint8_t tFlags, int8_t tFreqIncr) void AudioQueue::play(uint8_t tFreq, uint8_t tLen, uint8_t tPause, uint8_t tFlags, int8_t tFreqIncr)
{ {
#ifndef SIMU
CoEnterMutexSection(audioMutex); CoEnterMutexSection(audioMutex);
#endif
if (tFlags & PLAY_SOUND_VARIO) { if (tFlags & PLAY_SOUND_VARIO) {
background.freq = tFreq; background.freq = tFreq;
@@ -351,12 +355,16 @@ void AudioQueue::play(uint8_t tFreq, uint8_t tLen, uint8_t tPause, uint8_t tFlag
} }
} }
#ifndef SIMU
CoLeaveMutexSection(audioMutex); CoLeaveMutexSection(audioMutex);
#endif
} }
void AudioQueue::playFile(const char *filename, uint8_t flags) void AudioQueue::playFile(const char *filename, uint8_t flags)
{ {
#ifndef SIMU
CoEnterMutexSection(audioMutex); CoEnterMutexSection(audioMutex);
#endif
if ((flags & PLAY_NOW) || !busy()) { if ((flags & PLAY_NOW) || !busy()) {
state = 1; state = 1;
@@ -381,12 +389,17 @@ void AudioQueue::playFile(const char *filename, uint8_t flags)
} }
} }
CoSetFlag(audioFlag); CoSetFlag(audioFlag);
#ifndef SIMU
CoLeaveMutexSection(audioMutex); CoLeaveMutexSection(audioMutex);
#endif
} }
void audioEvent(uint8_t e, uint8_t f) void audioEvent(uint8_t e, uint8_t f)
{ {
#ifdef SDCARD
char filename[32] = SYSTEM_SOUNDS_PATH "/"; char filename[32] = SYSTEM_SOUNDS_PATH "/";
#endif
#ifdef HAPTIC #ifdef HAPTIC
haptic.event(e); //do this before audio to help sync timings haptic.event(e); //do this before audio to help sync timings
@@ -398,10 +411,13 @@ void audioEvent(uint8_t e, uint8_t f)
} }
if (g_eeGeneral.beeperMode>0 || (g_eeGeneral.beeperMode==0 && e>=AU_TRIM_MOVE) || (g_eeGeneral.beeperMode>=-1 && e<=AU_ERROR)) { if (g_eeGeneral.beeperMode>0 || (g_eeGeneral.beeperMode==0 && e>=AU_TRIM_MOVE) || (g_eeGeneral.beeperMode>=-1 && e<=AU_ERROR)) {
#ifdef SDCARD
if (e < AU_FRSKY_FIRST && isAudioFileAvailable(e, filename)) { if (e < AU_FRSKY_FIRST && isAudioFileAvailable(e, filename)) {
audioQueue.playFile(filename); audioQueue.playFile(filename);
} }
else if (e < AU_FRSKY_FIRST || !audioQueue.busy()) { else
#endif
if (e < AU_FRSKY_FIRST || !audioQueue.busy()) {
switch (e) { switch (e) {
// inactivity timer alert // inactivity timer alert
case AU_INACTIVITY: case AU_INACTIVITY: