Fixed several problems in playback_callback (start_threads.c).

Reverted to display of full Tx message in status bar (wsjt.py).


git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/trunk@47 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Joe Taylor 2006-01-05 15:33:56 +00:00
parent a5f1469127
commit 5f5e711917
2 changed files with 24 additions and 7 deletions

View File

@ -41,6 +41,7 @@ typedef struct alsa_driver_s {
int tx_offset; int tx_offset;
int *tr_period; int *tr_period;
int *nwave; int *nwave;
int *nmode;
int *transmitting; int *transmitting;
snd_pcm_uframes_t buffer_size; snd_pcm_uframes_t buffer_size;
@ -326,13 +327,16 @@ int playback_callback(alsa_driver_t *alsa_driver_playback) {
struct timeval tv; struct timeval tv;
double stime; double stime;
int nsec; int nsec;
int n; int i,n;
static int ic;
int16_t b0[2048];
// printf("playback callback\n"); // printf("playback callback\n");
gettimeofday(&tv, NULL); gettimeofday(&tv, NULL);
stime = (double) tv.tv_sec + ((double)tv.tv_usec / 1000000.0); stime = (double) tv.tv_sec + ((double)tv.tv_usec / 1000000.0) +
*(this->ndsec) * 0.1;
*(this->Tsec) = stime; *(this->Tsec) = stime;
if(!(this->tx_starting) && (*(this->tx_ok)) ) { if(!(this->tx_starting) && (*(this->tx_ok)) ) {
int ic;
nsec = (int)stime; nsec = (int)stime;
n = nsec / *(this->tr_period); n = nsec / *(this->tr_period);
ic = (int)(stime - *(this->tr_period) * n) * this->output_sample_rate; ic = (int)(stime - *(this->tr_period) * n) * this->output_sample_rate;
@ -341,10 +345,22 @@ int playback_callback(alsa_driver_t *alsa_driver_playback) {
} }
this->tx_starting = *(this->tx_ok); this->tx_starting = *(this->tx_ok);
*(this->transmitting) = *(this->tx_ok); *(this->transmitting) = *(this->tx_ok);
if(*(this->tx_ok)) { if(*(this->tx_ok)) {
/*
alsa_playback_buffers[0] = this->app_buffer_y1 + this->tx_offset; alsa_playback_buffers[0] = this->app_buffer_y1 + this->tx_offset;
alsa_playback_buffers[1] = this->app_buffer_y1 + this->tx_offset; alsa_playback_buffers[1] = this->app_buffer_y1 + this->tx_offset;
*/
alsa_playback_buffers[0] = b0;
alsa_playback_buffers[1] = b0;
for(i=0; i<this->period_size; i++) {
b0[i]=this->app_buffer_y1[ic];
ic++;
if(ic >= *this->nwave) {
ic=ic % *this->nwave;
if(*this->nmode == 2)
*this->tx_ok=0;
}
}
} else { } else {
alsa_playback_buffers[0] = zero_buffer; alsa_playback_buffers[0] = zero_buffer;
alsa_playback_buffers[1] = zero_buffer; alsa_playback_buffers[1] = zero_buffer;
@ -502,8 +518,9 @@ int start_threads_(int *ndevin, int *ndevout, short y1[], short y2[],
alsa_driver_playback.tx_ok = TxOK; alsa_driver_playback.tx_ok = TxOK;
alsa_driver_playback.tr_period = TRPeriod; alsa_driver_playback.tr_period = TRPeriod;
alsa_driver_playback.nwave = nwave; alsa_driver_playback.nwave = nwave;
alsa_driver_playback.nmode = nmode;
alsa_driver_playback.transmitting = Transmitting; alsa_driver_playback.transmitting = Transmitting;
alsa_driver_capture.ndsec=ndsec; alsa_driver_playback.ndsec = ndsec;
printf("start threads called\n"); printf("start threads called\n");
iret1 = pthread_create(&thread1,NULL,decode1_,&iarg1); iret1 = pthread_create(&thread1,NULL,decode1_,&iarg1);

View File

@ -1300,8 +1300,8 @@ def update():
nmsg=int(Audio.gcom2.nmsg) nmsg=int(Audio.gcom2.nmsg)
t=g.ftnstr(Audio.gcom2.sending) t=g.ftnstr(Audio.gcom2.sending)
if t[:3]=="CQ ": nsked.set(0) if t[:3]=="CQ ": nsked.set(0)
# t="Transmitting: "+t[:nmsg] t="Transmitting: "+t[:nmsg]
t="Transmitting: " # t="Transmitting: "
# t="Txing: "+t[:nmsg] # t="Txing: "+t[:nmsg]
bgcolor='yellow' bgcolor='yellow'
if Audio.gcom2.sendingsh==1: bgcolor='#66FFFF' if Audio.gcom2.sendingsh==1: bgcolor='#66FFFF'