EDACS Tweaks to Analog Call Handling;

This commit is contained in:
lwvmobile
2023-08-08 00:46:20 -04:00
parent afa329b5e4
commit 6f9fba9fbf
4 changed files with 33 additions and 34 deletions

View File

@@ -26,10 +26,8 @@ pa_sample_spec ff; //float
void closePulseOutput (dsd_opts * opts)
{
pa_simple_free (opts->pulse_digi_dev_out);
// if (opts->dmr_stereo == 1)
// {
// pa_simple_free (opts->pulse_digi_dev_outR);
// }
if (opts->frame_provoice == 1) //EDACS analog calls
pa_simple_free (opts->pulse_raw_dev_out);
}
void closePulseInput (dsd_opts * opts)
@@ -52,26 +50,19 @@ void openPulseOutput(dsd_opts * opts)
ff.channels = opts->pulse_digi_out_channels;
ff.rate = opts->pulse_digi_rate_out;
if (opts->monitor_input_audio == 1)
{
opts->pulse_raw_dev_out = pa_simple_new(NULL, "DSD-FME3", PA_STREAM_PLAYBACK, NULL, "Raw Audio Out", &ss, NULL, NULL, NULL);
}
//reconfigured to open when using edacs so we can have a analog audio out that runs at 48k1 and not 8k1 float/short
if (opts->frame_provoice == 1)
opts->pulse_raw_dev_out = pa_simple_new(NULL, "DSD-FME3", PA_STREAM_PLAYBACK, NULL, "EDACS/Analog", &ss, NULL, NULL, NULL);
pa_channel_map* fl = 0; //NULL and 0 are same in this context
pa_channel_map* ss = 0; //NULL and 0 are same in this context
if (opts->floating_point == 0)
{
opts->pulse_digi_dev_out = pa_simple_new(NULL, "DSD-FME", PA_STREAM_PLAYBACK, NULL, opts->output_name, &tt, ss, NULL, NULL);
}
if (opts->floating_point == 1)
{
opts->pulse_digi_dev_out = pa_simple_new(NULL, "DSD-FME", PA_STREAM_PLAYBACK, NULL, opts->output_name, &ff, fl, NULL, NULL);
}
}
void openPulseInput(dsd_opts * opts)
@@ -168,6 +159,10 @@ void openOSSOutput (dsd_opts * opts)
fprintf (stderr, "ioctl channel error \n");
}
//if using split with OSS output, and using EDACS w/ Analog, we have to use 48k
if (opts->frame_provoice == 1)
opts->pulse_digi_rate_out = 48000;
speed = opts->pulse_digi_rate_out; //since we have split input/output, we want to mirror pulse rate out
fmt = speed; //output rate
if (ioctl (opts->audio_out_fd, SNDCTL_DSP_SPEED, &fmt) < 0)

View File

@@ -1997,7 +1997,7 @@ main (int argc, char **argv)
opts.mod_qpsk = 0;
opts.mod_gfsk = 1;
state.rf_mod = 2;
opts.pulse_digi_rate_out = 48000;
opts.pulse_digi_rate_out = 8000;
opts.pulse_digi_out_channels = 1;
opts.dmr_stereo = 0;
opts.dmr_mono = 0;

View File

@@ -387,7 +387,9 @@ void print_menuc(WINDOW *menu_win, int highlight)
void ncursesOpen (dsd_opts * opts, dsd_state * state)
{
UNUSED2(opts, state);
//this is primarily used to push a quick audio blip through OSS so it will show up in the mixer immediately
if (opts->audio_out_type == 2 || opts->audio_out_type == 5)
beeper (opts, state, 0);
// state->menuopen = 1; //flag the menu is open, stop processing getFrameSync
mbe_printVersion (versionstr);
@@ -2308,6 +2310,12 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state)
printw (" \n");
}
if (opts->audio_out_type == 0 && opts->frame_provoice == 1)
{
printw ("| Pulse Audio Output: %i kHz; %i Ch; RMS: %04d Analog", opts->pulse_raw_rate_out/1000, opts->pulse_raw_out_channels, opts->rtl_rms);
printw (" \n");
}
if (opts->audio_out_type == 5 || opts->audio_out_type == 2)
{
printw ("| OSS Audio Output: %i kHz; %i Ch; G: %02.0f%%", opts->pulse_digi_rate_out/1000, opts->pulse_digi_out_channels, state->aout_gain*2);

View File

@@ -91,7 +91,7 @@ long int gen_rms(short *samples, int len, int step)
}
//listening to and playing back analog audio
void edacs_analog(dsd_opts * opts, dsd_state * state)
void edacs_analog(dsd_opts * opts, dsd_state * state, int afs, unsigned char lcn)
{
int i;
@@ -188,28 +188,24 @@ void edacs_analog(dsd_opts * opts, dsd_state * state)
}
#endif
if (opts->audio_out_type == 0 && opts->floating_point == 0 && opts->slot1_on == 1)
//reconfigured to use seperate audio out stream that is always 48k short
if (opts->audio_out_type == 0 && opts->slot1_on == 1)
{
pa_simple_write(opts->pulse_digi_dev_out, analog1, 960*2, NULL);
pa_simple_write(opts->pulse_digi_dev_out, analog2, 960*2, NULL);
pa_simple_write(opts->pulse_digi_dev_out, analog3, 960*2, NULL);
pa_simple_write(opts->pulse_raw_dev_out, analog1, 960*2, NULL);
pa_simple_write(opts->pulse_raw_dev_out, analog2, 960*2, NULL);
pa_simple_write(opts->pulse_raw_dev_out, analog3, 960*2, NULL);
}
//added a condition check so that if OSS output and 8K, switches to 48K when opening OSS
if (opts->audio_out_type == 5 && opts->floating_point == 0 && opts->slot1_on == 1)
{
write (opts->audio_out_fd, analog1, 960*2);
write (opts->audio_out_fd, analog1, 960*2);
write (opts->audio_out_fd, analog1, 960*2);
write (opts->audio_out_fd, analog2, 960*2);
write (opts->audio_out_fd, analog3, 960*2);
}
opts->rtl_rms = rms;
//NOTE: On really busy EDACS systems, this could end up being incorrect if we decode an extra frame or two
//before tuning and setting due to slight tuner lag and another frame has another call in it
int afs = state->lastsrc;
int a = afs >> 7;
int fs = afs & 0x7F;
int lcn = state->edacs_vc_lcn;
printFrameSync (opts, state, " EDACS", 0, "A");
@@ -218,7 +214,7 @@ void edacs_analog(dsd_opts * opts, dsd_state * state)
fprintf (stderr, " Analog RMS: %04ld SQL: %ld", rms, sql);
if (afs != 0)
fprintf (stderr, " AFS [0x%03X] [%02d-%03d] LCN [%02d]", afs, a, fs, lcn);
fprintf (stderr, " AFS [0x%03X] [%02d-%03d] LCN [%02d]", afs, afs >> 7, afs & 0x7F, lcn);
fprintf (stderr, "%s", KNRM);
@@ -494,7 +490,7 @@ void edacs(dsd_opts * opts, dsd_state * state)
state->edacs_tuned_lcn = lcn;
opts->p25_is_tuned = 1;
//debug testing (since I don't have EDACS standard w/ Analog nearby)
// edacs_analog(opts, state);
// edacs_analog(opts, state, group, lcn);
}
if (opts->audio_in_type == 3) //rtl dongle
@@ -504,7 +500,7 @@ void edacs(dsd_opts * opts, dsd_state * state)
state->edacs_tuned_lcn = lcn;
opts->p25_is_tuned = 1;
//debug testing (since I don't have EDACS standard w/ Analog nearby)
// edacs_analog(opts, state);
// edacs_analog(opts, state, group, lcn);
#endif
}
@@ -636,7 +632,7 @@ void edacs(dsd_opts * opts, dsd_state * state)
SetFreq(opts->rigctl_sockfd, state->trunk_lcn_freq[lcn-1]); //minus one because our index starts at zero
state->edacs_tuned_lcn = lcn;
opts->p25_is_tuned = 1;
if (command == 0xEE) edacs_analog(opts, state);
if (command == 0xEE) edacs_analog(opts, state, afs, lcn);
}
if (opts->audio_in_type == 3) //rtl dongle
@@ -645,7 +641,7 @@ void edacs(dsd_opts * opts, dsd_state * state)
rtl_dev_tune (opts, state->trunk_lcn_freq[lcn-1]);
state->edacs_tuned_lcn = lcn;
opts->p25_is_tuned = 1;
if (command == 0xEE) edacs_analog(opts, state);
if (command == 0xEE) edacs_analog(opts, state, afs, lcn);
#endif
}
}