Skip to content

Update Makefile #76

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 12 commits into from
Prev Previous commit
Next Next commit
cleanup ptt audio thread when application closed
  • Loading branch information
va7yaa committed Jan 13, 2017
commit aa5176e7b43cce014b3077ac7fab6f8f2d124825
5 changes: 3 additions & 2 deletions audio_ptt_win.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
#include <io.h>
#include <fcntl.h>
#include <math.h>
#include <limits.h>

#include <windows.h>
#include <mmsystem.h>
Expand Down Expand Up @@ -115,13 +116,13 @@ unsigned __stdcall ptt_thread (void *arg)

if( save_audio_config_p->adev[a].num_channels == 1 ) {
for( i = 0; i < nsamples; i++ ) {
sample = (SHORT)( 32000.0 * sin( ( (double)i / (double)nsamples ) * 2.0 * M_PI ) );
sample = (SHORT)( (double)SHRT_MAX * sin( ( (double)i / (double)nsamples ) * 2.0 * M_PI ) );
pnData[i] = sample;
}
}
else {
for( i = 0; i < nsamples; i++ ) {
sample = (SHORT)( 32000.0 * sin( ( (double)i / (double)nsamples ) * 2.0 * M_PI ) );
sample = (SHORT)( (double)SHRT_MAX * sin( ( (double)i / (double)nsamples ) * 2.0 * M_PI ) );
if( channel == ADEVFIRSTCHAN( a ) ) {

// Stereo, left channel.
Expand Down
6 changes: 6 additions & 0 deletions config.c
Original file line number Diff line number Diff line change
Expand Up @@ -668,6 +668,12 @@ void config_init (char *fname, struct audio_s *p_audio_config,
p_audio_config->achan[channel].octrl[ot].ptt_invert2 = 0;
p_audio_config->achan[channel].octrl[ot].ptt_channel = 0;
p_audio_config->achan[channel].octrl[ot].ptt_frequency = PTT_FREQ_DEFAULT;
#ifdef __WIN32__
p_audio_config->achan[channel].octrl[ot].ptt_start = NULL;
p_audio_config->achan[channel].octrl[ot].ptt_stop = NULL;
p_audio_config->achan[channel].octrl[ot].ptt_close = NULL;
#else
#endif
}

p_audio_config->achan[channel].dwait = DEFAULT_DWAIT;
Expand Down
18 changes: 17 additions & 1 deletion ptt.c
Original file line number Diff line number Diff line change
Expand Up @@ -1008,18 +1008,24 @@ void ptt_set (int ot, int chan, int ptt_signal)
}
#endif

/*
* Using audio channel?
*/

if( save_audio_config_p->achan[chan].octrl[ot].ptt_method == PTT_METHOD_AUDIO ) {
if( ptt_signal ) {
#ifdef __WIN32__
SetEvent( save_audio_config_p->achan[chan].octrl[ot].ptt_start );
#else

#endif
}
else
{
#ifdef __WIN32__
SetEvent( save_audio_config_p->achan[chan].octrl[ot].ptt_stop );
#else

#endif
}
}
Expand Down Expand Up @@ -1110,7 +1116,7 @@ void ptt_term (void)
ptt_set (ot, n, 0);
}
}
}
}

for (n = 0; n < MAX_CHANS; n++) {
if (save_audio_config_p->achan[n].valid) {
Expand All @@ -1128,6 +1134,16 @@ void ptt_term (void)
}
}

for (n = 0; n < MAX_CHANS; n++) {
if (save_audio_config_p->achan[n].octrl[OCTYPE_PTT].ptt_method == PTT_METHOD_AUDIO) {
#ifdef __WIN32__
SetEvent (save_audio_config_p->achan[n].octrl[OCTYPE_PTT].ptt_close) ;
#else

#endif
}
}

#ifdef USE_HAMLIB

for (n = 0; n < MAX_CHANS; n++) {
Expand Down