reduce phase shiift between subsequent tone buffers

This commit is contained in:
Andrew 2017-01-17 13:18:14 -08:00
parent 7463853757
commit 7685502c9b
3 changed files with 11 additions and 9 deletions

View File

@ -106,7 +106,7 @@ static void * ptt_thread (void *arg)
if (err == 0) { if (err == 0) {
short* pnData; short* pnData;
short sample; short sample;
int nSamples = save_audio_config_p->adev[a].samples_per_sec / 5; int nSamples = (int)( ( (double)save_audio_config_p->adev[a].samples_per_sec / (double)freq ) * ceil( (double)freq / 5.0 ) );
int nBufferLength = save_audio_config_p->adev[a].num_channels * nSamples * sizeof(short); int nBufferLength = save_audio_config_p->adev[a].num_channels * nSamples * sizeof(short);
int i; int i;
int j; int j;
@ -198,7 +198,7 @@ static void * ptt_thread (void *arg)
int i; int i;
int j; int j;
nSamples = samples_per_sec / 5; nSamples = (int)( ( (double)samples_per_sec / (double)freq ) * ceil( (double)freq / 5.0 ) );
nBufferLength = num_channels * nSamples * sizeof(short); nBufferLength = num_channels * nSamples * sizeof(short);
pnData = (short*)malloc (nBufferLength); pnData = (short*)malloc (nBufferLength);

2
ptt.c
View File

@ -1138,6 +1138,7 @@ void ptt_term (void)
} }
for (n = 0; n < MAX_CHANS; n++) { for (n = 0; n < MAX_CHANS; n++) {
if (save_audio_config_p->achan[n].valid) {
if (save_audio_config_p->achan[n].octrl[OCTYPE_PTT].ptt_method == PTT_METHOD_AUDIO) { if (save_audio_config_p->achan[n].octrl[OCTYPE_PTT].ptt_method == PTT_METHOD_AUDIO) {
#ifdef __WIN32__ #ifdef __WIN32__
SetEvent (save_audio_config_p->achan[n].octrl[OCTYPE_PTT].ptt_close) ; SetEvent (save_audio_config_p->achan[n].octrl[OCTYPE_PTT].ptt_close) ;
@ -1149,6 +1150,7 @@ void ptt_term (void)
#endif #endif
} }
} }
}
#ifdef USE_HAMLIB #ifdef USE_HAMLIB