diff --git a/CMakeLists.txt b/CMakeLists.txt index 710f481..0c64939 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,13 +1,13 @@ cmake_minimum_required(VERSION 3.16.0) project(pipedal - VERSION 2.0.104 + VERSION 2.0.105 DESCRIPTION "PiPedal Guitar Effect Pedal For Raspberry Pi" HOMEPAGE_URL "https://rerdavies.github.io/pipedal" ) execute_process( COMMAND dpkg --print-architecture COMMAND tr -d '\n' OUTPUT_VARIABLE DEBIAN_ARCHITECTURE ) -set (DISPLAY_VERSION "PiPedal v2.0.104-Release") +set (DISPLAY_VERSION "PiPedal v2.0.105-Release") set (PACKAGE_ARCHITECTURE ${DEBIAN_ARCHITECTURE}) set (CMAKE_INSTALL_PREFIX "/usr/") diff --git a/README.md b/README.md index a8dfd75..b9f4b25 100644 --- a/README.md +++ b/README.md @@ -9,11 +9,11 @@ -Download: v2.0.104 +Download: v2.0.105 Website: [https://rerdavies.github.io/pipedal](https://rerdavies.github.io/pipedal). Documentation: [https://rerdavies.github.io/pipedal/Documentation.html](https://rerdavies.github.io/pipedal/Documentation.html). -#### Announcing PiPedal 2.0 (2.0.104)—a major update to PiPedal, including exciting new features, ioncluding support for NAM A2. See the Pipedal website [documentation](https://rerdavies.github.io/pipedal/PiPedal.html) for more information. +#### Announcing PiPedal 2.0 (2.0.105)—a major update to PiPedal, including exciting new features, ioncluding support for NAM A2. See the Pipedal website [documentation](https://rerdavies.github.io/pipedal/PiPedal.html) for more information.   diff --git a/default_presets/V4 Factory Presets.piBank b/default_presets/V4 Factory Presets.piBank new file mode 100644 index 0000000..5b59a8b Binary files /dev/null and b/default_presets/V4 Factory Presets.piBank differ diff --git a/default_presets/build_factory_presets.sh b/default_presets/build_factory_presets.sh index 218a377..933d140 100755 --- a/default_presets/build_factory_presets.sh +++ b/default_presets/build_factory_presets.sh @@ -1,5 +1,5 @@ #!/usr/bin/bash -export SRC_ZIP="V3 Factory Presets.piBank" +export SRC_ZIP="V4 Factory Presets.piBank" export DST_ZIP="Factory Presets.piBank" rm "presets/$DST_ZIP" diff --git a/default_presets/presets/Factory Presets.piBank b/default_presets/presets/Factory Presets.piBank index 34f07de..a48181f 100644 Binary files a/default_presets/presets/Factory Presets.piBank and b/default_presets/presets/Factory Presets.piBank differ diff --git a/default_presets/presets/banks.versionInfo b/default_presets/presets/banks.versionInfo index 00750ed..b8626c4 100644 --- a/default_presets/presets/banks.versionInfo +++ b/default_presets/presets/banks.versionInfo @@ -1 +1 @@ -3 +4 diff --git a/docs/Installing.md b/docs/Installing.md index 436e2ea..2689565 100644 --- a/docs/Installing.md +++ b/docs/Installing.md @@ -13,18 +13,18 @@ page_icon: img/Install4.jpg Download the most recent Debian (.deb) package for your platform: -- [Raspberry Pi OS bookworm (aarch64) v2.0.104](https://github.com/rerdavies/pipedal/releases/download/v2.0.104/pipedal_2.0.104_arm64.deb) -- [Ubuntu 24.04 through 25.04 (aarch64) v2.0.104](https://github.com/rerdavies/pipedal/releases/download/v2.0.104/pipedal_2.0.104_arm64.deb) -- [Ubuntu 24.04 through 25.04 (amd64) v2.0.104](https://github.com/rerdavies/pipedal/releases/download/v2.0.104/pipedal_2.0.104_amd64.deb) +- [Raspberry Pi OS bookworm (aarch64) v2.0.105](https://github.com/rerdavies/pipedal/releases/download/v2.0.105/pipedal_2.0.105_arm64.deb) +- [Ubuntu 24.04 through 25.04 (aarch64) v2.0.105](https://github.com/rerdavies/pipedal/releases/download/v2.0.105/pipedal_2.0.105_arm64.deb) +- [Ubuntu 24.04 through 25.04 (amd64) v2.0.105](https://github.com/rerdavies/pipedal/releases/download/v2.0.105/pipedal_2.0.105_amd64.deb) -Version 2.0.104 has been tested on Raspberry Pi OS bookworm, Ubuntu 24.04 (amd64), Ubuntu 24.10 (aarch64), and Ubuntu 25.04 (aarch64). Download the appropriate package for your platform, and install using the following procedure: +Version 2.0.105 has been tested on Raspberry Pi OS bookworm, Ubuntu 24.04 (amd64), Ubuntu 24.10 (aarch64), and Ubuntu 25.04 (aarch64). Download the appropriate package for your platform, and install using the following procedure: ``` sudo apt update sudo apt upgrade cd ~/Downloads - sudo apt-get install ./pipedal_2.0.104_arm64.deb + sudo apt-get install ./pipedal_2.0.105_arm64.deb ``` You MUST use `apt-get`. `apt` will not install downloaded packages; and `dpkg -i` will not install dependencies. @@ -62,7 +62,7 @@ Use the following command to copy the downloaded package to the server from Linu Adjust `username`, `server_address` and the actual name of the Debian package you downloaded as needed: ``` -scp Downloads/pipedal_2.0.104_arm64.deb username@server_address:/home/username/ +scp Downloads/pipedal_2.0.105_arm64.deb username@server_address:/home/username/ ``` This will copy the downloaded package on your desktop computer to your home directory on the PiPedal server computer. @@ -70,7 +70,7 @@ Once you have copied the package to the server, you can SSH into the server and ``` ssh username@server_address -sudo apt-get install ./pipedal_2.0.104_arm64.deb +sudo apt-get install ./pipedal_2.0.105_arm64.deb ``` The PiPedal package installer will print out the port number that the PiPedal web server is listening on. It defaults to port 80, but if you have another web server already running on port 80, it will select the next available port. Ubuntu default installs have Apache Server running on port 80, so the PiPedal web server will default to port 81 on Ubuntu. diff --git a/docs/PiPedal2.md b/docs/PiPedal2.md index 709b7d6..2647682 100644 --- a/docs/PiPedal2.md +++ b/docs/PiPedal2.md @@ -11,7 +11,7 @@ -_To download PiPedal v2.0.104-alpha, click [*here*](download.md). +_To download PiPedal v2.0.105-alpha, click [*here*](download.md). To view PiPedal documentation, click [*here*](Documentation.md)._ Use your Raspberry Pi as a guitar effects pedal. Configure and control PiPedal with your phone or tablet. diff --git a/docs/ReleaseNotes.md b/docs/ReleaseNotes.md index fa0ee15..bad51f4 100644 --- a/docs/ReleaseNotes.md +++ b/docs/ReleaseNotes.md @@ -1,6 +1,6 @@ # Release Notes -## PiPedal 2.0.104-Release +## PiPedal 2.0.105-Release Bug fix: diff --git a/docs/download.md b/docs/download.md index 09b5c3e..85aacbb 100644 --- a/docs/download.md +++ b/docs/download.md @@ -1,13 +1,13 @@ ## Download -# Download PiPedal 2.0.104-alpha +# Download PiPedal 2.0.105-alpha Download the most recent Debian (.deb) package for your platform: -- [Raspberry Pi OS bookworm (aarch64) v2.0.104 Alpha](https://github.com/rerdavies/pipedal/releases/download/v2.0.104/pipedal_2.0.104_arm64.deb) -- [Ubuntu 24.x, 25.04 (aarch64) v2.0.104 Alpha](https://github.com/rerdavies/pipedal/releases/download/v2.0.104/pipedal_2.0.104_arm64.deb) -- [Ubuntu 24.x, 25.04 (amd64/x86_64) v2.0.104 Alpha](https://github.com/rerdavies/pipedal/releases/download/v2.0.104/pipedal_2.0.104_amd64.deb) +- [Raspberry Pi OS bookworm (aarch64) v2.0.105 Alpha](https://github.com/rerdavies/pipedal/releases/download/v2.0.105/pipedal_2.0.105_arm64.deb) +- [Ubuntu 24.x, 25.04 (aarch64) v2.0.105 Alpha](https://github.com/rerdavies/pipedal/releases/download/v2.0.105/pipedal_2.0.105_arm64.deb) +- [Ubuntu 24.x, 25.04 (amd64/x86_64) v2.0.105 Alpha](https://github.com/rerdavies/pipedal/releases/download/v2.0.105/pipedal_2.0.105_amd64.deb) Install the package by running @@ -15,7 +15,7 @@ Install the package by running ``` sudo apt update cd ~/Downloads - sudo apt install ./pipedal_2.0.104_arm64.deb + sudo apt install ./pipedal_2.0.105_arm64.deb # or ... _amd64.deb as appropriate for your platform ``` The message about missing permissions given by `apt` is diff --git a/src/Banks.hpp b/src/Banks.hpp index 550bb78..4576623 100644 --- a/src/Banks.hpp +++ b/src/Banks.hpp @@ -188,6 +188,18 @@ namespace pipedal } return false; } + + BankFileEntry* getPresetByName(const std::string&presetName) { + for (std::unique_ptr &preset: presets_) + { + if (preset->preset().name() == presetName) + { + return &(*preset); + } + } + return nullptr; + } + bool renamePreset(int64_t instanceId, const std::string &name) { if (hasName(name)) diff --git a/src/Storage.cpp b/src/Storage.cpp index e924191..7b8c981 100644 --- a/src/Storage.cpp +++ b/src/Storage.cpp @@ -294,8 +294,33 @@ void Storage::MoveExistingFactoryPresetsBank() namespace pipedal::implementation { extern int64_t ImportBankFile(PiPedalModel &model, const std::filesystem::path& filePath,uint64_t uploadAfter = -1); + extern void UpgradeBank( + PiPedalModel&model, + const std::filesystem::path &existingBankFile, + const std::filesystem::path &piBank, + const std::vector&presetsToUpgrade + ); + } +void Storage::UpgradeV3FactoryPresets() +{ + std::vector presetsToUpgrade = { + "Marshall JCM800 + TS9", + "Huge Lead 2" + }; + + fs::path factoryPresetPath = GetBankFileName("Factory Presets"); + + UpgradeBank( + *this->model, + factoryPresetPath, + this->configRoot / "default_presets" / "presets" / "Factory Presets.piBank", + presetsToUpgrade + ); + +} + void Storage::InstallFactoryPresets() { fs::path defaultBankFilePath = this->configRoot / "default_presets" / "presets" / "Factory Presets.piBank"; @@ -367,14 +392,22 @@ void Storage::ProvisionDefaultBanks() constexpr uint32_t V2_VERSION_NUMBER = 2; // first to have a Factory Presets constexpr uint32_t V3_VERSION_NUMBER = 3; // New A2 Presets, completely replacing the previons version. + constexpr uint32_t V4_VERSION_NUMBER = 4; // Fix incorrect Cab IR settings. - if (varPresetVersion < V3_VERSION_NUMBER) { + if (varPresetVersion < V4_VERSION_NUMBER) { Lv2Log::info("Installing Factory Presets"); // Move the old factory presets bank out of the way. - MoveExistingFactoryPresetsBank(); - InstallFactoryPresets(); - SetVarPresetVersion(V3_VERSION_NUMBER); + if (varPresetVersion < V3_VERSION_NUMBER) { + MoveExistingFactoryPresetsBank(); + } + if (varPresetVersion == V3_VERSION_NUMBER) + { + UpgradeV3FactoryPresets(); + } else { + InstallFactoryPresets(); + } + SetVarPresetVersion(V4_VERSION_NUMBER); SaveBankIndex(); // checkpoint. } // Next time we will have to MERGE factor presets. diff --git a/src/Storage.hpp b/src/Storage.hpp index 9001748..63e93ad 100644 --- a/src/Storage.hpp +++ b/src/Storage.hpp @@ -86,6 +86,7 @@ private: void SetVarPresetVersion(int32_t version); void UpgradeV1FactoryPresets(); void MoveExistingFactoryPresetsBank(); + void UpgradeV3FactoryPresets(); void InstallFactoryPresets(); void CopyFactoryPresetsToDefaultBank(); void ProvisionDefaultBanks(); diff --git a/src/WebServerConfig.cpp b/src/WebServerConfig.cpp index 094c7a6..4d33bc4 100644 --- a/src/WebServerConfig.cpp +++ b/src/WebServerConfig.cpp @@ -183,6 +183,67 @@ static fs::path GetTone3000ThumbnailFile(const fs::path& thumbnailDirectory, con namespace pipedal::implementation { + void UpgradeBank(PiPedalModel& model, + const std::filesystem::path& existingBankFilePath, + const std::filesystem::path& piBankFilePath, + const std::vector& presetsToUpgrade + ) { + BankFile sourceBankFile; + + + if (piBankFilePath.empty()) + { + throw std::runtime_error("Unexpected."); + } + if (IsZipFile(piBankFilePath)) + { + auto presetReader = PresetBundleReader::LoadPresetsFile(model, piBankFilePath); + presetReader->ExtractMediaFiles(); + + std::stringstream ss(presetReader->GetPresetJson()); + json_reader reader(ss); + reader.read(&sourceBankFile); + } + else + { + std::ifstream f{ piBankFilePath }; + if (!f.is_open()) { + throw std::runtime_error(SS("Unable to open file " << piBankFilePath)); + } + // legacy json format, no zip, no media files. + json_reader reader(f); + reader.read(&sourceBankFile); + } + + BankFile existingBankFile; + { + std::ifstream ifs{ existingBankFilePath }; + if (!ifs.is_open()) { + return; + } + json_reader reader{ ifs }; + reader.read(&existingBankFile); + } + + for (const std::string& presetToUpgrade : presetsToUpgrade) + { + BankFileEntry* existingEntry = existingBankFile.getPresetByName(presetToUpgrade); + if (existingEntry) { + BankFileEntry* newEntry = sourceBankFile.getPresetByName(presetToUpgrade); + if (newEntry) + { + existingEntry->preset(newEntry->preset()); + } + } + } + { + std::ofstream ofs{ existingBankFilePath }; + json_writer writer{ ofs }; + writer.write(existingBankFile); + } + + + } int64_t ImportBankFile(PiPedalModel& model, const std::filesystem::path& filePath, uint64_t uploadAfter = -1) { BankFile bankFile; @@ -211,6 +272,7 @@ namespace pipedal::implementation { json_reader reader(f); reader.read(&bankFile); } + uint64_t instanceId = model.UploadBank(bankFile, uploadAfter); return instanceId; @@ -623,7 +685,7 @@ public: fs::path path = GetTone3000ThumbnailFile(this->model->Tone3000ThumbnailDirectory(), id); if (!fs::exists(path)) { - path = GetTone3000ThumbnailFile(this->model->OldTone3000ThumbnailDirectory(),id); + path = GetTone3000ThumbnailFile(this->model->OldTone3000ThumbnailDirectory(), id); if (!fs::exists(path)) { throw PiPedalException("File not found.");