Skip to content

Commit

Permalink
SurgeSynthesizer: Remove unused wide getters, enable C4477 on MSVC
Browse files Browse the repository at this point in the history
  • Loading branch information
mvf committed Aug 12, 2021
1 parent 6c7438b commit 8b4c8ec
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 126 deletions.
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ if(MSVC)
/wd4267 # int and size_t
/wd4018 # signed unsigned mismatch
/wd4388 # signed unsigned mismatch in comparison
/wd4477 # blah blah wide strings after we made it work
/wd4065 # standalone default in a switch with no case
/wd4702 # unreachable code. I generally do if( a ) return foo else return bar; return nullptr so don't warn on that

Expand Down
102 changes: 0 additions & 102 deletions src/common/SurgeSynthesizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2934,100 +2934,6 @@ void SurgeSynthesizer::getParameterAccessibleName(long index, char *text)
snprintf(text, TXT_SIZE, "-");
}

void SurgeSynthesizer::getParameterNameW(long index, wchar_t *ptr)
{
if ((index >= 0) && (index < storage.getPatch().param_ptr.size()))
{
int scn = storage.getPatch().param_ptr[index]->scene;
// TODO: FIX SCENE ASSUMPTION
char sn[3][3] = {"", "A ", "B "};
char pname[256];

snprintf(pname, 255, "%s%s", sn[scn], storage.getPatch().param_ptr[index]->get_full_name());

// the input is not wide so don't use %S
swprintf(ptr, 128, L"%s", pname);
}
else if (index >= metaparam_offset)
{
int c = index - metaparam_offset;
// For a reason I don't understand, on windows, we need to sprintf then swprinf just the
// short char to make just these names work. :shrug:
char wideHack[256];

if (c >= num_metaparameters)
{
snprintf(wideHack, 255, "Macro: ERROR");
}
else
{
snprintf(wideHack, 255, "Macro %d: %s", c + 1,
storage.getPatch().CustomControllerLabel[c]);
}
swprintf(ptr, 128, L"%s", wideHack);
}
else
{
swprintf(ptr, 128, L"-");
}
}

void SurgeSynthesizer::getParameterShortNameW(long index, wchar_t *ptr)
{
if ((index >= 0) && (index < storage.getPatch().param_ptr.size()))
{
int scn = storage.getPatch().param_ptr[index]->scene;
// TODO: FIX SCENE ASSUMPTION
string sn[3] = {"", "A ", "B "};

swprintf(ptr, 128, L"%s%s", sn[scn].c_str(),
storage.getPatch().param_ptr[index]->get_name());
}
else if (index >= metaparam_offset)
{
getParameterNameW(index, ptr);
}
else
{
swprintf(ptr, 128, L"-");
}
}

void SurgeSynthesizer::getParameterUnitW(long index, wchar_t *ptr)
{
if ((index >= 0) && (index < storage.getPatch().param_ptr.size()))
{
swprintf(ptr, 128, L"%s", storage.getPatch().param_ptr[index]->getUnit());
}
else
{
swprintf(ptr, 128, L"");
}
}

void SurgeSynthesizer::getParameterStringW(long index, float value, wchar_t *ptr)
{
if ((index >= 0) && (index < storage.getPatch().param_ptr.size()))
{
char text[128];
storage.getPatch().param_ptr[index]->get_display(text, true, value);

swprintf(ptr, 128, L"%s", text);
}
else if (index >= metaparam_offset)
{
// For a reason I don't understand, on windows, we need to sprintf then swprinf just the
// short char to make just these names work. :shrug:
char wideHack[256];
snprintf(wideHack, 256, "%.2f %%", 100.f * value);
swprintf(ptr, 128, L"%s", wideHack);
}
else
{
swprintf(ptr, 128, L"-");
}
}

void SurgeSynthesizer::getParameterMeta(long index, parametermeta &pm)
{
if ((index >= 0) && (index < storage.getPatch().param_ptr.size()))
Expand Down Expand Up @@ -3064,14 +2970,6 @@ void SurgeSynthesizer::getParameterMeta(long index, parametermeta &pm)
pm.clump = 1;
}
}
/*unsigned int sub3_synth::getParameterFlags (long index)
{
if (index<storage.getPatch().param_ptr.size())
{
return storage.getPatch().param_ptr[index]->ctrlstyle;
}
return 0;
}*/

float SurgeSynthesizer::getParameter(long index)
{
Expand Down
23 changes: 0 additions & 23 deletions src/common/SurgeSynthesizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -209,22 +209,6 @@ class alignas(16) SurgeSynthesizer
{
getParameterMeta(index.getSynthSideId(), pm);
}
void getParameterNameW(const ID &index, wchar_t *ptr)
{
getParameterNameW(index.getSynthSideId(), ptr);
}
void getParameterShortNameW(const ID &index, wchar_t *ptr)
{
getParameterShortNameW(index.getSynthSideId(), ptr);
}
void getParameterUnitW(const ID &index, wchar_t *ptr)
{
getParameterUnitW(index.getSynthSideId(), ptr);
}
void getParameterStringW(const ID &index, float value, wchar_t *ptr)
{
getParameterStringW(index.getSynthSideId(), value, ptr);
}
float getParameter01(const ID &index) { return getParameter01(index.getSynthSideId()); }
bool setParameter01(const ID &index, float value, bool external = false,
bool force_integer = false)
Expand Down Expand Up @@ -267,16 +251,9 @@ class alignas(16) SurgeSynthesizer
void getParameterName(long index, char *text);
void getParameterAccessibleName(long index, char *text);
void getParameterMeta(long index, parametermeta &pm);
void getParameterNameW(long index, wchar_t *ptr);
void getParameterShortNameW(long index, wchar_t *ptr);
void getParameterUnitW(long index, wchar_t *ptr);
void getParameterStringW(long index, float value, wchar_t *ptr);
// unsigned int getParameterFlags (long index);

public:
void updateDisplay();
// bool setParameter (long index, float value);
// float getParameter (long index);
bool isValidModulation(long ptag, modsources modsource);
bool isActiveModulation(long ptag, modsources modsource);
bool isBipolarModulation(modsources modsources);
Expand Down

0 comments on commit 8b4c8ec

Please sign in to comment.