diff --git a/PiPedalCommon/src/include/util.hpp b/PiPedalCommon/src/include/util.hpp index b4168cb..793e187 100644 --- a/PiPedalCommon/src/include/util.hpp +++ b/PiPedalCommon/src/include/util.hpp @@ -118,4 +118,7 @@ namespace pipedal std::string ToLower(const std::string&value); std::filesystem::path MakeRelativePath(const std::filesystem::path &path, const std::filesystem::path&parentPath); + + bool IsSubdirectory(const std::filesystem::path &path, const std::filesystem::path &basePath); + } diff --git a/PiPedalCommon/src/util.cpp b/PiPedalCommon/src/util.cpp index 47cd458..08de1f2 100644 --- a/PiPedalCommon/src/util.cpp +++ b/PiPedalCommon/src/util.cpp @@ -189,3 +189,30 @@ std::filesystem::path pipedal::MakeRelativePath(const std::filesystem::path &pat return remander; } + +bool pipedal::IsSubdirectory(const std::filesystem::path &path, const std::filesystem::path &basePath) +{ + auto iPath = path.begin(); + for (auto i = basePath.begin(); i != basePath.end(); ++i) + { + if (iPath == path.end()) + { + return false; + } + + if ((*i) != (*iPath)) + { + return false; + } + ++iPath; + } + while (iPath != path.end()) + { + if (iPath->string() == "..") + { + return false; + } + ++iPath; + } + return true; +} diff --git a/docs/ReleaseNotes.md b/docs/ReleaseNotes.md index 07b78a4..36c84fc 100644 --- a/docs/ReleaseNotes.md +++ b/docs/ReleaseNotes.md @@ -11,6 +11,7 @@ - Support for LV2 Trigger controls, and MIDI bindings to LV2 trigger controls (common in looper and recording/playback plugsin). - MIDI bindings for LV2 trigger controls. - Port Web app from CRA to Vite framework to avoid deprecated dependencies. +- ToobAmp 1.1.57: Correctly set file path of the default file property for Toob Convolution Reverb. ## PiPedal 1.3.69 diff --git a/lv2/aarch64/ToobAmp.lv2/CabIR.ttl b/lv2/aarch64/ToobAmp.lv2/CabIR.ttl index a59d0f8..d5dd122 100644 --- a/lv2/aarch64/ToobAmp.lv2/CabIR.ttl +++ b/lv2/aarch64/ToobAmp.lv2/CabIR.ttl @@ -93,7 +93,7 @@ cabir:impulseFile3 doap:license ; doap:maintainer ; lv2:minorVersion 0 ; - lv2:microVersion 56 ; + lv2:microVersion 57 ; rdfs:comment """ TooB Cab IR is a convolution-based guitar cabinet impulse response simulator. diff --git a/lv2/aarch64/ToobAmp.lv2/CabSim.ttl b/lv2/aarch64/ToobAmp.lv2/CabSim.ttl index 9c6f439..ecf7f81 100644 --- a/lv2/aarch64/ToobAmp.lv2/CabSim.ttl +++ b/lv2/aarch64/ToobAmp.lv2/CabSim.ttl @@ -49,7 +49,7 @@ toob:frequencyResponseVector doap:license ; doap:maintainer ; lv2:minorVersion 0 ; - lv2:microVersion 56 ; + lv2:microVersion 57 ; mod:brand "TooB"; mod:label "TooB CabSim"; diff --git a/lv2/aarch64/ToobAmp.lv2/ConvolutionReverb.ttl b/lv2/aarch64/ToobAmp.lv2/ConvolutionReverb.ttl index 254f41b..d347d53 100644 --- a/lv2/aarch64/ToobAmp.lv2/ConvolutionReverb.ttl +++ b/lv2/aarch64/ToobAmp.lv2/ConvolutionReverb.ttl @@ -53,7 +53,7 @@ toobimpulse:impulseFile doap:license ; doap:maintainer ; lv2:minorVersion 0 ; - lv2:microVersion 56 ; + lv2:microVersion 57 ; rdfs:comment """ Convolution reverb is a notoriously compute-intensive effect. If you are having performance issues, use the Max T control to constrain the length of the impulse file to diff --git a/lv2/aarch64/ToobAmp.lv2/ConvolutionReverbStereo.ttl b/lv2/aarch64/ToobAmp.lv2/ConvolutionReverbStereo.ttl index d7957f2..6f6ee24 100644 --- a/lv2/aarch64/ToobAmp.lv2/ConvolutionReverbStereo.ttl +++ b/lv2/aarch64/ToobAmp.lv2/ConvolutionReverbStereo.ttl @@ -51,7 +51,7 @@ toobimpulse:impulseFile doap:license ; doap:maintainer ; lv2:minorVersion 0 ; - lv2:microVersion 56 ; + lv2:microVersion 57 ; rdfs:comment """ diff --git a/lv2/aarch64/ToobAmp.lv2/InputStage.ttl b/lv2/aarch64/ToobAmp.lv2/InputStage.ttl index d32bc50..e1c1e74 100644 --- a/lv2/aarch64/ToobAmp.lv2/InputStage.ttl +++ b/lv2/aarch64/ToobAmp.lv2/InputStage.ttl @@ -65,7 +65,7 @@ inputStage:filterGroup doap:license ; doap:maintainer ; lv2:minorVersion 0 ; - lv2:microVersion 56 ; + lv2:microVersion 57 ; mod:brand "TooB"; mod:label "TooB Input"; diff --git a/lv2/aarch64/ToobAmp.lv2/PowerStage2.ttl b/lv2/aarch64/ToobAmp.lv2/PowerStage2.ttl index 03ea107..f99f60b 100644 --- a/lv2/aarch64/ToobAmp.lv2/PowerStage2.ttl +++ b/lv2/aarch64/ToobAmp.lv2/PowerStage2.ttl @@ -67,7 +67,7 @@ pstage:stage3 doap:license ; doap:maintainer ; lv2:minorVersion 0 ; - lv2:microVersion 56 ; + lv2:microVersion 57 ; mod:brand "TooB"; mod:label "Power Stage"; diff --git a/lv2/aarch64/ToobAmp.lv2/SpectrumAnalyzer.ttl b/lv2/aarch64/ToobAmp.lv2/SpectrumAnalyzer.ttl index 06a6c11..cc895f1 100644 --- a/lv2/aarch64/ToobAmp.lv2/SpectrumAnalyzer.ttl +++ b/lv2/aarch64/ToobAmp.lv2/SpectrumAnalyzer.ttl @@ -58,7 +58,7 @@ doap:license ; doap:maintainer ; lv2:minorVersion 0 ; - lv2:microVersion 56 ; + lv2:microVersion 57 ; rdfs:comment "TooB spectrum analyzer" ; mod:brand "TooB"; diff --git a/lv2/aarch64/ToobAmp.lv2/ToneStack.ttl b/lv2/aarch64/ToobAmp.lv2/ToneStack.ttl index 2925341..a150f92 100644 --- a/lv2/aarch64/ToobAmp.lv2/ToneStack.ttl +++ b/lv2/aarch64/ToobAmp.lv2/ToneStack.ttl @@ -55,7 +55,7 @@ tonestack:eqGroup doap:license ; doap:maintainer ; lv2:minorVersion 0 ; - lv2:microVersion 56 ; + lv2:microVersion 57 ; uiext:ui ; diff --git a/lv2/aarch64/ToobAmp.lv2/ToobAmp.so b/lv2/aarch64/ToobAmp.lv2/ToobAmp.so index 0e859c9..e6e2914 100644 Binary files a/lv2/aarch64/ToobAmp.lv2/ToobAmp.so and b/lv2/aarch64/ToobAmp.lv2/ToobAmp.so differ diff --git a/lv2/aarch64/ToobAmp.lv2/ToobAmpUI.so b/lv2/aarch64/ToobAmp.lv2/ToobAmpUI.so index a610440..6ccd10e 100644 Binary files a/lv2/aarch64/ToobAmp.lv2/ToobAmpUI.so and b/lv2/aarch64/ToobAmp.lv2/ToobAmpUI.so differ diff --git a/lv2/aarch64/ToobAmp.lv2/ToobChorus.ttl b/lv2/aarch64/ToobAmp.lv2/ToobChorus.ttl index 237f71d..7d7b0bf 100644 --- a/lv2/aarch64/ToobAmp.lv2/ToobChorus.ttl +++ b/lv2/aarch64/ToobAmp.lv2/ToobChorus.ttl @@ -40,7 +40,7 @@ doap:license ; doap:maintainer ; lv2:minorVersion 0 ; - lv2:microVersion 56 ; + lv2:microVersion 57 ; rdfs:comment """ Emulation of a Boss CE-2 Chorus. diff --git a/lv2/aarch64/ToobAmp.lv2/ToobDelay.ttl b/lv2/aarch64/ToobAmp.lv2/ToobDelay.ttl index 371aeba..1faeb88 100644 --- a/lv2/aarch64/ToobAmp.lv2/ToobDelay.ttl +++ b/lv2/aarch64/ToobAmp.lv2/ToobDelay.ttl @@ -41,7 +41,7 @@ doap:license ; doap:maintainer ; lv2:minorVersion 0 ; - lv2:microVersion 56 ; + lv2:microVersion 57 ; rdfs:comment """ A straightforward no-frills digital delay. diff --git a/lv2/aarch64/ToobAmp.lv2/ToobFlanger.ttl b/lv2/aarch64/ToobAmp.lv2/ToobFlanger.ttl index b5f8779..bce6f3c 100644 --- a/lv2/aarch64/ToobAmp.lv2/ToobFlanger.ttl +++ b/lv2/aarch64/ToobAmp.lv2/ToobFlanger.ttl @@ -41,7 +41,7 @@ doap:license ; doap:maintainer ; lv2:minorVersion 0 ; - lv2:microVersion 56 ; + lv2:microVersion 57 ; rdfs:comment """ Emulation of a Boss BF-2 Flanger, based on circuit analysis and simulation of the original. diff --git a/lv2/aarch64/ToobAmp.lv2/ToobFlangerStereo.ttl b/lv2/aarch64/ToobAmp.lv2/ToobFlangerStereo.ttl index fc2c387..c291c3b 100644 --- a/lv2/aarch64/ToobAmp.lv2/ToobFlangerStereo.ttl +++ b/lv2/aarch64/ToobAmp.lv2/ToobFlangerStereo.ttl @@ -41,7 +41,7 @@ doap:license ; doap:maintainer ; lv2:minorVersion 0 ; - lv2:microVersion 56 ; + lv2:microVersion 57 ; rdfs:comment """ Digital emulation of a Boss BF-2 Flanger. diff --git a/lv2/aarch64/ToobAmp.lv2/ToobFreeverb.ttl b/lv2/aarch64/ToobAmp.lv2/ToobFreeverb.ttl index bcb42cb..77575e2 100644 --- a/lv2/aarch64/ToobAmp.lv2/ToobFreeverb.ttl +++ b/lv2/aarch64/ToobAmp.lv2/ToobFreeverb.ttl @@ -41,7 +41,7 @@ doap:license ; doap:maintainer ; lv2:minorVersion 0 ; - lv2:microVersion 56 ; + lv2:microVersion 57 ; rdfs:comment """ Toob Freeverb is an Lv2 implementation of the famous Freeverb reverb effect. FreeVerb delivers a well-balanced reverb with very little tonal coloration. diff --git a/lv2/aarch64/ToobAmp.lv2/ToobML.ttl b/lv2/aarch64/ToobAmp.lv2/ToobML.ttl index c775baf..25dce24 100644 --- a/lv2/aarch64/ToobAmp.lv2/ToobML.ttl +++ b/lv2/aarch64/ToobAmp.lv2/ToobML.ttl @@ -65,7 +65,7 @@ toobml:sagGroup doap:license ; doap:maintainer ; lv2:minorVersion 0 ; - lv2:microVersion 56 ; + lv2:microVersion 57 ; rdfs:comment """ The TooB ML Amplifier plugin provides emulation of a variety of amplifiers and overdrive pedals that are implemented using neural-network-based machine learning models of real amplifiers. diff --git a/lv2/aarch64/ToobAmp.lv2/ToobNeuralAmpModeler.ttl b/lv2/aarch64/ToobAmp.lv2/ToobNeuralAmpModeler.ttl index e4e0097..57c7b2b 100644 --- a/lv2/aarch64/ToobAmp.lv2/ToobNeuralAmpModeler.ttl +++ b/lv2/aarch64/ToobAmp.lv2/ToobNeuralAmpModeler.ttl @@ -61,7 +61,7 @@ toobNam:eqGroup doap:license ; doap:maintainer ; lv2:minorVersion 0 ; - lv2:microVersion 56 ; + lv2:microVersion 57 ; rdfs:comment """ A port of Steven Atkinson's Neural Amp Modeler to LV2. diff --git a/lv2/aarch64/ToobAmp.lv2/ToobTuner.ttl b/lv2/aarch64/ToobAmp.lv2/ToobTuner.ttl index 55dedc8..3f47c08 100644 --- a/lv2/aarch64/ToobAmp.lv2/ToobTuner.ttl +++ b/lv2/aarch64/ToobAmp.lv2/ToobTuner.ttl @@ -40,7 +40,7 @@ doap:license ; doap:maintainer ; lv2:minorVersion 0 ; - lv2:microVersion 56 ; + lv2:microVersion 57 ; rdfs:comment """ TooB Tuner is a chromatic guitar tuner. """ ; diff --git a/src/PiPedalModel.cpp b/src/PiPedalModel.cpp index ffb7d0b..deb1109 100644 --- a/src/PiPedalModel.cpp +++ b/src/PiPedalModel.cpp @@ -50,6 +50,7 @@ #endif /* NO_MLOCK */ using namespace pipedal; +namespace fs = std::filesystem; template T &constMutex(const T &mutex) @@ -2309,10 +2310,46 @@ void PiPedalModel::SetSystemMidiBindings(std::vector &bindings) } } -FileRequestResult PiPedalModel::GetFileList2(const std::string &relativePath, const UiFileProperty &fileProperty) +PedalboardItem*PiPedalModel::GetPedalboardItemForFileProperty(const UiFileProperty& fileProperty) { + for (PedalboardItem*pedalboardItem: this->pedalboard.GetAllPlugins()) + { + if (pedalboardItem->pathProperties_.contains(fileProperty.patchProperty())) + { + return pedalboardItem; + } + } + return nullptr; +} +FileRequestResult PiPedalModel::GetFileList2(const std::string &relativePath_, const UiFileProperty &fileProperty) +{ + std::string relativePath = relativePath_; try { + if (!storage.IsInUploadsDirectory(relativePath)) + { + // if relativePath is in a resource directory of the plugin, then we have loaded a factory preset or are using a default property. + // map the resource path to the corresponding file in the uploads directory. + // :-( + PedalboardItem *pedalboardItem = GetPedalboardItemForFileProperty(fileProperty); + if (pedalboardItem) + { + auto pluginInfo = GetPluginInfo(pedalboardItem->uri()); + if (pluginInfo) { + std::filesystem::path resourcePath = fs::path(pluginInfo->bundle_path()) + / fileProperty.resourceDirectory(); + if (IsSubdirectory(relativePath,resourcePath)) + { + fs::path t = MakeRelativePath(relativePath,resourcePath); + t = fileProperty.directory() / t; + if (fs::exists(t)) + { + relativePath = t; + } + } + } + } + } return this->storage.GetFileList2(relativePath, fileProperty); } catch (const std::exception &e) diff --git a/src/PiPedalModel.hpp b/src/PiPedalModel.hpp index 2613785..ffb016f 100644 --- a/src/PiPedalModel.hpp +++ b/src/PiPedalModel.hpp @@ -109,6 +109,7 @@ namespace pipedal using NetworkChangedListener = std::function; private: + PedalboardItem* GetPedalboardItemForFileProperty(const UiFileProperty& fileProperty); void CancelAudioRetry(); clock::time_point lastRestartTime = clock::time_point::min(); diff --git a/src/PluginHost.cpp b/src/PluginHost.cpp index 8e1f04e..8f2c84b 100644 --- a/src/PluginHost.cpp +++ b/src/PluginHost.cpp @@ -1547,6 +1547,20 @@ static void createTargetLinks(const std::filesystem::path &sourceDirectory, cons } } } + +std::string PluginHost::MapResourcePath(const std::string&pluginUri, const std::string&filePath) +{ + auto plugin = GetPluginInfo(pluginUri); + if (plugin) { + + return filePath; + } + + + return filePath; + +} + void PluginHost::CheckForResourceInitialization(const std::string &pluginUri, const std::filesystem::path &pluginUploadDirectory) { diff --git a/src/PluginHost.hpp b/src/PluginHost.hpp index ec99211..c018ad3 100644 --- a/src/PluginHost.hpp +++ b/src/PluginHost.hpp @@ -838,6 +838,9 @@ namespace pipedal public: virtual MapFeature &GetMapFeature() { return this->mapFeature; } void CheckForResourceInitialization(const std::string& pluginUri,const std::filesystem::path& pluginUploadDirectory); + + std::string MapResourcePath(const std::string&uri, const std::string&relativePath); + void ReloadPlugins(); // equivalent to LV2 MapPath AbstractPath features. diff --git a/src/Storage.cpp b/src/Storage.cpp index e3a6e14..8fa628f 100644 --- a/src/Storage.cpp +++ b/src/Storage.cpp @@ -46,32 +46,6 @@ const char *BANKS_FILENAME = "index.banks"; #define USER_SETTINGS_FILENAME "userSettings.json"; -static bool isSubdirectory(const fs::path &path, const fs::path &basePath) -{ - auto iPath = path.begin(); - for (auto i = basePath.begin(); i != basePath.end(); ++i) - { - if (iPath == path.end()) - { - return false; - } - - if ((*i) != (*iPath)) - { - return false; - } - ++iPath; - } - while (iPath != path.end()) - { - if (iPath->string() == "..") - { - return false; - } - ++iPath; - } - return true; -} static bool hasSyntheticModRoot(const UiFileProperty &fileProperty) { @@ -1755,7 +1729,7 @@ FileRequestResult Storage::GetModFileList2(const std::string &relativePath, cons const ModFileTypes::ModDirectory *modDirectoryInfo = ModFileTypes::GetModDirectory(modDirectory); if (modDirectoryInfo) { - if (isSubdirectory(fsRelativePath, uploadsDirectory / modDirectoryInfo->pipedalPath)) + if (IsSubdirectory(fsRelativePath, uploadsDirectory / modDirectoryInfo->pipedalPath)) { rootModDirectory = modDirectoryInfo; modDirectoryPath = uploadsDirectory / modDirectoryInfo->pipedalPath; @@ -1766,7 +1740,7 @@ FileRequestResult Storage::GetModFileList2(const std::string &relativePath, cons } if (modDirectoryPath.empty() && fileProperty.useLegacyModDirectory()) { - if (isSubdirectory(fsRelativePath, uploadsDirectory / fileProperty.directory())) + if (IsSubdirectory(fsRelativePath, uploadsDirectory / fileProperty.directory())) { modDirectoryPath = uploadsDirectory / fileProperty.directory(); result.breadcrumbs_.push_back({modDirectoryPath.string(), fs::path(fileProperty.directory()).filename().string()}); @@ -1881,7 +1855,7 @@ FileRequestResult Storage::GetFileList2(const std::string &relativePath_, const ++iAbsolutePath; } } - if (!isSubdirectory(absolutePath, pluginRootDirectory)) + if (!IsSubdirectory(absolutePath, pluginRootDirectory)) { throw std::runtime_error(SS("Improper location. " << absolutePath)); } @@ -2239,6 +2213,11 @@ FilePropertyDirectoryTree::ptr Storage::GetFilePropertydirectoryTree(const UiFil } } +bool Storage::IsInUploadsDirectory(const std::filesystem::path&path) const +{ + return IsSubdirectory(path,this->GetPluginUploadDirectory()); +} + const PluginPresetIndex &Storage::GetPluginPresetIndex() { return pluginPresetIndex; diff --git a/src/Storage.hpp b/src/Storage.hpp index 72220cf..0e50aa8 100644 --- a/src/Storage.hpp +++ b/src/Storage.hpp @@ -154,6 +154,8 @@ public: void MoveBank(int from, int to); int64_t DeleteBank(int64_t bankId); + bool IsInUploadsDirectory(const std::filesystem::path&path) const; + FileRequestResult GetFileList2(const std::string&relativePath,const UiFileProperty&fileProperty); FileRequestResult GetModFileList2(const std::string &relativePath,const UiFileProperty &fileProperty); diff --git a/vite/src/pipedal/UploadFileDialog.tsx b/vite/src/pipedal/UploadFileDialog.tsx index 4582f65..c8b966d 100644 --- a/vite/src/pipedal/UploadFileDialog.tsx +++ b/vite/src/pipedal/UploadFileDialog.tsx @@ -29,7 +29,8 @@ import ResizeResponsiveComponent from './ResizeResponsiveComponent'; import Typography from '@mui/material/Typography'; import { UiFileProperty,UiFileType } from './Lv2Plugin'; import SvgIcon from '@mui/material/SvgIcon'; -import ErrorIcon from '@mui/icons-material/Error'; +//import ErrorIcon from '@mui/icons-material/Error'; +import ErrorOutlineIcon from '@mui/icons-material/ErrorOutline'; import ArrowBackIcon from '@mui/icons-material/ArrowBack'; import IconButton from '@mui/material/IconButton'; import CheckCircleOutlineIcon from '@mui/icons-material/CheckCircleOutline'; @@ -291,7 +292,7 @@ export default class UploadFileDialog extends ResizeResponsiveComponent); + return (); case FileUploadStatus.Uploaded: return ( );