diff --git a/2 b/2 new file mode 100644 index 0000000..e69de29 diff --git a/CMakeLists.txt b/CMakeLists.txt index efea7f6..9878b1f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,13 +1,13 @@ cmake_minimum_required(VERSION 3.16.0) project(pipedal - VERSION 1.4.77 + VERSION 1.4.78 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 v1.4.77-Beta") +set (DISPLAY_VERSION "PiPedal v1.4.78-Experimental") set (PACKAGE_ARCHITECTURE ${DEBIAN_ARCHITECTURE}) set (CMAKE_INSTALL_PREFIX "/usr/") diff --git a/PiPedalCommon/src/AlsaSequencer.cpp b/PiPedalCommon/src/AlsaSequencer.cpp index e4c11d1..7506e02 100644 --- a/PiPedalCommon/src/AlsaSequencer.cpp +++ b/PiPedalCommon/src/AlsaSequencer.cpp @@ -319,6 +319,7 @@ namespace pipedal } if (seqHandle) { + Lv2Log::debug("Closing ALSA Sequencer"); snd_seq_close(seqHandle); seqHandle = nullptr; } @@ -608,7 +609,7 @@ namespace pipedal #ifndef NDEBUG #define MSG_DEBUG_LOG(x) \ case x: \ - Lv2Log::debug("ALSA Sequencer Message" #x); \ + Lv2Log::debug("ALSA Sequencer Message " #x); \ break; #else #define MSG_DEBUG_LOG(x) diff --git a/README.md b/README.md index 9545dbe..e1dfbb7 100644 --- a/README.md +++ b/README.md @@ -9,11 +9,11 @@ -Download: v1.4.77 +Download: v1.4.78 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). -#### NEW version 1.4.77 Release. See the [release notes](https://rerdavies.github.io/pipedal/ReleaseNotes) for details. New Phaser and Graphic Equalizer plugins. +#### NEW version 1.4.78 Release. See the [release notes](https://rerdavies.github.io/pipedal/ReleaseNotes) for details. New Phaser and Graphic Equalizer plugins.   diff --git a/docs/Installing.md b/docs/Installing.md index 24ee378..4e9660a 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) v1.4.77](https://github.com/rerdavies/pipedal/releases/download/v1.4.77/pipedal_1.4.77_arm64.deb) -- [Ubuntu 24.x (aarch64) v1.4.77](https://github.com/rerdavies/pipedal/releases/download/v1.4.77/pipedal_1.4.77_arm64.deb) -- [Ubuntu 24.x (amd64) v1.4.77](https://github.com/rerdavies/pipedal/releases/download/v1.4.77/pipedal_1.4.77_amd64.deb) +- [Raspberry Pi OS bookworm (aarch64) v1.4.78](https://github.com/rerdavies/pipedal/releases/download/v1.4.78/pipedal_1.4.78_arm64.deb) +- [Ubuntu 24.x (aarch64) v1.4.78](https://github.com/rerdavies/pipedal/releases/download/v1.4.78/pipedal_1.4.78_arm64.deb) +- [Ubuntu 24.x (amd64) v1.4.78](https://github.com/rerdavies/pipedal/releases/download/v1.4.78/pipedal_1.4.78_amd64.deb) -Version 1.4.77 has been tested on Raspberry Pi OS bookworm, Ubuntu 24.04 (amd64), and Ubuntu 24.10 (aarch64). Download the appropriate package for your platform, and install using the following procedure: +Version 1.4.78 has been tested on Raspberry Pi OS bookworm, Ubuntu 24.04 (amd64), and Ubuntu 24.10 (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_1.4.77_arm64.deb + sudo apt-get install ./pipedal_1.4.78_arm64.deb ``` You MUST use `apt-get`. `apt` will not install downloaded packages; and `dpkg -i` will not install dependencies. diff --git a/docs/download.md b/docs/download.md index 6e4fb8e..3f64b2d 100644 --- a/docs/download.md +++ b/docs/download.md @@ -4,9 +4,9 @@ Download the most recent Debian (.deb) package for your platform: -- [Raspberry Pi OS bookworm (aarch64) v1.4.77 Beta](https://github.com/rerdavies/pipedal/releases/download/v1.4.77/pipedal_1.4.77_arm64.deb) -- [Ubuntu 24.x (aarch64) v1.4.77 Alpha](https://github.com/rerdavies/pipedal/releases/download/v1.4.77/pipedal_1.4.77_arm64.deb) -- [Ubuntu 24.x (amd64) v1.4.77 Alpha](https://github.com/rerdavies/pipedal/releases/download/v1.4.77/pipedal_1.4.77_amd64.deb) +- [Raspberry Pi OS bookworm (aarch64) v1.4.78 Beta](https://github.com/rerdavies/pipedal/releases/download/v1.4.78/pipedal_1.4.78_arm64.deb) +- [Ubuntu 24.x (aarch64) v1.4.78 Alpha](https://github.com/rerdavies/pipedal/releases/download/v1.4.78/pipedal_1.4.78_arm64.deb) +- [Ubuntu 24.x (amd64) v1.4.78 Alpha](https://github.com/rerdavies/pipedal/releases/download/v1.4.78/pipedal_1.4.78_amd64.deb) Install the package by running @@ -14,7 +14,7 @@ Install the package by running ``` sudo apt update cd ~/Downloads - sudo apt-get install ./pipedal_1.4.77_arm64.deb + sudo apt-get install ./pipedal_1.4.78_arm64.deb ``` You MUST use `apt-get` to install the package. `apt install` will NOT install the package correctly. The message about missing permissions given by `apt-get` is expected, and can be safely ignored. diff --git a/lv2/aarch64/ToobAmp.lv2/CabIR.ttl b/lv2/aarch64/ToobAmp.lv2/CabIR.ttl index a5cdcb5..fa85f89 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 63 ; + lv2:microVersion 64 ; 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 70ba918..8a17811 100644 --- a/lv2/aarch64/ToobAmp.lv2/CabSim.ttl +++ b/lv2/aarch64/ToobAmp.lv2/CabSim.ttl @@ -50,7 +50,7 @@ toob:frequencyResponseVector doap:license ; doap:maintainer ; lv2:minorVersion 0 ; - lv2:microVersion 63 ; + lv2:microVersion 64 ; mod:brand "TooB"; mod:label "TooB CabSim"; diff --git a/lv2/aarch64/ToobAmp.lv2/ConvolutionReverb.ttl b/lv2/aarch64/ToobAmp.lv2/ConvolutionReverb.ttl index 3165808..ee9eb6c 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 63 ; + lv2:microVersion 64 ; 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 a9ff502..2328645 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 63 ; + lv2:microVersion 64 ; rdfs:comment """ diff --git a/lv2/aarch64/ToobAmp.lv2/InputStage.ttl b/lv2/aarch64/ToobAmp.lv2/InputStage.ttl index 6ec1c19..95cac11 100644 --- a/lv2/aarch64/ToobAmp.lv2/InputStage.ttl +++ b/lv2/aarch64/ToobAmp.lv2/InputStage.ttl @@ -66,7 +66,7 @@ inputStage:filterGroup doap:license ; doap:maintainer ; lv2:minorVersion 0 ; - lv2:microVersion 63 ; + lv2:microVersion 64 ; mod:brand "TooB"; mod:label "TooB Input"; diff --git a/lv2/aarch64/ToobAmp.lv2/PowerStage2.ttl b/lv2/aarch64/ToobAmp.lv2/PowerStage2.ttl index eeede7d..f7cb004 100644 --- a/lv2/aarch64/ToobAmp.lv2/PowerStage2.ttl +++ b/lv2/aarch64/ToobAmp.lv2/PowerStage2.ttl @@ -68,7 +68,7 @@ pstage:stage3 doap:license ; doap:maintainer ; lv2:minorVersion 0 ; - lv2:microVersion 63 ; + lv2:microVersion 64 ; mod:brand "TooB"; mod:label "Power Stage"; diff --git a/lv2/aarch64/ToobAmp.lv2/SpectrumAnalyzer.ttl b/lv2/aarch64/ToobAmp.lv2/SpectrumAnalyzer.ttl index 70bda8c..84011d8 100644 --- a/lv2/aarch64/ToobAmp.lv2/SpectrumAnalyzer.ttl +++ b/lv2/aarch64/ToobAmp.lv2/SpectrumAnalyzer.ttl @@ -57,7 +57,7 @@ doap:license ; doap:maintainer ; lv2:minorVersion 0 ; - lv2:microVersion 63 ; + lv2:microVersion 64 ; 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 f9d51b9..05526a2 100644 --- a/lv2/aarch64/ToobAmp.lv2/ToneStack.ttl +++ b/lv2/aarch64/ToobAmp.lv2/ToneStack.ttl @@ -57,7 +57,7 @@ tonestack:eqGroup doap:license ; doap:maintainer ; lv2:minorVersion 0 ; - lv2:microVersion 63 ; + lv2:microVersion 64 ; uiext:ui ; diff --git a/lv2/aarch64/ToobAmp.lv2/ToobAmp.so b/lv2/aarch64/ToobAmp.lv2/ToobAmp.so index b6357f6..e0d9698 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 92c76eb..a78d9a8 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 44e6b0b..6b0d594 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 63 ; + lv2:microVersion 64 ; 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 97573a7..d8e95a7 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 63 ; + lv2:microVersion 64 ; 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 7b2b30d..a4601a6 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 63 ; + lv2:microVersion 64 ; 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 5a85fdd..dcef7d7 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 63 ; + lv2:microVersion 64 ; 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 94a7c65..c19a1da 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 63 ; + lv2:microVersion 64 ; 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/ToobGraphicEq.ttl b/lv2/aarch64/ToobAmp.lv2/ToobGraphicEq.ttl index fcf298c..7581cc8 100644 --- a/lv2/aarch64/ToobAmp.lv2/ToobGraphicEq.ttl +++ b/lv2/aarch64/ToobAmp.lv2/ToobGraphicEq.ttl @@ -41,7 +41,7 @@ doap:license ; doap:maintainer ; lv2:minorVersion 0 ; - lv2:microVersion 63 ; + lv2:microVersion 64 ; rdfs:comment """ A 7 octave graphic equalizer, with frequencies chosen to be useful for EQ-ing guitar signals. """ ; diff --git a/lv2/aarch64/ToobAmp.lv2/ToobLooperFour.ttl b/lv2/aarch64/ToobAmp.lv2/ToobLooperFour.ttl index cb2c508..4cc44e8 100644 --- a/lv2/aarch64/ToobAmp.lv2/ToobLooperFour.ttl +++ b/lv2/aarch64/ToobAmp.lv2/ToobLooperFour.ttl @@ -92,7 +92,7 @@ myprefix:output_group doap:license ; doap:maintainer ; lv2:minorVersion 1 ; - lv2:microVersion 63 ; + lv2:microVersion 64 ; ui:ui ; diff --git a/lv2/aarch64/ToobAmp.lv2/ToobLooperOne.ttl b/lv2/aarch64/ToobAmp.lv2/ToobLooperOne.ttl index 9efd0ca..e37f594 100644 --- a/lv2/aarch64/ToobAmp.lv2/ToobLooperOne.ttl +++ b/lv2/aarch64/ToobAmp.lv2/ToobLooperOne.ttl @@ -78,7 +78,7 @@ myprefix:output_group doap:license ; doap:maintainer ; lv2:minorVersion 1 ; - lv2:microVersion 63 ; + lv2:microVersion 64 ; ui:ui ; diff --git a/lv2/aarch64/ToobAmp.lv2/ToobML.ttl b/lv2/aarch64/ToobAmp.lv2/ToobML.ttl index 5e6e3ee..de2a07a 100644 --- a/lv2/aarch64/ToobAmp.lv2/ToobML.ttl +++ b/lv2/aarch64/ToobAmp.lv2/ToobML.ttl @@ -67,7 +67,7 @@ toobml:sagGroup doap:license ; doap:maintainer ; lv2:minorVersion 0 ; - lv2:microVersion 63 ; + lv2:microVersion 64 ; 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/ToobMix.ttl b/lv2/aarch64/ToobAmp.lv2/ToobMix.ttl index 2e397d4..aa0ae6a 100644 --- a/lv2/aarch64/ToobAmp.lv2/ToobMix.ttl +++ b/lv2/aarch64/ToobAmp.lv2/ToobMix.ttl @@ -40,7 +40,7 @@ doap:license ; doap:maintainer ; lv2:minorVersion 0 ; - lv2:microVersion 63 ; + lv2:microVersion 64 ; rdfs:comment """ Remix a stereo input signal. diff --git a/lv2/aarch64/ToobAmp.lv2/ToobNeuralAmpModeler.ttl b/lv2/aarch64/ToobAmp.lv2/ToobNeuralAmpModeler.ttl index 5355066..67ede49 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 63 ; + lv2:microVersion 64 ; rdfs:comment """ A port of Steven Atkinson's Neural Amp Modeler to LV2. diff --git a/lv2/aarch64/ToobAmp.lv2/ToobNoiseGate.ttl b/lv2/aarch64/ToobAmp.lv2/ToobNoiseGate.ttl index 932ca56..5672117 100644 --- a/lv2/aarch64/ToobAmp.lv2/ToobNoiseGate.ttl +++ b/lv2/aarch64/ToobAmp.lv2/ToobNoiseGate.ttl @@ -54,7 +54,7 @@ noisegate:envelope_group doap:license ; doap:maintainer ; lv2:minorVersion 0 ; - lv2:microVersion 63 ; + lv2:microVersion 64 ; rdfs:comment """ A noise gate is an audio processing tool that controls the volume of an audio signal by allowing it to pass through only when it exceeds a set threshold. diff --git a/lv2/aarch64/ToobAmp.lv2/ToobPhaser.ttl b/lv2/aarch64/ToobAmp.lv2/ToobPhaser.ttl index 6963a38..3676f05 100644 --- a/lv2/aarch64/ToobAmp.lv2/ToobPhaser.ttl +++ b/lv2/aarch64/ToobAmp.lv2/ToobPhaser.ttl @@ -40,7 +40,7 @@ doap:license ; doap:maintainer ; lv2:minorVersion 0 ; - lv2:microVersion 63 ; + lv2:microVersion 64 ; rdfs:comment """ A loose emulation of an MXR® Phase 90 Phaser. diff --git a/lv2/aarch64/ToobAmp.lv2/ToobPlayer.ttl b/lv2/aarch64/ToobAmp.lv2/ToobPlayer.ttl index 000489f..c11a17b 100644 --- a/lv2/aarch64/ToobAmp.lv2/ToobPlayer.ttl +++ b/lv2/aarch64/ToobAmp.lv2/ToobPlayer.ttl @@ -60,7 +60,7 @@ toobPlayer:seek doap:license ; doap:maintainer ; lv2:minorVersion 0 ; - lv2:microVersion 63 ; + lv2:microVersion 64 ; rdfs:comment """ Play audio files. Audio files can optionally be loooped by pressing the "Set loop" button. diff --git a/lv2/aarch64/ToobAmp.lv2/ToobRecordMono.ttl b/lv2/aarch64/ToobAmp.lv2/ToobRecordMono.ttl index b127513..841fb12 100644 --- a/lv2/aarch64/ToobAmp.lv2/ToobRecordMono.ttl +++ b/lv2/aarch64/ToobAmp.lv2/ToobRecordMono.ttl @@ -51,7 +51,7 @@ recordPrefix:audioFile doap:license ; doap:maintainer ; lv2:minorVersion 1 ; - lv2:microVersion 63 ; + lv2:microVersion 64 ; ui:ui ; diff --git a/lv2/aarch64/ToobAmp.lv2/ToobRecordStereo.ttl b/lv2/aarch64/ToobAmp.lv2/ToobRecordStereo.ttl index b466568..9669716 100644 --- a/lv2/aarch64/ToobAmp.lv2/ToobRecordStereo.ttl +++ b/lv2/aarch64/ToobAmp.lv2/ToobRecordStereo.ttl @@ -88,7 +88,7 @@ myprefix:loop3_group doap:license ; doap:maintainer ; lv2:minorVersion 1 ; - lv2:microVersion 63 ; + lv2:microVersion 64 ; ui:ui ; diff --git a/lv2/aarch64/ToobAmp.lv2/ToobTuner.ttl b/lv2/aarch64/ToobAmp.lv2/ToobTuner.ttl index 90b5392..bcaf601 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 63 ; + lv2:microVersion 64 ; rdfs:comment """ TooB Tuner is a chromatic guitar tuner. """ ; diff --git a/lv2/aarch64/ToobAmp.lv2/ToobVolume.ttl b/lv2/aarch64/ToobAmp.lv2/ToobVolume.ttl index d78713b..be47dd1 100644 --- a/lv2/aarch64/ToobAmp.lv2/ToobVolume.ttl +++ b/lv2/aarch64/ToobAmp.lv2/ToobVolume.ttl @@ -39,7 +39,7 @@ doap:license ; doap:maintainer ; lv2:minorVersion 0 ; - lv2:microVersion 63 ; + lv2:microVersion 64 ; rdfs:comment """ Volume control. diff --git a/src/AlsaDriver.cpp b/src/AlsaDriver.cpp index 5df7144..783ab4f 100644 --- a/src/AlsaDriver.cpp +++ b/src/AlsaDriver.cpp @@ -1484,7 +1484,7 @@ namespace pipedal #endif } - std::jthread *audioThread = nullptr; + std::unique_ptr audioThread; bool audioRunning; bool block = false; @@ -1518,32 +1518,36 @@ namespace pipedal } while (frames > 0); return framesRead; } + protected: void ReadMidiData(uint32_t audioFrame) { AlsaMidiMessage message; midiEventCount = 0; - while(alsaSequencer->ReadMessage(message,0)) + while (alsaSequencer->ReadMessage(message, 0)) { size_t messageSize = message.size; - if (messageSize == 0) + if (messageSize == 0) { continue; } - if (midiEventMemoryIndex + messageSize >= this->midiEventMemory.size()) { + if (midiEventMemoryIndex + messageSize >= this->midiEventMemory.size()) + { continue; } - if (midiEventCount >= this->midiEvents.size()) { - midiEvents.resize(midiEventCount*2); + if (midiEventCount >= this->midiEvents.size()) + { + midiEvents.resize(midiEventCount * 2); } - // for now, prevent META event messages from propagating. - if (message.data[0] == 0xFF && message.size > 1) { + // for now, prevent META event messages from propagating. + if (message.data[0] == 0xFF && message.size > 1) + { continue; } MidiEvent *pEvent = midiEvents.data() + midiEventCount++; pEvent->time = audioFrame; - pEvent->size = messageSize; + pEvent->size = messageSize; pEvent->buffer = midiEventMemory.data() + midiEventMemoryIndex; memcpy( @@ -1551,11 +1555,10 @@ namespace pipedal message.data, message.size); midiEventMemoryIndex += messageSize; - } } - private: + private: long WriteBuffer(snd_pcm_t *handle, uint8_t *buf, size_t frames) { long framesRead; @@ -1759,7 +1762,7 @@ namespace pipedal } } - audioThread = new std::jthread([this]() + audioThread = std::make_unique([this]() { AudioThread(); }); } @@ -1773,8 +1776,7 @@ namespace pipedal terminateAudio(true); if (audioThread) { - this->audioThread->join(); - this->audioThread = 0; + this->audioThread = 0; // jthread joins. } Lv2Log::debug("Audio thread joined."); } @@ -1789,9 +1791,6 @@ namespace pipedal AlsaSequencer::ptr alsaSequencer; public: - - - virtual void SetAlsaSequencer(AlsaSequencer::ptr alsaSequencer) override { this->alsaSequencer = alsaSequencer; @@ -1822,7 +1821,7 @@ namespace pipedal { for (size_t i = 0; i < buffer.size(); ++i) { - // delete[] buffer[i]; + delete[] buffer[i]; buffer[i] = 0; } buffer.clear(); @@ -1887,6 +1886,51 @@ namespace pipedal snd_pcm_t *captureHandle = nullptr; snd_pcm_hw_params_t *playbackHwParams = nullptr; snd_pcm_hw_params_t *captureHwParams = nullptr; + + Finally ff_playbackHandle{ + [&playbackHandle]() + { + if (playbackHandle) + { + int rc = snd_pcm_close(playbackHandle); + if (rc < 0) + { + throw std::runtime_error("snd_pcm_close failed."); + } + playbackHandle = nullptr; + } + }}; + Finally ff_captureHandle{ + [&captureHandle]() + { + if (captureHandle) + { + int rc = snd_pcm_close(captureHandle); + if (rc < 0) + { + throw std::runtime_error("snd_pcm_close failed."); + } + + captureHandle = nullptr; + } + }}; + Finally ff_playbackHwParams{ + [&playbackHwParams]() + { + if (playbackHwParams) + { + snd_pcm_hw_params_free(playbackHwParams); + } + }}; + Finally ff_captureHwParams{ + [&captureHwParams]() + { + if (captureHwParams) + { + snd_pcm_hw_params_free(captureHwParams); + } + }}; + std::string alsaDeviceName = jackServerSettings.GetAlsaInputDevice(); bool result = false; @@ -2001,28 +2045,6 @@ namespace pipedal result = false; throw; } - if (playbackHwParams) - { - snd_pcm_hw_params_free(playbackHwParams); - playbackHwParams = nullptr; - } - - if (captureHwParams) - { - snd_pcm_hw_params_free(captureHwParams); - captureHwParams = nullptr; - } - - if (playbackHandle) - { - snd_pcm_close(playbackHandle); - playbackHandle = nullptr; - } - if (captureHandle) - { - snd_pcm_close(captureHandle); - captureHandle = nullptr; - } return result; } @@ -2176,4 +2198,9 @@ namespace pipedal } #endif } + + void FreeAlsaGlobals() + { + snd_config_update_free_global(); // to get a clean Valgrind report. + } } // namespace diff --git a/src/AlsaDriver.hpp b/src/AlsaDriver.hpp index d9a6aa2..c579813 100644 --- a/src/AlsaDriver.hpp +++ b/src/AlsaDriver.hpp @@ -40,5 +40,7 @@ namespace pipedal { // test only. void AlsaFormatEncodeDecodeTest(AudioDriverHost*driverHost); void MidiDecoderTest(); + + void FreeAlsaGlobals(); // for valgrind. Free the Alsa configuration cache. } diff --git a/src/AudioHost.cpp b/src/AudioHost.cpp index ebc387c..3cdb7cc 100644 --- a/src/AudioHost.cpp +++ b/src/AudioHost.cpp @@ -1511,8 +1511,10 @@ public: if (property != nullptr && value != nullptr && property->type == uris.atom_URID) { LV2_URID propertyUrid = ((LV2_Atom_URID *)property)->body; - this->pNotifyCallbacks->OnPatchSetReply(instanceId, propertyUrid, value); - // this->pNotifyCallbacks->OnNotifyMaybeLv2StateChanged(instanceId); + if (this->pNotifyCallbacks) + { + this->pNotifyCallbacks->OnPatchSetReply(instanceId, propertyUrid, value); + } } } } diff --git a/src/PiPedalModel.cpp b/src/PiPedalModel.cpp index 5049cb9..d79b286 100644 --- a/src/PiPedalModel.cpp +++ b/src/PiPedalModel.cpp @@ -2239,7 +2239,10 @@ void PiPedalModel::OnPatchSetReply(uint64_t instanceId, LV2_URID patchSetPropert } } } - audioHost->SetListenForAtomOutput(atomOutputListeners.size() != 0); + if (audioHost) + { + audioHost->SetListenForAtomOutput(atomOutputListeners.size() != 0); + } } void PiPedalModel::OnNotifyPathPatchPropertyReceived( diff --git a/src/PluginHost.cpp b/src/PluginHost.cpp index 4b09185..5a796cb 100644 --- a/src/PluginHost.cpp +++ b/src/PluginHost.cpp @@ -828,7 +828,10 @@ Lv2PluginInfo::Lv2PluginInfo(PluginHost *lv2Host, LilvWorld *pWorld, const LilvP std::string bundleUri = bundleUriNode.AsUri(); - std::string bundlePath = lilv_file_uri_parse(bundleUri.c_str(), nullptr); + char *lilvBundlePath = lilv_file_uri_parse(bundleUri.c_str(), nullptr); + std::string bundlePath = lilvBundlePath; + lilv_free(lilvBundlePath); + if (bundlePath.length() == 0) throw std::logic_error("Bundle uri is not a file uri."); @@ -1655,9 +1658,9 @@ Lv2PortGroup::Lv2PortGroup(PluginHost *lv2Host, const std::string &groupUri) this->uri_ = groupUri; AutoLilvNode uri = lilv_new_uri(pWorld, groupUri.c_str()); - LilvNode *symbolNode = lilv_world_get(pWorld, uri, lv2Host->lilvUris->lv2core__symbol, nullptr); + AutoLilvNode symbolNode = lilv_world_get(pWorld, uri, lv2Host->lilvUris->lv2core__symbol, nullptr); symbol_ = nodeAsString(symbolNode); - LilvNode *nameNode = lilv_world_get(pWorld, uri, lv2Host->lilvUris->lv2core__name, nullptr); + AutoLilvNode nameNode = lilv_world_get(pWorld, uri, lv2Host->lilvUris->lv2core__name, nullptr); name_ = nodeAsString(nameNode); } diff --git a/src/WebServer.cpp b/src/WebServer.cpp index e159704..4a86c9a 100644 --- a/src/WebServer.cpp +++ b/src/WebServer.cpp @@ -39,6 +39,7 @@ #include "ofstream_synced.hpp" #include "ModTemplateGenerator.hpp" + #include #include "WebServer.hpp" @@ -685,7 +686,7 @@ namespace pipedal int threads = 1; size_t maxUploadSize = 512 * 1024 * 1024; - std::thread *pBgThread = nullptr; + std::unique_ptr pBgThread; std::recursive_mutex io_mutex; boost::asio::io_context *pIoContext = nullptr; @@ -1417,7 +1418,7 @@ namespace pipedal throw std::runtime_error("Bad state."); } this->signalOnDone = signalOnDone; - this->pBgThread = new std::thread(ThreadProc, this); + this->pBgThread = std::make_unique(ThreadProc, this); } virtual void DisplayIpAddresses() override; diff --git a/src/main.cpp b/src/main.cpp index 3e38c95..99c823c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -41,6 +41,7 @@ #include "HtmlHelper.hpp" #include #include +#include "AlsaDriver.hpp" #include #include @@ -422,6 +423,8 @@ int main(int argc, char *argv[]) } Lv2Log::info("Shutdown complete."); + FreeAlsaGlobals(); + if (systemd) { sd_notify(0, "STOPPING=1"); diff --git a/valgrind.sh b/valgrind.sh new file mode 100755 index 0000000..58d1723 --- /dev/null +++ b/valgrind.sh @@ -0,0 +1 @@ +valgrind --leak-check=full --log-file=vg.output ./build/src/pipedald /etc/pipedal/config ./vite/dist -port 0.0.0.0:8080 -log-level debug diff --git a/vg.output b/vg.output new file mode 100644 index 0000000..ae1253a --- /dev/null +++ b/vg.output @@ -0,0 +1,146 @@ +==5249== Memcheck, a memory error detector +==5249== Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al. +==5249== Using Valgrind-3.19.0 and LibVEX; rerun with -h for copyright info +==5249== Command: ./build/src/pipedald /etc/pipedal/config ./vite/dist -port 0.0.0.0:8080 -log-level debug +==5249== Parent PID: 5248 +==5249== +==5249== +==5249== HEAP SUMMARY: +==5249== in use at exit: 88,737 bytes in 474 blocks +==5249== total heap usage: 662,523 allocs, 662,049 frees, 52,720,309 bytes allocated +==5249== +==5249== 22 bytes in 1 blocks are definitely lost in loss record 11 of 102 +==5249== at 0x48850C8: malloc (vg_replace_malloc.c:381) +==5249== by 0x61DC32F: ??? +==5249== by 0x61BFFC3: ??? +==5249== by 0x61C01DB: ??? +==5249== by 0x61BF9D7: ??? +==5249== by 0x61C0267: ??? +==5249== by 0x61C0677: ??? +==5249== by 0x61C0C1B: ??? +==5249== by 0x61C0C47: ??? +==5249== by 0x5F143DB: ??? +==5249== by 0x5F14613: ??? +==5249== by 0x6046B87: ??? +==5249== +==5249== 56 bytes in 1 blocks are definitely lost in loss record 45 of 102 +==5249== at 0x48850C8: malloc (vg_replace_malloc.c:381) +==5249== by 0x6233FC7: ??? +==5249== by 0x6232503: ??? +==5249== by 0x6233197: ??? +==5249== by 0x6233343: ??? +==5249== by 0x6233AB7: ??? +==5249== by 0x5F14453: ??? +==5249== by 0x5F14613: ??? +==5249== by 0x6046B87: ??? +==5249== by 0x5EFD7B7: ??? +==5249== by 0x5EFE143: ??? +==5249== by 0x60467A7: ??? +==5249== +==5249== 88 bytes in 1 blocks are definitely lost in loss record 52 of 102 +==5249== at 0x48850C8: malloc (vg_replace_malloc.c:381) +==5249== by 0x625EF8B: ??? +==5249== by 0x61CD1E7: ??? +==5249== by 0x61CD3AF: ??? +==5249== by 0x61CD46B: ??? +==5249== by 0x5F1C0E7: ??? +==5249== by 0x5F0A637: ??? +==5249== by 0x5F143AB: ??? +==5249== by 0x5F14613: ??? +==5249== by 0x6046B87: ??? +==5249== by 0x5EFD7B7: ??? +==5249== by 0x5EFE143: ??? +==5249== +==5249== 3,352 (80 direct, 3,272 indirect) bytes in 1 blocks are definitely lost in loss record 89 of 102 +==5249== at 0x48850C8: malloc (vg_replace_malloc.c:381) +==5249== by 0x6235507: ??? +==5249== by 0x61BFFEB: ??? +==5249== by 0x61C01DB: ??? +==5249== by 0x61BF9D7: ??? +==5249== by 0x61C0267: ??? +==5249== by 0x61C0677: ??? +==5249== by 0x61C0C1B: ??? +==5249== by 0x61C0C47: ??? +==5249== by 0x5F143DB: ??? +==5249== by 0x5F14613: ??? +==5249== by 0x6046B87: ??? +==5249== +==5249== 3,709 (80 direct, 3,629 indirect) bytes in 1 blocks are definitely lost in loss record 91 of 102 +==5249== at 0x48850C8: malloc (vg_replace_malloc.c:381) +==5249== by 0x6235507: ??? +==5249== by 0x626268B: ??? +==5249== by 0x604751B: ??? +==5249== by 0x624C53B: ??? +==5249== by 0x6046AA7: ??? +==5249== by 0x6046C17: ??? +==5249== by 0x5EFD7B7: ??? +==5249== by 0x5EFE143: ??? +==5249== by 0x60467A7: ??? +==5249== by 0x1B727F: CollatorImpl::CollatorImpl(std::shared_ptr, char const*) (Locale.cpp:385) +==5249== by 0x1B7717: LocaleImpl::GetCollator() (Locale.cpp:444) +==5249== +==5249== 3,950 (56 direct, 3,894 indirect) bytes in 1 blocks are definitely lost in loss record 92 of 102 +==5249== at 0x48850C8: malloc (vg_replace_malloc.c:381) +==5249== by 0x625EF8B: ??? +==5249== by 0x624BE7B: ??? +==5249== by 0x60460BF: ??? +==5249== by 0x6046C0B: ??? +==5249== by 0x5EFD7B7: ??? +==5249== by 0x5EFE143: ??? +==5249== by 0x60467A7: ??? +==5249== by 0x1B727F: CollatorImpl::CollatorImpl(std::shared_ptr, char const*) (Locale.cpp:385) +==5249== by 0x1B7717: LocaleImpl::GetCollator() (Locale.cpp:444) +==5249== by 0x156B67: main (main.cpp:303) +==5249== +==5249== 4,264 bytes in 1 blocks are definitely lost in loss record 99 of 102 +==5249== at 0x48850C8: malloc (vg_replace_malloc.c:381) +==5249== by 0x625EFDF: ??? +==5249== by 0x61C063F: ??? +==5249== by 0x61C0C1B: ??? +==5249== by 0x61C0C47: ??? +==5249== by 0x5F143DB: ??? +==5249== by 0x5F14613: ??? +==5249== by 0x6046B87: ??? +==5249== by 0x5EFD7B7: ??? +==5249== by 0x5EFE143: ??? +==5249== by 0x60467A7: ??? +==5249== by 0x1B727F: CollatorImpl::CollatorImpl(std::shared_ptr, char const*) (Locale.cpp:385) +==5249== +==5249== 5,804 (256 direct, 5,548 indirect) bytes in 1 blocks are definitely lost in loss record 100 of 102 +==5249== at 0x48850C8: malloc (vg_replace_malloc.c:381) +==5249== by 0x625EF8B: ??? +==5249== by 0x5F143CF: ??? +==5249== by 0x5F14613: ??? +==5249== by 0x6046B87: ??? +==5249== by 0x5EFD7B7: ??? +==5249== by 0x5EFE143: ??? +==5249== by 0x60467A7: ??? +==5249== by 0x1B727F: CollatorImpl::CollatorImpl(std::shared_ptr, char const*) (Locale.cpp:385) +==5249== by 0x1B7717: LocaleImpl::GetCollator() (Locale.cpp:444) +==5249== by 0x156B67: main (main.cpp:303) +==5249== +==5249== 7,733 bytes in 276 blocks are definitely lost in loss record 101 of 102 +==5249== at 0x488A1C4: realloc (vg_replace_malloc.c:1437) +==5249== by 0x5912A2B: serd_chunk_sink (in /usr/lib/aarch64-linux-gnu/libserd-0.so.0.30.16) +==5249== by 0x5912A87: serd_chunk_sink_finish (in /usr/lib/aarch64-linux-gnu/libserd-0.so.0.30.16) +==5249== by 0x590DA67: serd_file_uri_parse (in /usr/lib/aarch64-linux-gnu/libserd-0.so.0.30.16) +==5249== by 0x470DE3: pipedal::Lv2PluginInfo::Lv2PluginInfo(pipedal::PluginHost*, LilvWorldImpl*, LilvPluginImpl const*) (PluginHost.cpp:831) +==5249== by 0x49D8F7: void std::_Construct(pipedal::Lv2PluginInfo*, pipedal::PluginHost*&&, LilvWorldImpl*&, LilvPluginImpl const*&) (stl_construct.h:119) +==5249== by 0x49A61F: void std::allocator_traits >::construct(std::allocator&, pipedal::Lv2PluginInfo*, pipedal::PluginHost*&&, LilvWorldImpl*&, LilvPluginImpl const*&) (alloc_traits.h:635) +==5249== by 0x496C5F: std::_Sp_counted_ptr_inplace, (__gnu_cxx::_Lock_policy)2>::_Sp_counted_ptr_inplace(std::allocator, pipedal::PluginHost*&&, LilvWorldImpl*&, LilvPluginImpl const*&) (shared_ptr_base.h:604) +==5249== by 0x48F12B: std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count, pipedal::PluginHost*, LilvWorldImpl*&, LilvPluginImpl const*&>(pipedal::Lv2PluginInfo*&, std::_Sp_alloc_shared_tag >, pipedal::PluginHost*&&, LilvWorldImpl*&, LilvPluginImpl const*&) (shared_ptr_base.h:971) +==5249== by 0x488A3B: std::__shared_ptr::__shared_ptr, pipedal::PluginHost*, LilvWorldImpl*&, LilvPluginImpl const*&>(std::_Sp_alloc_shared_tag >, pipedal::PluginHost*&&, LilvWorldImpl*&, LilvPluginImpl const*&) (shared_ptr_base.h:1712) +==5249== by 0x482803: std::shared_ptr::shared_ptr, pipedal::PluginHost*, LilvWorldImpl*&, LilvPluginImpl const*&>(std::_Sp_alloc_shared_tag >, pipedal::PluginHost*&&, LilvWorldImpl*&, LilvPluginImpl const*&) (shared_ptr.h:464) +==5249== by 0x47E363: std::shared_ptr std::make_shared(pipedal::PluginHost*&&, LilvWorldImpl*&, LilvPluginImpl const*&) (shared_ptr.h:1010) +==5249== +==5249== LEAK SUMMARY: +==5249== definitely lost: 12,635 bytes in 284 blocks +==5249== indirectly lost: 16,343 bytes in 30 blocks +==5249== possibly lost: 0 bytes in 0 blocks +==5249== still reachable: 59,759 bytes in 160 blocks +==5249== suppressed: 0 bytes in 0 blocks +==5249== Reachable blocks (those to which a pointer was found) are not shown. +==5249== To see them, rerun with: --leak-check=full --show-leak-kinds=all +==5249== +==5249== For lists of detected and suppressed errors, rerun with: -s +==5249== ERROR SUMMARY: 9 errors from 9 contexts (suppressed: 0 from 0)