Skip to content

Commit

Permalink
+ small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
DnCraptor committed Dec 12, 2023
1 parent 8bcb46a commit 92b37f6
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/audio/covox.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,14 @@ static volatile uint8_t ssourceptrOut = 0;
static volatile uint8_t free_buff_sz = COVOX_BUF_SZ;

int16_t tickssource() { // core #1
if (ssourceptrIn == ssourceptrOut) { // no bytes in buffer
if (ssourceptrIn == ssourceptrOut && free_buff_sz == 0) { // no bytes in buffer
return 0;
}
port379 = 0; // ready for next byte
register int16_t res = ssourcebuf[ssourceptrOut++];
if (ssourceptrOut >= COVOX_BUF_SZ) {
ssourceptrOut = 0;
}
free_buff_sz++;
return res;
}
Expand All @@ -43,7 +46,7 @@ inline static void putssourcebyte(uint8_t value) { // core #0
return;
}
ssourcebuf[ssourceptrIn++] = value;
if (ssourceptrIn >= 16) {
if (ssourceptrIn >= COVOX_BUF_SZ) {
ssourceptrIn = 0;
}
free_buff_sz--;
Expand Down

0 comments on commit 92b37f6

Please sign in to comment.