void FileReader::setParameter (int parameterIndex, float newValue) { switch (parameterIndex) { //Change selected recording case 0: setActiveRecording (newValue); break; //set startTime case 1: startSample = millisecondsToSamples (newValue); currentSample = startSample; static_cast<FileReaderEditor*> (getEditor())->setCurrentTime (samplesToMilliseconds (currentSample)); break; //set stop time case 2: stopSample = millisecondsToSamples(newValue); currentSample = startSample; static_cast<FileReaderEditor*> (getEditor())->setCurrentTime (samplesToMilliseconds (currentSample)); break; } }
bool FileReader::setFile(String fullpath) { File file(fullpath); String ext = file.getFileExtension(); if (!ext.compareIgnoreCase(".kwd")) { input = new KWIKFileSource(); } else { sendActionMessage("File type not supported"); return false; } if (!input->OpenFile(file)) { input = nullptr; sendActionMessage("Invalid file"); return false; } if (input->getNumRecords() <= 0) { input = nullptr; sendActionMessage("Empty file. Inoring open operation"); return false; } static_cast<FileReaderEditor*>(getEditor())->populateRecordings(input); setActiveRecording(0); return true; }
bool FileReader::setFile (String fullpath) { File file (fullpath); String ext = file.getFileExtension().toLowerCase().substring (1); const int index = supportedExtensions[ext] - 1; const bool isExtensionSupported = index >= 0; if (isExtensionSupported) { const int index = supportedExtensions[ext] - 1; Plugin::FileSourceInfo sourceInfo = AccessClass::getPluginManager()->getFileSourceInfo (index); input = sourceInfo.creator(); } else { CoreServices::sendStatusMessage ("File type not supported"); return false; } if (! input->OpenFile (file)) { input = nullptr; CoreServices::sendStatusMessage ("Invalid file"); return false; } const bool isEmptyFile = input->getNumRecords() <= 0; if (isEmptyFile) { input = nullptr; CoreServices::sendStatusMessage ("Empty file. Inoring open operation"); return false; } static_cast<FileReaderEditor*> (getEditor())->populateRecordings (input); setActiveRecording (0); return true; }