Merge pull request #15 from lwvmobile/lwvmobile-patch-pulse1

More Pulse Audio Tinkering
This commit is contained in:
lwvmobile 2022-02-08 13:06:20 -05:00 committed by GitHub
commit eaec87ac44
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 7 deletions

View File

@ -150,6 +150,7 @@ typedef struct
int pulse_raw_rate_out;
int pulse_digi_rate_in;
int pulse_digi_rate_out;
int pulse_flush;
pa_simple *pulse_raw_dev_in;
pa_simple *pulse_raw_dev_out;
pa_simple *pulse_digi_dev_in;
@ -308,7 +309,6 @@ void processDMRdata (dsd_opts * opts, dsd_state * state);
void processDMRvoice (dsd_opts * opts, dsd_state * state);
void processAudio (dsd_opts * opts, dsd_state * state);
void playRawAudio (dsd_opts * opts, dsd_state * state); //added this one HERE HERE
void processRawAudio (dsd_opts * opts, dsd_state * state); //added this one HERE HERE
void openPulseInput (dsd_opts * opts); //not sure if we need to just pass opts, or opts and state yet
void openPulseOutput (dsd_opts * opts); //not sure if we need to just pass opts, or opts and state yet
void writeSynthesizedVoice (dsd_opts * opts, dsd_state * state);

View File

@ -68,7 +68,7 @@ void openPulseInput(dsd_opts * opts)
void playRawAudio(dsd_opts * opts, dsd_state * state) {
short obuf, outl, i, sample2, something;
something = state->samplesPerSymbol / 1; //this was 5 in OSS, changed to 1 for pulse audio, no idea how it affects Port Audio
something = state->samplesPerSymbol / 1; //was this what it was?
if (opts->audio_in_type == 0 && opts->audio_out_type == 0){ //hack, but might as well for this particular type since its nearly perfect
for (i=0; i < something; i++){
@ -396,12 +396,18 @@ playSynthesizedVoice (dsd_opts * opts, dsd_state * state)
#endif
}
else{
pa_simple_flush(opts->pulse_raw_dev_out, NULL);
else {
if (opts->monitor_input_audio == 1){
pa_simple_flush(opts->pulse_raw_dev_in, NULL);
pa_simple_flush(opts->pulse_raw_dev_out, NULL);
}
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; }
state->audio_out_idx = 0;
}
}
if (state->audio_out_idx2 >= 800000)
{
state->audio_out_float_buf_p = state->audio_out_float_buf + 100;

View File

@ -189,6 +189,7 @@ getFrameSync (dsd_opts * opts, dsd_state * state)
{
playRawAudio(opts, state); //this is on line 21 in dsd_audio.c
}
t++;
symbol = getSymbol (opts, state, 0);

View File

@ -192,6 +192,7 @@ initOpts (dsd_opts * opts)
opts->pulse_raw_rate_out = 48000;
opts->pulse_digi_rate_in = 48000;
opts->pulse_digi_rate_out = 48000; //need to copy this to rtl type in and change rate out to 8000
opts->pulse_flush = 1; //set 0 to flush, 1 for flushed
}
void
@ -681,8 +682,9 @@ main (int argc, char **argv)
break;
case 'W': //monitor_input_audio if no sync
opts.monitor_input_audio = 1;
printf ("Monitor Source Audio if no sync detected (WIP!)\n");
opts.monitor_input_audio = 0;
//printf ("Monitor Source Audio if no sync detected (WIP!)\n");
printf ("Monitor Source Audio Currently Disabled in Pulse Audio Builds.\n");
break;