Fix Raw Audio Monitoring

Fix Raw Audio Monitoring
--Still crashes Pulse Audio server on Ubuntu/Linux Mint
--PULSE_LATENCY_MSEC=1000 or high value mitigates problem for brief moment, but still crashes
---Issue with Latency, or maybe writing garbage values to pa_simple_write
General Code Cleanup
Tweak NCURSES Printer
Tweak STDERR Printouts
This commit is contained in:
lwvmobile
2022-04-02 14:24:47 -04:00
committed by GitHub
parent ab29dd8e6a
commit 7c461844ad
12 changed files with 575 additions and 278 deletions

View File

@@ -84,10 +84,21 @@ getSymbol (dsd_opts * opts, dsd_state * state, int have_sync)
if(opts->audio_in_type == 0)
{
pa_simple_read(opts->pulse_digi_dev_in, &sample, 2, NULL );
state->pulse_raw_out_buffer = sample; //steal raw out buffer sample here?
//look into how processAudio handles playback, not sure if latency issues, or garbage sample values crash pulse when written
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?
pa_simple_write(opts->pulse_raw_dev_out, (void*)&state->pulse_raw_out_buffer, 2, NULL);
}
}
else if (opts->audio_in_type == 1) {
result = sf_read_short(opts->audio_in_file, &sample, 1);
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?
pa_simple_write(opts->pulse_raw_dev_out, (void*)&state->pulse_raw_out_buffer, 2, NULL);
}
if(result == 0) {
cleanupAndExit (opts, state);
}
@@ -111,7 +122,11 @@ getSymbol (dsd_opts * opts, dsd_state * state, int have_sync)
#ifdef USE_RTLSDR
// TODO: need to read demodulated stream here
get_rtlsdr_sample(&sample);
//state->pulse_raw_out_buffer = sample;
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?
pa_simple_write(opts->pulse_raw_dev_out, (void*)&state->pulse_raw_out_buffer, 2, NULL);
}
#endif
}