[all] Throttle Trace resetted when changing Model

[sky9x] Background music stopped when changing Model
This commit is contained in:
bsongis
2012-10-04 19:24:16 +00:00
parent 2b78b499f4
commit b4b00ecddc
9 changed files with 33 additions and 19 deletions
+11 -5
View File
@@ -527,15 +527,21 @@ void AudioQueue::stopPlay(uint8_t id)
void AudioQueue::stopSD()
{
sdAvailableAudioFiles = 0;
CoEnterMutexSection(audioMutex);
widx = ridx; // clean the queue
CoLeaveMutexSection(audioMutex);
reset();
play(0, 0, 100, PLAY_NOW); // insert a 100ms pause
}
#endif
void AudioQueue::reset()
{
CoEnterMutexSection(audioMutex);
widx = ridx; // clean the queue
memset(&currentContext.fragment, 0, sizeof(AudioFragment));
memset(&backgroundContext.fragment, 0, sizeof(AudioFragment));
CoLeaveMutexSection(audioMutex);
}
void audioEvent(uint8_t e, uint8_t f)
{
#ifdef SDCARD
+3
View File
@@ -111,6 +111,8 @@ class AudioQueue {
return ridx == widx;
}
void reset();
protected:
void wakeup();
@@ -178,5 +180,6 @@ extern void pushPrompt(uint16_t prompt, uint8_t id=0);
#define PLAY_VALUE(v, id) playValue((v), (id))
#define PLAY_FILE(f, flags, id) audioQueue.playFile((f), (flags), (id))
#define STOP_PLAY(id) audioQueue.stopPlay((id))
#define AUDIO_RESET() audioQueue.reset()
#endif
+1 -3
View File
@@ -489,7 +489,7 @@ const char * sdCmd9()
#define SDMMC_SELECT_CARD (7 | HSMCI_CMDR_TRCMD_NO_DATA \
| HSMCI_CMDR_SPCMD_STD \
| HSMCI_CMDR_RSPTYP_R1B \
| HSMCI_CMDR_MAXLAT /* TODO not the same */ )
| HSMCI_CMDR_MAXLAT )
const char * sdCmd7()
{
@@ -1362,8 +1362,6 @@ DRESULT disk_write (
if ( sd_card_ready() == 0 ) return RES_NOTRDY;
// TODO if (Stat & STA_PROTECT) return RES_WRPRT;
do {
while (1) {