Skip to content

Commit

Permalink
Add support for 8-bit signed integer files
Browse files Browse the repository at this point in the history
  • Loading branch information
BatchDrake committed Jun 30, 2022
1 parent 4d556ee commit ac2f8df
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
9 changes: 9 additions & 0 deletions analyzer/source.c
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,10 @@ suscan_source_config_sf_open(const suscan_source_config_t *self, SF_INFO *sf_inf
case SUSCAN_SOURCE_FORMAT_RAW_SIGNED16:
sf = suscan_source_config_open_file_raw(self, SF_FORMAT_PCM_16, sf_info);
break;

case SUSCAN_SOURCE_FORMAT_RAW_SIGNED8:
sf = suscan_source_config_open_file_raw(self, SF_FORMAT_PCM_S8, sf_info);
break;
}

return sf;
Expand Down Expand Up @@ -1320,6 +1324,9 @@ suscan_source_config_helper_format_to_str(enum suscan_source_format type)
case SUSCAN_SOURCE_FORMAT_RAW_SIGNED16:
return "RAW_SIGNED16";

case SUSCAN_SOURCE_FORMAT_RAW_SIGNED8:
return "RAW_SIGNED8";

case SUSCAN_SOURCE_FORMAT_WAV:
return "WAV";
}
Expand All @@ -1341,6 +1348,8 @@ suscan_source_type_config_helper_str_to_format(const char *format)
return SUSCAN_SOURCE_FORMAT_RAW_UNSIGNED8;
else if (strcasecmp(format, "RAW_SIGNED16") == 0)
return SUSCAN_SOURCE_FORMAT_RAW_SIGNED16;
else if (strcasecmp(format, "RAW_SIGNED8") == 0)
return SUSCAN_SOURCE_FORMAT_RAW_SIGNED8;
else if (strcasecmp(format, "WAV") == 0)
return SUSCAN_SOURCE_FORMAT_WAV;
}
Expand Down
1 change: 1 addition & 0 deletions analyzer/source.h
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ enum suscan_source_format {
SUSCAN_SOURCE_FORMAT_WAV,
SUSCAN_SOURCE_FORMAT_RAW_UNSIGNED8,
SUSCAN_SOURCE_FORMAT_RAW_SIGNED16,
SUSCAN_SOURCE_FORMAT_RAW_SIGNED8
};

#define SUSCAN_SOURCE_FORMAT_FALLBACK SUSCAN_SOURCE_FORMAT_RAW_FLOAT32
Expand Down

0 comments on commit ac2f8df

Please sign in to comment.