Issue #105 - Make Work with Named Pipe (FIFO)

This commit is contained in:
lwvmobile 2023-03-22 20:07:02 -04:00
parent dc49e0d08b
commit e056c97d9d
3 changed files with 23 additions and 4 deletions

View File

@ -546,7 +546,7 @@ openAudioInDevice (dsd_opts * opts)
extension = strrchr(opts->audio_in_dev, ch); //return extension if this is a .wav or .bin file extension = strrchr(opts->audio_in_dev, ch); //return extension if this is a .wav or .bin file
//if no extension set, give default of .wav -- bugfix for github issue #105 //if no extension set, give default of .wav -- bugfix for github issue #105
if (extension == NULL) extension = ".wav"; // if (extension == NULL) extension = ".wav";
// get info of device/file // get info of device/file
if (strncmp(opts->audio_in_dev, "-", 1) == 0) if (strncmp(opts->audio_in_dev, "-", 1) == 0)
@ -610,6 +610,25 @@ openAudioInDevice (dsd_opts * opts)
{ {
opts->audio_in_type = 5; opts->audio_in_type = 5;
} }
//if no extension set, treat as named pipe or extensionless wav file -- bugfix for github issue #105
else if (extension == NULL)
{
opts->audio_in_type = 2;
opts->audio_in_file_info = calloc(1, sizeof(SF_INFO));
opts->audio_in_file_info->samplerate = opts->wav_sample_rate;
opts->audio_in_file_info->channels = 1;
opts->audio_in_file_info->seekable = 0;
opts->audio_in_file_info->format = SF_FORMAT_RAW | SF_FORMAT_PCM_16 | SF_ENDIAN_LITTLE;
opts->audio_in_file = sf_open(opts->audio_in_dev, SFM_READ, opts->audio_in_file_info);
if (opts->audio_in_file == NULL)
{
fprintf(stderr, "Error, couldn't open file/pipe with libsndfile: %s\n", sf_strerror(NULL));
exit(1);
}
}
else if (strncmp(extension, ".bin", 3) == 0) else if (strncmp(extension, ".bin", 3) == 0)
{ {
struct stat stat_buf; struct stat stat_buf;

View File

@ -52,7 +52,7 @@ char * FM_banner[9] = {
" ██║ ██║ ╚═══██╗██║ ██║   ██╔══╝ ██║╚██╔╝██║██╔══╝ ", " ██║ ██║ ╚═══██╗██║ ██║   ██╔══╝ ██║╚██╔╝██║██╔══╝ ",
" ██████╔╝██████╔╝██████╔╝   ██║ ██║ ╚═╝ ██║███████╗", " ██████╔╝██████╔╝██████╔╝   ██║ ██║ ╚═╝ ██║███████╗",
" ╚═════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝╚══════╝", " ╚═════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝╚══════╝",
" 'Aero' Edition v2.0.0-68-g85eea59 Windows 32-bit RC5b " " 'Aero' Edition v2.0.0-70-gf3c0199 Windows 32-bit RC5b "
}; };
int comp (const void *a, const void *b) int comp (const void *a, const void *b)

View File

@ -2061,7 +2061,7 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state)
if (opts->ncurses_compact == 1) if (opts->ncurses_compact == 1)
{ {
printw ("------------------------------------------------------------------------------\n"); printw ("------------------------------------------------------------------------------\n");
printw ("| Digital Speech Decoder: Florida Man Edition - Aero %s \n", "v2.0.0-68-g85eea59 RC5b"); printw ("| Digital Speech Decoder: Florida Man Edition - Aero %s \n", "v2.0.0-70-gf3c0199 RC5b");
} }
if (opts->ncurses_compact == 0) if (opts->ncurses_compact == 0)
{ {
@ -2073,7 +2073,7 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state)
if (i == 2) printw (" 'q' to Quit "); if (i == 2) printw (" 'q' to Quit ");
if (i == 4) printw (" MBElib %s", versionstr); if (i == 4) printw (" MBElib %s", versionstr);
if (i == 5) printw (" %s ", "Aero RC5b"); //printw (" %s \n", GIT_TAG); if (i == 5) printw (" %s ", "Aero RC5b"); //printw (" %s \n", GIT_TAG);
if (i == 6) printw (" %s \n", "v2.0.0-68-g85eea59"); //printw (" %s \n", GIT_TAG); if (i == 6) printw (" %s \n", "v2.0.0-70-gf3c0199"); //printw (" %s \n", GIT_TAG);
else printw ("\n"); else printw ("\n");
} }
attroff(COLOR_PAIR(6)); //6 attroff(COLOR_PAIR(6)); //6