DMR Stereo Audio and Timing Tweaks

--Tweak Naming of DMR Stereo output streams, giving them unique names so that the pulse audio server will remember their audio levels and left and right channel configurations on subsequent start ups.

--Tweak timing of events inside of the DMR BS Stereo Method
This commit is contained in:
lwvmobile 2022-06-12 11:58:03 -04:00 committed by GitHub
parent 806fe955cb
commit d89507ebde
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 39 additions and 28 deletions

View File

@ -273,7 +273,7 @@ void dmrBS (dsd_opts * opts, dsd_state * state)
else fprintf (stderr,"Sync: -DMR ");
//constantly reset the vc counter to 1 each data frame in anticipation of new voice frame
vc1 = 1;
state->dropL = 256;
//state->dropL = 256;
}
if (internalslot == 1)
{
@ -287,7 +287,7 @@ void dmrBS (dsd_opts * opts, dsd_state * state)
else fprintf (stderr,"Sync: -DMR ");
//constantly reset the vc counter to 1 each data frame in anticipation of new voice frame
vc2 = 1;
state->dropR = 256;
//state->dropR = 256;
}
processDMRdata (opts, state);
skipcount++; //after 2 data frames, drop back to getFrameSync and process subsequent data with processDMRdata
@ -324,11 +324,12 @@ void dmrBS (dsd_opts * opts, dsd_state * state)
fprintf(stderr, " BPK %lld", state->K);
fprintf (stderr, "%s", KNRM);
}
//the condition below should be swapped to vc6 and not on vc1, placement after processMbeFrame
if (vc1 == 1 && state->payload_algid != 0 && opts->payload == 1)
{
LFSR(state);
//LFSR(state); //placement here causes issues when second slot becomes active as well
}
fprintf (stderr, "\n");
//fprintf (stderr, "\n");
}
else
{
@ -339,11 +340,12 @@ void dmrBS (dsd_opts * opts, dsd_state * state)
fprintf(stderr, " BPK %lld", state->K);
fprintf (stderr, "%s", KNRM);
}
//the condition below should be swapped to vc6 and not on vc1, placement after processMbeFrame
if (vc1 == 1 && state->payload_algid != 0 && opts->payload == 1)
{
LFSR(state);
//LFSR(state); //placement here causes issues when second slot becomes active as well
}
fprintf (stderr, "\n");
//fprintf (stderr, "\n");
}
}
@ -359,11 +361,12 @@ void dmrBS (dsd_opts * opts, dsd_state * state)
fprintf(stderr, " BPK %lld", state->K);
fprintf (stderr, "%s", KNRM);
}
//the condition below should be swapped to vc6 and not on vc1, placement after processMbeFrame
if (vc2 == 1 && state->payload_algidR != 0 && opts->payload == 1)
{
LFSR(state);
//LFSR(state);
}
fprintf (stderr, "\n");
//fprintf (stderr, "\n");
}
else
{
@ -374,11 +377,12 @@ void dmrBS (dsd_opts * opts, dsd_state * state)
fprintf(stderr, " BPK %lld", state->K);
fprintf (stderr, "%s", KNRM);
}
//the condition below should be swapped to vc6 and not on vc1, placement after processMbeFrame
if (vc2 == 1 && state->payload_algidR != 0 && opts->payload == 1)
{
LFSR(state);
//LFSR(state);
}
fprintf (stderr, "\n");
//fprintf (stderr, "\n");
}
}
if (internalslot == 0 && vc1 == 6) //presumably when full (and no sync issues)
@ -387,6 +391,7 @@ void dmrBS (dsd_opts * opts, dsd_state * state)
ProcessVoiceBurstSync(opts, state);
fprintf (stderr, "\n");
}
if (internalslot == 1 && vc2 == 6) //presumably when full (and no sync issues)
{
//process voice burst
@ -464,29 +469,33 @@ void dmrBS (dsd_opts * opts, dsd_state * state)
processMbeFrame (opts, state, NULL, ambe_fr, NULL);
processMbeFrame (opts, state, NULL, ambe_fr2, NULL);
processMbeFrame (opts, state, NULL, ambe_fr3, NULL);
/*
if (internalslot == 0 ) //&& vc1 == 6
//We only want to run LFSR after processing VC6 frames and before rolling
//back to VC1, otherwise we will incur an unwanted LFSR if voice becomes active
//in both slots while in this loop
if (internalslot == 0 && vc1 == 6)
{
fprintf (stderr, "\nVC%d Full = ", vc1);
for (k = 0; k < 144;)
state->dropL = 256;
//if (vc1 == 1 && state->payload_algid != 0 && opts->payload == 1)
if (state->payload_algid != 0 && opts->payload == 1)
{
fprintf (stderr, "%X", ((state->dmr_stereo_payload[k] << 2) + state->dmr_stereo_payload[k+1]) );
k = k + 2;
LFSR(state);
fprintf (stderr, "\n");
}
fprintf (stderr, "\n");
}
if (internalslot == 1 ) //&& vc2 == 6
if (internalslot == 1 && vc2 == 6)
{
fprintf (stderr, "\nVC%d Full = ", vc2);
for (k = 0; k < 144;)
state->dropR = 256;
if (state->payload_algidR != 0 && opts->payload == 1)
{
//fprintf (stderr, " L%X R%X ", state->dmr_stereo_payload[k], state->dmr_stereo_payload[k+1]);
fprintf (stderr, "%01X", ((state->dmr_stereo_payload[k] << 2) + state->dmr_stereo_payload[k+1]) );
k = k + 2;
LFSR(state);
fprintf (stderr, "\n");
}
fprintf (stderr, "\n");
}
*/
if (internalslot == 0)
{
vc1++;
@ -549,7 +558,9 @@ void dmrBS (dsd_opts * opts, dsd_state * state)
state->dmr_stereo = 0;
state->errs2R = 0;
state->errs2 = 0;
//
//
}
//Process buffered half frame and 2nd half and then jump to full BS decoding

View File

@ -49,8 +49,8 @@ void openPulseOutput(dsd_opts * opts)
}
if (opts->dmr_stereo == 1)
{
opts->pulse_digi_dev_out = pa_simple_new(NULL, "DSD-FME", PA_STREAM_PLAYBACK, NULL, "DMR/MOTOTRBO LEFT", &tt, left, NULL, NULL);
opts->pulse_digi_dev_outR = pa_simple_new(NULL, "DSD-FME", PA_STREAM_PLAYBACK, NULL, "DMR/MOTOTRBO RIGHT", &tt, right, NULL, NULL);
opts->pulse_digi_dev_out = pa_simple_new(NULL, "DSD-FME1", PA_STREAM_PLAYBACK, NULL, "DMR/MOTOTRBO SLOT 1", &tt, left, NULL, NULL);
opts->pulse_digi_dev_outR = pa_simple_new(NULL, "DSD-FME2", PA_STREAM_PLAYBACK, NULL, "DMR/MOTOTRBO SLOT 2", &tt, right, NULL, NULL);
}
}
@ -158,7 +158,7 @@ processAudio (dsd_opts * opts, dsd_state * state)
state->audio_out_temp_buf_p = state->audio_out_temp_buf;
//we only want to upsample when using sample rates greater than 8k for output,
//hard set to 8k for RTL mono and MBE playback, otherwise crackling may occur.
if (opts->pulse_digi_rate_out > 8000)
if (opts->pulse_digi_rate_out > 8000)
{
for (n = 0; n < 160; n++)
{