1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-26 01:35:21 +03:00

Another STUPID bug on audio / ersky9x

This commit is contained in:
bsongis 2012-07-08 17:44:16 +00:00
parent 89dd6aaf47
commit c95ff048d8
3 changed files with 12 additions and 4 deletions

View file

@ -157,7 +157,7 @@ extern uint16_t Sine_values[];
#define CODEC_ID_PCM_S16LE 1 #define CODEC_ID_PCM_S16LE 1
#define CODEC_ID_PCM_ALAW 6 #define CODEC_ID_PCM_ALAW 6
uint8_t pcmCodec; uint8_t pcmCodec;
uint16_t pcmFreq; uint16_t pcmFreq = 8000;
void audioTask(void* pdata) void audioTask(void* pdata)
{ {
@ -182,7 +182,7 @@ void AudioQueue::wakeup()
static FIL wavFile; static FIL wavFile;
#endif #endif
if (prioIdx >= 0 && prioIdx != ridx) { if (prioIdx >= 0) {
ridx = prioIdx; ridx = prioIdx;
prioIdx = -1; prioIdx = -1;
toneStop(); toneStop();
@ -207,6 +207,7 @@ void AudioQueue::wakeup()
FRESULT result = FR_OK; FRESULT result = FR_OK;
UINT read = 0; UINT read = 0;
if (current.file[1]) { if (current.file[1]) {
pcmFreq = 8000;
wavSamplesBuffer = wavSamplesArray; wavSamplesBuffer = wavSamplesArray;
result = f_open(&wavFile, current.file, FA_OPEN_EXISTING | FA_READ); result = f_open(&wavFile, current.file, FA_OPEN_EXISTING | FA_READ);
if (result == FR_OK) { 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) void AudioQueue::playFile(const char *filename, uint8_t flags)
{ {
#ifndef SIMU #ifdef SIMU
printf("playFile(\"%s\"\n", filename); fflush(stdout);
#else
CoEnterMutexSection(audioMutex); CoEnterMutexSection(audioMutex);
#endif #endif
@ -635,4 +638,5 @@ void pushPrompt(uint16_t prompt)
audioQueue.playFile(filename); audioQueue.playFile(filename);
#endif #endif
} }

View file

@ -78,7 +78,11 @@ class AudioQueue {
bool busy() bool busy()
{ {
#ifdef SIMU
return false;
#else
return (state != AUDIO_SLEEPING); return (state != AUDIO_SLEEPING);
#endif
} }
protected: protected:

View file

@ -1580,7 +1580,7 @@ void playValue(uint8_t idx)
// no break // no break
case NUM_XCHNRAW+TELEM_A1-1: case NUM_XCHNRAW+TELEM_A1-1:
case NUM_XCHNRAW+TELEM_A2-1: case NUM_XCHNRAW+TELEM_A2-1:
idx -= NUM_XCHNRAW+MAX_TIMERS; idx -= (NUM_XCHNRAW+TELEM_A1-1);
// A1 and A2 // A1 and A2
{ {
uint8_t att = 0; uint8_t att = 0;