Optional User Input Argument for Pulse Audio Sink / Source Use;
This commit is contained in:
parent
e3ecace5db
commit
63e484cc91
|
|
@ -342,6 +342,8 @@ typedef struct
|
|||
pa_simple *pulse_digi_dev_in;
|
||||
pa_simple *pulse_digi_dev_out;
|
||||
pa_simple *pulse_digi_dev_outR;
|
||||
char pa_input_idx[100];
|
||||
char pa_output_idx[100];
|
||||
int use_ncurses_terminal;
|
||||
int ncurses_compact;
|
||||
int ncurses_history;
|
||||
|
|
@ -1041,10 +1043,12 @@ void openAudioOutDevice (dsd_opts * opts, int speed);
|
|||
void openAudioInDevice (dsd_opts * opts);
|
||||
|
||||
//pulse sources and sinks
|
||||
void pa_state_cb(pa_context *c, void *userdata);
|
||||
void pa_sinklist_cb(pa_context *c, const pa_sink_info *l, int eol, void *userdata);
|
||||
void pa_sourcelist_cb(pa_context *c, const pa_source_info *l, int eol, void *userdata);
|
||||
int pa_get_devicelist(pa_devicelist_t *input, pa_devicelist_t *output);
|
||||
void parse_pulse_input_string (dsd_opts * opts, char * input);
|
||||
void parse_pulse_output_string (dsd_opts * opts, char * input);
|
||||
void pa_state_cb (pa_context *c, void *userdata);
|
||||
void pa_sinklist_cb (pa_context *c, const pa_sink_info *l, int eol, void *userdata);
|
||||
void pa_sourcelist_cb (pa_context *c, const pa_source_info *l, int eol, void *userdata);
|
||||
int pa_get_devicelist (pa_devicelist_t *input, pa_devicelist_t *output);
|
||||
int pulse_list();
|
||||
|
||||
int getDibit (dsd_opts * opts, dsd_state * state);
|
||||
|
|
|
|||
|
|
@ -41,6 +41,10 @@ void closePulseInput (dsd_opts * opts)
|
|||
void openPulseOutput(dsd_opts * opts)
|
||||
{
|
||||
|
||||
char * dev = NULL;
|
||||
if (opts->pa_output_idx[0] != 0)
|
||||
dev = opts->pa_output_idx;
|
||||
|
||||
int err = 0;
|
||||
|
||||
ss.format = PA_SAMPLE_S16NE;
|
||||
|
|
@ -57,7 +61,7 @@ void openPulseOutput(dsd_opts * opts)
|
|||
|
||||
//reconfigured to open when using edacs or raw analog monitor so we can have a analog audio out that runs at 48k1 and not 8k1 float/short
|
||||
if (opts->frame_provoice == 1 || opts->monitor_input_audio == 1)
|
||||
opts->pulse_raw_dev_out = pa_simple_new(NULL, "DSD-FME3", PA_STREAM_PLAYBACK, NULL, "Analog", &ss, 0, NULL, &err);
|
||||
opts->pulse_raw_dev_out = pa_simple_new(NULL, "DSD-FME3", PA_STREAM_PLAYBACK, dev, "Analog", &ss, 0, NULL, &err);
|
||||
|
||||
if (err != 0)
|
||||
{
|
||||
|
|
@ -73,7 +77,7 @@ void openPulseOutput(dsd_opts * opts)
|
|||
|
||||
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, &err);
|
||||
opts->pulse_digi_dev_out = pa_simple_new(NULL, "DSD-FME", PA_STREAM_PLAYBACK, dev, opts->output_name, &tt, ss, NULL, &err);
|
||||
|
||||
if (err != 0)
|
||||
{
|
||||
|
|
@ -87,7 +91,7 @@ void openPulseOutput(dsd_opts * opts)
|
|||
|
||||
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, &err);
|
||||
opts->pulse_digi_dev_out = pa_simple_new(NULL, "DSD-FME", PA_STREAM_PLAYBACK, dev, opts->output_name, &ff, fl, NULL, &err);
|
||||
|
||||
if (err != 0)
|
||||
{
|
||||
|
|
@ -104,6 +108,10 @@ void openPulseOutput(dsd_opts * opts)
|
|||
void openPulseInput(dsd_opts * opts)
|
||||
{
|
||||
|
||||
char * dev = NULL;
|
||||
if (opts->pa_input_idx[0] != 0)
|
||||
dev = opts->pa_input_idx;
|
||||
|
||||
int err = 0;
|
||||
|
||||
cc.format = PA_SAMPLE_S16NE;
|
||||
|
|
@ -130,8 +138,8 @@ void openPulseInput(dsd_opts * opts)
|
|||
lt.prebuf = -1;
|
||||
lt.tlength = -1;
|
||||
if (opts->m17encoder == 1)
|
||||
opts->pulse_digi_dev_in = pa_simple_new(NULL, "DSD-FME4", PA_STREAM_RECORD, NULL, "M17 Voice Input", &cc, NULL, <, &err);
|
||||
else opts->pulse_digi_dev_in = pa_simple_new(NULL, "DSD-FME", PA_STREAM_RECORD, NULL, opts->output_name, &cc, NULL, <, &err);
|
||||
opts->pulse_digi_dev_in = pa_simple_new(NULL, "DSD-FME4", PA_STREAM_RECORD, dev, "M17 Voice Input", &cc, NULL, <, &err);
|
||||
else opts->pulse_digi_dev_in = pa_simple_new(NULL, "DSD-FME", PA_STREAM_RECORD, dev, opts->output_name, &cc, NULL, <, &err);
|
||||
|
||||
if (err != 0)
|
||||
{
|
||||
|
|
@ -151,6 +159,34 @@ void openPulseInput(dsd_opts * opts)
|
|||
|
||||
}
|
||||
|
||||
void parse_pulse_input_string (dsd_opts * opts, char * input)
|
||||
{
|
||||
char * curr;
|
||||
curr = strtok(input, ":");
|
||||
if (curr != NULL)
|
||||
{
|
||||
strncpy (opts->pa_input_idx, curr, 99);
|
||||
opts->pa_input_idx[99] = 0;
|
||||
fprintf (stderr, "\n");
|
||||
fprintf (stderr, "Pulse Input Device: %s; ", opts->pa_input_idx);
|
||||
fprintf (stderr, "\n");
|
||||
}
|
||||
}
|
||||
|
||||
void parse_pulse_output_string (dsd_opts * opts, char * input)
|
||||
{
|
||||
char * curr;
|
||||
curr = strtok(input, ":");
|
||||
if (curr != NULL)
|
||||
{
|
||||
strncpy (opts->pa_output_idx, curr, 99);
|
||||
opts->pa_output_idx[99] = 0;
|
||||
fprintf (stderr, "\n");
|
||||
fprintf (stderr, "Pulse Output Device: %s; ", opts->pa_output_idx);
|
||||
fprintf (stderr, "\n");
|
||||
}
|
||||
}
|
||||
|
||||
void openOSSOutput (dsd_opts * opts)
|
||||
{
|
||||
int fmt;
|
||||
|
|
|
|||
|
|
@ -664,6 +664,8 @@ initOpts (dsd_opts * opts)
|
|||
opts->pulse_raw_out_channels = 1;
|
||||
opts->pulse_digi_in_channels = 1; //2
|
||||
opts->pulse_digi_out_channels = 2; //new default for AUTO
|
||||
memset (opts->pa_input_idx, 0, 100*sizeof(char));
|
||||
memset (opts->pa_output_idx, 0, 100*sizeof(char));
|
||||
|
||||
opts->wav_sample_rate = 48000; //default value (DSDPlus uses 96000 on raw signal wav files)
|
||||
opts->wav_interpolator = 1; //default factor of 1 on 48000; 2 on 96000; sample rate / decimator
|
||||
|
|
@ -1269,6 +1271,8 @@ usage ()
|
|||
printf (" -i <device> Audio input device (default is pulse)\n");
|
||||
printf (" /dev/dsp for OSS audio (Depreciated: Will require padsp wrapper in Linux) \n");
|
||||
#endif
|
||||
printf (" pulse for pulse audio signal input \n");
|
||||
printf (" pulse:6 or pulse:virtual_sink2.monitor for pulse audio signal input on virtual_sink2 (see -O) \n");
|
||||
printf (" rtl for rtl dongle (Default Values -- see below)\n");
|
||||
printf (" rtl:dev:freq:gain:ppm:bw:sq:vol for rtl dongle (see below)\n");
|
||||
printf (" tcp for tcp client SDR++/GNURadio Companion/Other (Port 7355)\n");
|
||||
|
|
@ -1292,6 +1296,8 @@ usage ()
|
|||
printf (" -o <device> Audio output device (default is pulse)\n");
|
||||
printf (" /dev/dsp for OSS audio (Depreciated: Will require padsp wrapper in Linux) \n");
|
||||
#endif
|
||||
printf (" pulse for pulse audio decoded voice or analog output\n");
|
||||
printf (" pulse:1 or pulse:alsa_output.pci-0000_0d_00.3.analog-stereo for pulse audio decoded voice or analog output on device (see -O) \n");
|
||||
printf (" null for no audio output\n");
|
||||
printf (" udp for UDP socket blaster output (default host 127.0.0.1; default port 23456)\n");
|
||||
printf (" udp:192.168.7.8:23470 for UDP socket blaster output (Target Address and Port\n");
|
||||
|
|
@ -3156,6 +3162,9 @@ main (int argc, char **argv)
|
|||
if((strncmp(opts.audio_in_dev, "pulse", 5) == 0))
|
||||
{
|
||||
opts.audio_in_type = 0;
|
||||
|
||||
//string yeet
|
||||
parse_pulse_input_string(&opts, opts.audio_in_dev+5);
|
||||
}
|
||||
|
||||
//UDP Socket Blaster Audio Output Setup
|
||||
|
|
@ -3226,6 +3235,9 @@ main (int argc, char **argv)
|
|||
if((strncmp(opts.audio_out_dev, "pulse", 5) == 0))
|
||||
{
|
||||
opts.audio_out_type = 0;
|
||||
|
||||
//string yeet
|
||||
parse_pulse_output_string(&opts, opts.audio_out_dev+5);
|
||||
}
|
||||
|
||||
if((strncmp(opts.audio_out_dev, "null", 4) == 0))
|
||||
|
|
|
|||
Loading…
Reference in New Issue