Skip to content

Commit 7685502

Browse files
committed
reduce phase shiift between subsequent tone buffers
1 parent 7463853 commit 7685502

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

audio_ptt.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ static void * ptt_thread (void *arg)
106106
if (err == 0) {
107107
short* pnData;
108108
short sample;
109-
int nSamples = save_audio_config_p->adev[a].samples_per_sec / 5;
109+
int nSamples = (int)( ( (double)save_audio_config_p->adev[a].samples_per_sec / (double)freq ) * ceil( (double)freq / 5.0 ) );
110110
int nBufferLength = save_audio_config_p->adev[a].num_channels * nSamples * sizeof(short);
111111
int i;
112112
int j;
@@ -198,7 +198,7 @@ static void * ptt_thread (void *arg)
198198
int i;
199199
int j;
200200

201-
nSamples = samples_per_sec / 5;
201+
nSamples = (int)( ( (double)samples_per_sec / (double)freq ) * ceil( (double)freq / 5.0 ) );
202202
nBufferLength = num_channels * nSamples * sizeof(short);
203203
pnData = (short*)malloc (nBufferLength);
204204

config.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1591,7 +1591,7 @@ void config_init (char *fname, struct audio_s *p_audio_config,
15911591
dw_printf ("Config file line %d: %s with RIG is only available when hamlib support is enabled.\n", line, otname);
15921592
#endif
15931593
}
1594-
else if (strcasecmp( t, "CHANNEL") == 0) {
1594+
else if (strcasecmp(t, "CHANNEL") == 0) {
15951595
t = split(NULL, 0);
15961596
if (t == NULL) {
15971597
text_color_set( DW_COLOR_ERROR );

ptt.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1138,15 +1138,17 @@ void ptt_term (void)
11381138
}
11391139

11401140
for (n = 0; n < MAX_CHANS; n++) {
1141-
if (save_audio_config_p->achan[n].octrl[OCTYPE_PTT].ptt_method == PTT_METHOD_AUDIO) {
1141+
if (save_audio_config_p->achan[n].valid) {
1142+
if (save_audio_config_p->achan[n].octrl[OCTYPE_PTT].ptt_method == PTT_METHOD_AUDIO) {
11421143
#ifdef __WIN32__
1143-
SetEvent (save_audio_config_p->achan[n].octrl[OCTYPE_PTT].ptt_close) ;
1144+
SetEvent (save_audio_config_p->achan[n].octrl[OCTYPE_PTT].ptt_close) ;
11441145
#else
1145-
pthread_mutex_lock (&save_audio_config_p->achan[n].octrl[OCTYPE_PTT].ptt_mutex);
1146-
save_audio_config_p->achan[n].octrl[OCTYPE_PTT].ptt_state = PTT_AUDIO_STATE_CLOSE;
1147-
pthread_cond_signal (&save_audio_config_p->achan[n].octrl[OCTYPE_PTT].ptt_condition);
1148-
pthread_mutex_unlock (&save_audio_config_p->achan[n].octrl[OCTYPE_PTT].ptt_mutex);
1146+
pthread_mutex_lock (&save_audio_config_p->achan[n].octrl[OCTYPE_PTT].ptt_mutex);
1147+
save_audio_config_p->achan[n].octrl[OCTYPE_PTT].ptt_state = PTT_AUDIO_STATE_CLOSE;
1148+
pthread_cond_signal (&save_audio_config_p->achan[n].octrl[OCTYPE_PTT].ptt_condition);
1149+
pthread_mutex_unlock (&save_audio_config_p->achan[n].octrl[OCTYPE_PTT].ptt_mutex);
11491150
#endif
1151+
}
11501152
}
11511153
}
11521154

0 commit comments

Comments
 (0)