mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2025-05-24 18:32:27 -04:00
- Clean up zero of null sound buffer for write and clean up logic
git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/trunk@109 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
parent
78c9bb6585
commit
c3ab5968fa
11
start_oss.c
11
start_oss.c
@ -7,6 +7,7 @@
|
|||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <sys/soundcard.h>
|
#include <sys/soundcard.h>
|
||||||
#include "conf.h"
|
#include "conf.h"
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#define AUDIOBUFSIZE 4096
|
#define AUDIOBUFSIZE 4096
|
||||||
#define FRAMESPERBUFFER 1024
|
#define FRAMESPERBUFFER 1024
|
||||||
@ -251,16 +252,18 @@ oss_loop(int *iarg)
|
|||||||
stime = (double) tv.tv_sec + ((double)tv.tv_usec / 1000000.0) +
|
stime = (double) tv.tv_sec + ((double)tv.tv_usec / 1000000.0) +
|
||||||
*(data.ndsec) * 0.1;
|
*(data.ndsec) * 0.1;
|
||||||
*(data.Tsec) = stime;
|
*(data.Tsec) = stime;
|
||||||
|
|
||||||
if(*(data.TxOK) && (!TxOKz)) {
|
if(*(data.TxOK) && (!TxOKz)) {
|
||||||
n=nsec/(*(data.trperiod));
|
n=nsec/(*(data.trperiod));
|
||||||
ic = (int)(stime - *(data.trperiod)*n) * data.nfs;
|
ic = (int)(stime - *(data.trperiod)*n) * data.nfs;
|
||||||
ic = ic % *(data.nwave);
|
ic = ic % *(data.nwave);
|
||||||
}
|
}
|
||||||
|
|
||||||
TxOKz = *(data.TxOK);
|
TxOKz = *(data.TxOK);
|
||||||
*(data.Transmitting) = *(data.TxOK);
|
*(data.Transmitting) = *(data.TxOK);
|
||||||
wptr = (int16_t *)tx_buf; /* XXX */
|
wptr = (int16_t *)tx_buf; /* XXX */
|
||||||
for(i=0 ; i<FRAMESPERBUFFER; i++ ) {
|
|
||||||
if(*(data.TxOK)) {
|
if(*(data.TxOK)) {
|
||||||
|
for(i=0 ; i<FRAMESPERBUFFER; i++ ) {
|
||||||
n2 = data.iwave[ic];
|
n2 = data.iwave[ic];
|
||||||
addnoise_(&n2);
|
addnoise_(&n2);
|
||||||
*wptr++ = n2; /* left */
|
*wptr++ = n2; /* left */
|
||||||
@ -272,10 +275,8 @@ oss_loop(int *iarg)
|
|||||||
*(data.TxOK) = 0;
|
*(data.TxOK) = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
} else {
|
||||||
*wptr++ = 0; /* left */
|
memset(tx_buf, 0, AUDIOBUFSIZE);
|
||||||
*wptr++ = 0; /* right */
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (write(data.fd_out, tx_buf, AUDIOBUFSIZE) < 0) {
|
if (write(data.fd_out, tx_buf, AUDIOBUFSIZE) < 0) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user