From: drowe67 Date: Mon, 12 Nov 2012 04:30:48 +0000 (+0000) Subject: fixed bug, can now run soudn card1 at 44kHz X-Git-Url: http://git.whiteaudio.com/gitweb/?a=commitdiff_plain;h=a32b920f629482ed0271ba271176e434191f1a61;p=freetel-svn-tracking.git fixed bug, can now run soudn card1 at 44kHz git-svn-id: https://svn.code.sf.net/p/freetel/code@960 01035d8c-6547-0410-b346-abe4f91aad63 --- diff --git a/fdmdv2/src/fdmdv2_main.cpp b/fdmdv2/src/fdmdv2_main.cpp index 1624223a..220c92b7 100644 --- a/fdmdv2/src/fdmdv2_main.cpp +++ b/fdmdv2/src/fdmdv2_main.cpp @@ -1479,6 +1479,8 @@ int MainFrame::rxCallback( short *wptr = (short*)outputBuffer; // temp buffers re-used by tx and rx processing + // signals in in48k/out48k are at a maximum sample rate of 48k, could be 44.1kHz + // depending on sound hardware. short in8k_short[2*N8]; short in48k_short[2*N48]; @@ -1526,11 +1528,13 @@ int MainFrame::rxCallback( // while we have enough input samples available ... - while (fifo_read(cbData->infifo1, in48k_short, N48) == 0) + int nsam = g_soundCard1SampleRate * (float)N8/FS; + assert(nsam <= N48); + while (fifo_read(cbData->infifo1, in48k_short, nsam) == 0) { int n8k; - n8k = resample(cbData->insrc1, in8k_short, in48k_short, FS, g_soundCard1SampleRate, N8, N48); + n8k = resample(cbData->insrc1, in8k_short, in48k_short, FS, g_soundCard1SampleRate, N8, nsam); fifo_write(cbData->rxinfifo, in8k_short, n8k); resample_for_plot(g_plotDemodInFifo, in8k_short, n8k);