From f804e5049ee01e05643f8d00ce144d275ec76830 Mon Sep 17 00:00:00 2001 From: Leland Lucius Date: Mon, 4 May 2015 12:32:47 -0500 Subject: [PATCH] Hyphenate all 8, 16, 24, 32 and 64 bit strings --- src/FileFormats.cpp | 17 +++++++++++++++-- src/FileFormats.h | 2 ++ src/export/ExportPCM.cpp | 6 +++--- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/src/FileFormats.cpp b/src/FileFormats.cpp index bfdce00f4..ffd591aa8 100644 --- a/src/FileFormats.cpp +++ b/src/FileFormats.cpp @@ -86,7 +86,7 @@ wxString sf_encoding_index_name(int i) format_info.format = i; sf_command (NULL, SFC_GET_FORMAT_SUBTYPE, &format_info, sizeof (format_info)); - return LAT1CTOWX(format_info.name); + return sf_normalize_name(format_info.name); } unsigned int sf_encoding_index_to_subtype(int i) @@ -163,7 +163,7 @@ wxString sf_encoding_name(int encoding) format_info.format = (encoding & SF_FORMAT_SUBMASK); sf_command(NULL, SFC_GET_FORMAT_INFO, &format_info, sizeof(format_info)); - return LAT1CTOWX(format_info.name); + return sf_normalize_name(format_info.name); } int sf_num_simple_formats() @@ -237,6 +237,19 @@ wxArrayString sf_get_all_extensions() return exts; } +wxString sf_normalize_name(const char *name) +{ + wxString n = LAT1CTOWX(name); + + n.Replace(wxT("8 bit"), wxT("8-bit")); + n.Replace(wxT("16 bit"), wxT("16-bit")); + n.Replace(wxT("24 bit"), wxT("24-bit")); + n.Replace(wxT("32 bit"), wxT("32-bit")); + n.Replace(wxT("64 bit"), wxT("64-bit")); + + return n; +} + #ifdef __WXMAC__ // TODO: find out the appropriate OSType diff --git a/src/FileFormats.h b/src/FileFormats.h index 5bab39bad..d35cceb55 100644 --- a/src/FileFormats.h +++ b/src/FileFormats.h @@ -96,6 +96,8 @@ bool sf_subtype_is_integer(unsigned int format); wxArrayString sf_get_all_extensions(); +wxString sf_normalize_name(const char *name); + // // Mac OS 4-char type // diff --git a/src/export/ExportPCM.cpp b/src/export/ExportPCM.cpp index 680ac116e..899aba39e 100644 --- a/src/export/ExportPCM.cpp +++ b/src/export/ExportPCM.cpp @@ -58,9 +58,9 @@ struct } static const kFormats[] = { - { SF_FORMAT_AIFF | SF_FORMAT_PCM_16, wxT("AIFF"), XO("AIFF (Apple) signed 16 bit PCM") }, - { SF_FORMAT_WAV | SF_FORMAT_PCM_16, wxT("WAV"), XO("WAV (Microsoft) signed 16 bit PCM") }, - { SF_FORMAT_WAV | SF_FORMAT_FLOAT, wxT("WAVFLT"), XO("WAV (Microsoft) 32 bit float PCM") }, + { SF_FORMAT_AIFF | SF_FORMAT_PCM_16, wxT("AIFF"), XO("AIFF (Apple) signed 16-bit PCM") }, + { SF_FORMAT_WAV | SF_FORMAT_PCM_16, wxT("WAV"), XO("WAV (Microsoft) signed 16-bit PCM") }, + { SF_FORMAT_WAV | SF_FORMAT_FLOAT, wxT("WAVFLT"), XO("WAV (Microsoft) 32-bit float PCM") }, { SF_FORMAT_WAV | SF_FORMAT_GSM610, wxT("GSM610"), XO("GSM 6.10 WAV (mobile)") }, };