| 99 | } |
| 100 | |
| 101 | QString 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 | } |