From c95ff048d87722601cc1fd10c5be44fa1d77b7be Mon Sep 17 00:00:00 2001 From: bsongis Date: Sun, 8 Jul 2012 17:44:16 +0000 Subject: [PATCH] Another STUPID bug on audio / ersky9x --- src/ersky9x/audio.cpp | 10 +++++++--- src/ersky9x/audio.h | 4 ++++ src/open9x.cpp | 2 +- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/ersky9x/audio.cpp b/src/ersky9x/audio.cpp index f4e483411..5a85be37b 100644 --- a/src/ersky9x/audio.cpp +++ b/src/ersky9x/audio.cpp @@ -157,7 +157,7 @@ extern uint16_t Sine_values[]; #define CODEC_ID_PCM_S16LE 1 #define CODEC_ID_PCM_ALAW 6 uint8_t pcmCodec; -uint16_t pcmFreq; +uint16_t pcmFreq = 8000; void audioTask(void* pdata) { @@ -182,7 +182,7 @@ void AudioQueue::wakeup() static FIL wavFile; #endif - if (prioIdx >= 0 && prioIdx != ridx) { + if (prioIdx >= 0) { ridx = prioIdx; prioIdx = -1; toneStop(); @@ -207,6 +207,7 @@ void AudioQueue::wakeup() FRESULT result = FR_OK; UINT read = 0; if (current.file[1]) { + pcmFreq = 8000; wavSamplesBuffer = wavSamplesArray; result = f_open(&wavFile, current.file, FA_OPEN_EXISTING | FA_READ); if (result == FR_OK) { @@ -412,7 +413,9 @@ void AudioQueue::play(uint8_t tFreq, uint8_t tLen, uint8_t tPause, uint8_t tFlag void AudioQueue::playFile(const char *filename, uint8_t flags) { -#ifndef SIMU +#ifdef SIMU + printf("playFile(\"%s\"\n", filename); fflush(stdout); +#else CoEnterMutexSection(audioMutex); #endif @@ -635,4 +638,5 @@ void pushPrompt(uint16_t prompt) audioQueue.playFile(filename); #endif + } diff --git a/src/ersky9x/audio.h b/src/ersky9x/audio.h index 16969edf7..946c49b49 100644 --- a/src/ersky9x/audio.h +++ b/src/ersky9x/audio.h @@ -78,7 +78,11 @@ class AudioQueue { bool busy() { +#ifdef SIMU + return false; +#else return (state != AUDIO_SLEEPING); +#endif } protected: diff --git a/src/open9x.cpp b/src/open9x.cpp index b89bfed75..ff6abfa49 100644 --- a/src/open9x.cpp +++ b/src/open9x.cpp @@ -1580,7 +1580,7 @@ void playValue(uint8_t idx) // no break case NUM_XCHNRAW+TELEM_A1-1: case NUM_XCHNRAW+TELEM_A2-1: - idx -= NUM_XCHNRAW+MAX_TIMERS; + idx -= (NUM_XCHNRAW+TELEM_A1-1); // A1 and A2 { uint8_t att = 0;