| 68 | } |
| 69 | |
| 70 | AbstractInputParser * InputFactory::getInput(QString fileName) |
| 71 | { |
| 72 | if (s_instance == nullptr) |
| 73 | s_instance = new InputFactory(); |
| 74 | |
| 75 | AbstractInputParser * input = nullptr; |
| 76 | |
| 77 | if (fileName.isEmpty()) |
| 78 | { |
| 79 | // New soundfont from scratch |
| 80 | input = new InputParserEmpty(); |
| 81 | } |
| 82 | else |
| 83 | { |
| 84 | QFileInfo fileInfo(fileName); |
| 85 | QString extension = fileInfo.suffix().toLower(); |
| 86 | if (s_instance->_mapToInput.contains(extension)) |
| 87 | input = s_instance->_mapToInput[extension]->getParser(fileName); |
| 88 | } |
| 89 | if (input == nullptr) |
| 90 | input = new InputParserNotSupported(); |
| 91 | input->initialize(fileName, SoundfontManager::getInstance()); |
| 92 | |
| 93 | return input; |
| 94 | } |
| 95 | |
| 96 | bool InputFactory::isSuffixSupported(QString suffix) |
| 97 | { |
nothing calls this directly
no test coverage detected