Skip to content

Commit

Permalink
bugfix on low frequency interpolation, i.e. skyroads.
Browse files Browse the repository at this point in the history
  • Loading branch information
crazii committed Feb 5, 2024
1 parent 880ddfa commit 082418e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1128,6 +1128,7 @@ static void MAIN_Interrupt()
BOOL digital = SBEMU_HasStarted();
int dma = (SBEMU_GetBits() <= 8 || MAIN_Options[OPT_TYPE].value < 6) ? SBEMU_GetDMA() : SBEMU_GetHDMA();
int32_t DMA_Count = VDMA_GetCounter(dma); //count in bytes
if(!digital) MAIN_LastSBRate = 0;
if(digital)//&& DMA_Count != 0x10000) //-1(0xFFFF)+1=0
{
uint32_t DMA_Addr = VDMA_GetAddress(dma);
Expand Down Expand Up @@ -1167,7 +1168,7 @@ static void MAIN_Interrupt()
int count = samples-pos;
BOOL resample = TRUE; //don't resample if sample rates are close
if(SB_Rate < aui.freq_card-50)
count = max(1, count*SB_Rate/aui.freq_card);
count = max(min(2,count), count*SB_Rate/aui.freq_card); //need at least 2 for interpolation
else if(SB_Rate > aui.freq_card+50)
count = count*SB_Rate/aui.freq_card;
else
Expand Down

0 comments on commit 082418e

Please sign in to comment.