MCPcopy Create free account
hub / github.com/davy7125/polyphone / getFilePath

Method getFilePath

sources/editor/tools/sample_export/toolsampleexport.cpp:101–127  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

99}
100
101QString ToolSampleExport::getFilePath(SoundfontManager * sm, EltID id1, EltID id2, bool isStereo)
102{
103 QString fileName;
104 if (isStereo)
105 {
106 QString fileName1 = sm->getQstr(id1, champ_name);
107 QString fileName2 = sm->getQstr(id2, champ_name);
108 int nb = SampleUtils::lastLettersToRemove(fileName1, fileName2);
109 fileName = fileName1.left(fileName1.size() - nb).replace(QRegularExpression("[:<>\"/\\\\\\*\\?\\|]"), "_");
110 }
111 else
112 fileName = sm->getQstr(id1, champ_name).replace(QRegularExpression("[:<>\"/\\\\\\*\\?\\|]"), "_");
113
114 QString filePath = _dirPath + fileName;
115
116 // Already existing?
117 if (QFile::exists(filePath + ".wav"))
118 {
119 // Add a suffix
120 int indice = 1;
121 while (QFile::exists(filePath + "-" + QString::number(indice) + ".wav"))
122 indice++;
123 filePath += "-" + QString::number(indice);
124 }
125
126 return filePath + ".wav";
127}

Callers

nothing calls this directly

Calls 3

getQstrMethod · 0.80
replaceMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected