Reconfigure STDIN and RTL for TDMA Stereo
Reconfigure STDIN and RTL for TDMA Stereo --adjust configurations and rates to allow two channel audio output when using -T option with RTL and STDIN --minor LRRP print mistake
This commit is contained in:
parent
ea40e3e3b7
commit
4c3a3e0959
|
|
@ -231,6 +231,7 @@ void Process34Data(dsd_opts * opts, dsd_state * state, unsigned char tdibits[98]
|
|||
//fprintf (stderr, "\n Data Blocks [%d]", state->dmr_34_rate_sf[5]);
|
||||
for (short i = 1; i < 60; i++) //find way to get padding so we only go as deep as we need to! changed from 64 to 60 to skip the CRC Bytes for confirmed data
|
||||
{
|
||||
/*
|
||||
if ( state->dmr_34_rate_sf[slot][i] == 0x0C) //Source and Destination info
|
||||
{
|
||||
fprintf (stderr, "\n Source:");
|
||||
|
|
@ -242,6 +243,7 @@ void Process34Data(dsd_opts * opts, dsd_state * state, unsigned char tdibits[98]
|
|||
fprintf (stderr, " [%08d]", (state->dmr_34_rate_sf[slot][i+5] <<16 ) + (state->dmr_34_rate_sf[slot][i+6] << 8) + state->dmr_34_rate_sf[slot][i+7] );
|
||||
fprintf (stderr, " - Port %05d", (state->dmr_34_rate_sf[slot][i+10] << 8) + state->dmr_34_rate_sf[slot][i+11]);
|
||||
}
|
||||
*/
|
||||
if ( state->dmr_34_rate_sf[slot][i] == 0x34 ) //timestamp
|
||||
{
|
||||
fprintf (stderr, "\n LRRP - Timestamp: ");
|
||||
|
|
@ -282,9 +284,10 @@ void Process34Data(dsd_opts * opts, dsd_state * state, unsigned char tdibits[98]
|
|||
//fprintf (stderr, " (");
|
||||
if (state->dmr_34_rate_sf[slot][i+1] & 0x80) //first bit indicates a sign, or hemisphere?
|
||||
{
|
||||
fprintf (stderr, "-");
|
||||
fprintf (stderr, " (-%.5lf, %.5lf)", ((double)lrrplat) * lat_unit , (lrrplon * lon_unit) );
|
||||
//fprintf (stderr, " -");
|
||||
}
|
||||
fprintf (stderr, "%.5lf, %.5lf)", ((double)lrrplat) * lat_unit , (lrrplon * lon_unit) );
|
||||
else fprintf (stderr, " (%.5lf, %.5lf)", ((double)lrrplat) * lat_unit , (lrrplon * lon_unit) );
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1236,9 +1239,9 @@ void Process12Data(dsd_opts * opts, dsd_state * state, uint8_t info[196], uint8_
|
|||
//fprintf (stderr, " (");
|
||||
if (state->dmr_12_rate_sf[slot][i+1] & 0x80) //first bit indicates a sign, or hemisphere?
|
||||
{
|
||||
fprintf (stderr, "-");
|
||||
fprintf (stderr, " (-%.5lf, %.5lf)", ((double)lrrplat) * lat_unit , (lrrplon * lon_unit) );
|
||||
}
|
||||
fprintf (stderr, "%.5lf, %.5lf)", ((double)lrrplat) * lat_unit , (lrrplon * lon_unit) );
|
||||
else fprintf (stderr, " (%.5lf, %.5lf)", ((double)lrrplat) * lat_unit , (lrrplon * lon_unit) );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -351,10 +351,6 @@ writeSynthesizedVoice (dsd_opts * opts, dsd_state * state)
|
|||
short aout_buf[160];
|
||||
short *aout_buf_p;
|
||||
|
||||
// for(n=0; n<160; n++)
|
||||
// fprintf (stderr,"%d ", ((short*)(state->audio_out_temp_buf))[n]);
|
||||
// fprintf (stderr,"\n");
|
||||
|
||||
aout_buf_p = aout_buf;
|
||||
state->audio_out_temp_buf_p = state->audio_out_temp_buf;
|
||||
|
||||
|
|
@ -375,34 +371,6 @@ writeSynthesizedVoice (dsd_opts * opts, dsd_state * state)
|
|||
|
||||
sf_write_short(opts->wav_out_f, aout_buf, 160);
|
||||
|
||||
/*
|
||||
|
||||
int n;
|
||||
short aout_buf[160];
|
||||
short *aout_buf_p;
|
||||
ssize_t result;
|
||||
|
||||
aout_buf_p = aout_buf;
|
||||
state->audio_out_temp_buf_p = state->audio_out_temp_buf;
|
||||
for (n = 0; n < 160; n++)
|
||||
{
|
||||
if (*state->audio_out_temp_buf_p > (float) 32760)
|
||||
{
|
||||
*state->audio_out_temp_buf_p = (float) 32760;
|
||||
}
|
||||
else if (*state->audio_out_temp_buf_p < (float) -32760)
|
||||
{
|
||||
*state->audio_out_temp_buf_p = (float) -32760;
|
||||
}
|
||||
*aout_buf_p = (short) *state->audio_out_temp_buf_p;
|
||||
aout_buf_p++;
|
||||
state->audio_out_temp_buf_p++;
|
||||
}
|
||||
|
||||
result = write (opts->wav_out_fd, aout_buf, 320);
|
||||
fflush (opts->wav_out_f);
|
||||
state->wav_out_bytes += 320;
|
||||
*/
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -419,8 +387,8 @@ playSynthesizedVoice (dsd_opts * opts, dsd_state * state)
|
|||
}
|
||||
else
|
||||
|
||||
//two slot audio testing, still need to seperate channels first internally, but this will play them out of different streams
|
||||
|
||||
//most likely don't need this seperation anymore with L and R, just push it out without any condional checks
|
||||
/*
|
||||
if(state->currentslot == 0 && opts->audio_in_type != 3 && opts->dmr_stereo == 1)
|
||||
{
|
||||
pa_simple_write(opts->pulse_digi_dev_out, (state->audio_out_buf_p - state->audio_out_idx), (state->audio_out_idx * 2), NULL); //Yay! It works.
|
||||
|
|
@ -433,6 +401,10 @@ playSynthesizedVoice (dsd_opts * opts, dsd_state * state)
|
|||
pa_simple_write(opts->pulse_digi_dev_out, (state->audio_out_buf_p - state->audio_out_idx), (state->audio_out_idx * 2), NULL); //Yay! It works.
|
||||
state->audio_out_idx = 0;
|
||||
}
|
||||
*/
|
||||
//Test just sending it straight on since I think I've figured out the STDIN and RTL for Stereo
|
||||
pa_simple_write(opts->pulse_digi_dev_out, (state->audio_out_buf_p - state->audio_out_idx), (state->audio_out_idx * 2), NULL); //Yay! It works.
|
||||
state->audio_out_idx = 0;
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -460,13 +432,16 @@ playSynthesizedVoiceR (dsd_opts * opts, dsd_state * state)
|
|||
//go F yourself PA
|
||||
}
|
||||
else
|
||||
|
||||
//two slot audio testing, still need to seperate channels first internally, but this will play them out of different streams
|
||||
/*
|
||||
//most likely don't need this seperation anymore with L and R, just push it out without any condional checks
|
||||
if(opts->dmr_stereo == 1) //state->currentslot == 1 && opts->audio_in_type != 3 && opts->dmr_stereo == 1
|
||||
{
|
||||
pa_simple_write(opts->pulse_digi_dev_outR, (state->audio_out_buf_pR - state->audio_out_idxR), (state->audio_out_idxR * 2), NULL); //Yay! It works.
|
||||
state->audio_out_idxR = 0;
|
||||
}
|
||||
*/
|
||||
pa_simple_write(opts->pulse_digi_dev_outR, (state->audio_out_buf_pR - state->audio_out_idxR), (state->audio_out_idxR * 2), NULL); //Yay! It works.
|
||||
state->audio_out_idxR = 0;
|
||||
}
|
||||
|
||||
if (state->audio_out_idx2R >= 800000)
|
||||
|
|
|
|||
|
|
@ -503,11 +503,18 @@ liveScanner (dsd_opts * opts, dsd_state * state)
|
|||
|
||||
if (opts->audio_in_type == 1) //if stdin, switch to 8000 and single channel audio
|
||||
{
|
||||
opts->pulse_digi_rate_out = 8000; //stdin needs 8000 output, could have sworn this was working with 48000
|
||||
opts->pulse_digi_rate_out = 8000; //stdin needs 8000 output for single channel
|
||||
opts->pulse_digi_out_channels = 1;
|
||||
if (opts->dmr_stereo == 1)
|
||||
{
|
||||
opts->pulse_digi_rate_out = 4000; //stdin needs 4000 by 2 channel for DMR TDMA Stereo output
|
||||
opts->pulse_digi_out_channels = 2;
|
||||
fprintf (stderr, "STDIN Audio Rate Out set to 4000 Khz/2 Channel \n");
|
||||
}
|
||||
else fprintf (stderr, "STDIN Audio Rate Out set to 8000 Khz/1 Channel \n");
|
||||
opts->pulse_raw_rate_out = 48000;
|
||||
opts->pulse_raw_out_channels = 1;
|
||||
fprintf (stderr, "STDIN Audio Rate Out set to 8000 Khz/1 Channel \n");
|
||||
|
||||
}
|
||||
|
||||
#ifdef USE_PORTAUDIO
|
||||
|
|
@ -526,11 +533,19 @@ if (opts->audio_in_type == 1) //if stdin, switch to 8000 and single channel audi
|
|||
#ifdef USE_RTLSDR
|
||||
if(opts->audio_in_type == 3)
|
||||
{
|
||||
opts->pulse_digi_rate_out = 8000; //if rtl, switch to 8000 and 1 channel
|
||||
//test to see if this is still necessary
|
||||
opts->pulse_digi_rate_out = 8000; //rtl needs 8000 and 1 channel is mono system
|
||||
opts->pulse_digi_out_channels = 1;
|
||||
if (opts->dmr_stereo == 1)
|
||||
{
|
||||
opts->pulse_digi_rate_out = 4000; //rtl needs 4000 by 2 channel for DMR TDMA Stereo output
|
||||
opts->pulse_digi_out_channels = 2;
|
||||
fprintf (stderr, "RTL Audio Rate Out set to 4000 Khz/2 Channel \n");
|
||||
}
|
||||
else fprintf (stderr, "RTL Audio Rate Out set to 8000 Khz/1 Channel \n");
|
||||
opts->pulse_raw_rate_out = 48000;
|
||||
opts->pulse_raw_out_channels = 1;
|
||||
fprintf (stderr, "RTL Audio Rate Out set to 8000 Khz/1 Channel \n");
|
||||
|
||||
open_rtlsdr_stream(opts);
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -94,6 +94,7 @@ getSymbol (dsd_opts * opts, dsd_state * state, int have_sync)
|
|||
}
|
||||
else if (opts->audio_in_type == 1) {
|
||||
result = sf_read_short(opts->audio_in_file, &sample, 1);
|
||||
//fprintf (stderr, "..");
|
||||
if (opts->monitor_input_audio == 1 && state->lastsynctype == -1 && sample < 32767 && sample > -32767)
|
||||
{
|
||||
state->pulse_raw_out_buffer = sample; //steal raw out buffer sample here?
|
||||
|
|
|
|||
Loading…
Reference in New Issue