+2
-1
@@ -12,4 +12,5 @@ react/package-lock.json
|
||||
src/dbus/bluez_adaptor.h
|
||||
src/dbus/bluez_proxy.h
|
||||
|
||||
CMakeFiles
|
||||
CMakeFiles
|
||||
vg.output
|
||||
+2
-2
@@ -1,13 +1,13 @@
|
||||
cmake_minimum_required(VERSION 3.16.0)
|
||||
project(pipedal
|
||||
VERSION 1.4.86
|
||||
VERSION 1.4.87
|
||||
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.86-Experimental")
|
||||
set (DISPLAY_VERSION "PiPedal v1.4.87-Experimental")
|
||||
set (PACKAGE_ARCHITECTURE ${DEBIAN_ARCHITECTURE})
|
||||
set (CMAKE_INSTALL_PREFIX "/usr/")
|
||||
|
||||
|
||||
@@ -9,11 +9,11 @@
|
||||
<img src="https://img.shields.io/github/downloads/rerdavies/pipedal/total?color=%23808080&link=https%3A%2F%2Frerdavies.github.io%2Fpipedal%2Fdownload.html"/>
|
||||
|
||||
|
||||
Download: <a href='https://rerdavies.github.io/pipedal/download.html'>v1.4.86</a>
|
||||
Download: <a href='https://rerdavies.github.io/pipedal/download.html'>v1.4.87</a>
|
||||
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.86 Release. See the [release notes](https://rerdavies.github.io/pipedal/ReleaseNotes) for details. New Phaser and Graphic Equalizer plugins.
|
||||
#### NEW version 1.4.87 Release. See the [release notes](https://rerdavies.github.io/pipedal/ReleaseNotes) for details. New Phaser and Graphic Equalizer plugins.
|
||||
|
||||
|
||||
|
||||
|
||||
+5
-5
@@ -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.86](https://github.com/rerdavies/pipedal/releases/download/v1.4.86/pipedal_1.4.86_arm64.deb)
|
||||
- [Ubuntu 24.x (aarch64) v1.4.86](https://github.com/rerdavies/pipedal/releases/download/v1.4.86/pipedal_1.4.86_arm64.deb)
|
||||
- [Ubuntu 24.x (amd64) v1.4.86](https://github.com/rerdavies/pipedal/releases/download/v1.4.86/pipedal_1.4.86_amd64.deb)
|
||||
- [Raspberry Pi OS bookworm (aarch64) v1.4.87](https://github.com/rerdavies/pipedal/releases/download/v1.4.87/pipedal_1.4.87_arm64.deb)
|
||||
- [Ubuntu 24.x (aarch64) v1.4.87](https://github.com/rerdavies/pipedal/releases/download/v1.4.87/pipedal_1.4.87_arm64.deb)
|
||||
- [Ubuntu 24.x (amd64) v1.4.87](https://github.com/rerdavies/pipedal/releases/download/v1.4.87/pipedal_1.4.87_amd64.deb)
|
||||
|
||||
|
||||
Version 1.4.86 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.87 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.86_arm64.deb
|
||||
sudo apt-get install ./pipedal_1.4.87_arm64.deb
|
||||
```
|
||||
You MUST use `apt-get`. `apt` will not install downloaded packages; and `dpkg -i` will not install dependencies.
|
||||
|
||||
|
||||
@@ -1,14 +1,18 @@
|
||||
# Release Notes
|
||||
## PiPedal 1.4.86 Beta
|
||||
## PiPedal 1.4.87 Beta
|
||||
The Big Feature:
|
||||
- Code optimizations for Raspberry Pi 5 (Cortex-A76), providing a potential 2x performance improvement for TooB Neural Amp Modeler.
|
||||
- Code optimizations for Raspberry Pi 5 (Cortex-A76), providing substantial performance improvements for TooB Neural Amp Modeler.
|
||||
- New "Threaded" button optionally executes TooB NAM computation on a separate thread. Allows up to 5 NAM instances on Pi 4, and practically unlimited NAM instances on Pi 5.
|
||||
- TooB Neural Amp Modeler: Switch to the NeuralAudio NAM Backend
|
||||
Bug fixes:
|
||||
- Compatibility with plugins expecting certain MOD host features.
|
||||
- Improvements to recovery from audio underruns and overruns.
|
||||
- Fixes for loss of currently selected plugin when modifying pedalboard structure.
|
||||
- Fixes for TooB NAM lockups when using 16- and 32-sample buffer sizes.
|
||||
- Fixes for performance issues with TooB NAM when using 16- and 32-sample buffer sizes.
|
||||
- Fixes for volume adjustments in TooB NAM.
|
||||
|
||||
(A re-issue of 1.4.86)
|
||||
## Pipedal 1.4.79 Beta
|
||||
|
||||
The Big Feature:
|
||||
|
||||
+4
-4
@@ -4,9 +4,9 @@
|
||||
|
||||
Download the most recent Debian (.deb) package for your platform:
|
||||
|
||||
- [Raspberry Pi OS bookworm (aarch64) v1.4.86 Beta](https://github.com/rerdavies/pipedal/releases/download/v1.4.86/pipedal_1.4.86_arm64.deb)
|
||||
- [Ubuntu 24.x (aarch64) v1.4.86 Alpha](https://github.com/rerdavies/pipedal/releases/download/v1.4.86/pipedal_1.4.86_arm64.deb)
|
||||
- [Ubuntu 24.x (amd64) v1.4.86 Alpha](https://github.com/rerdavies/pipedal/releases/download/v1.4.86/pipedal_1.4.86_amd64.deb)
|
||||
- [Raspberry Pi OS bookworm (aarch64) v1.4.87 Beta](https://github.com/rerdavies/pipedal/releases/download/v1.4.87/pipedal_1.4.87_arm64.deb)
|
||||
- [Ubuntu 24.x (aarch64) v1.4.87 Alpha](https://github.com/rerdavies/pipedal/releases/download/v1.4.87/pipedal_1.4.87_arm64.deb)
|
||||
- [Ubuntu 24.x (amd64) v1.4.87 Alpha](https://github.com/rerdavies/pipedal/releases/download/v1.4.87/pipedal_1.4.87_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.86_arm64.deb
|
||||
sudo apt-get install ./pipedal_1.4.87_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.
|
||||
|
||||
@@ -93,7 +93,7 @@ cabir:impulseFile3
|
||||
doap:license <https://rerdavies.github.io/pipedal/LicenseToobAmp> ;
|
||||
doap:maintainer <http://two-play.com/rerdavies#me> ;
|
||||
lv2:minorVersion 0 ;
|
||||
lv2:microVersion 66 ;
|
||||
lv2:microVersion 67 ;
|
||||
rdfs:comment """
|
||||
|
||||
TooB Cab IR is a convolution-based guitar cabinet impulse response simulator.
|
||||
|
||||
@@ -50,7 +50,7 @@ toob:frequencyResponseVector
|
||||
doap:license <https://rerdavies.github.io/pipedal/LicenseToobAmp> ;
|
||||
doap:maintainer <http://two-play.com/rerdavies#me> ;
|
||||
lv2:minorVersion 0 ;
|
||||
lv2:microVersion 66 ;
|
||||
lv2:microVersion 67 ;
|
||||
|
||||
mod:brand "TooB";
|
||||
mod:label "TooB CabSim";
|
||||
|
||||
@@ -53,7 +53,7 @@ toobimpulse:impulseFile
|
||||
doap:license <https://rerdavies.github.io/pipedal/LicenseToobAmp> ;
|
||||
doap:maintainer <http://two-play.com/rerdavies#me> ;
|
||||
lv2:minorVersion 0 ;
|
||||
lv2:microVersion 66 ;
|
||||
lv2:microVersion 67 ;
|
||||
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
|
||||
|
||||
@@ -51,7 +51,7 @@ toobimpulse:impulseFile
|
||||
doap:license <https://rerdavies.github.io/pipedal/LicenseToobAmp> ;
|
||||
doap:maintainer <http://two-play.com/rerdavies#me> ;
|
||||
lv2:minorVersion 0 ;
|
||||
lv2:microVersion 66 ;
|
||||
lv2:microVersion 67 ;
|
||||
rdfs:comment """
|
||||
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ inputStage:filterGroup
|
||||
doap:license <https://two-play.com/TooB/licenses/isc> ;
|
||||
doap:maintainer <http://two-play.com/rerdavies#me> ;
|
||||
lv2:minorVersion 0 ;
|
||||
lv2:microVersion 66 ;
|
||||
lv2:microVersion 67 ;
|
||||
|
||||
mod:brand "TooB";
|
||||
mod:label "TooB Input";
|
||||
|
||||
@@ -68,7 +68,7 @@ pstage:stage3
|
||||
doap:license <https://rerdavies.github.io/pipedal/LicenseToobAmp> ;
|
||||
doap:maintainer <http://two-play.com/rerdavies#me> ;
|
||||
lv2:minorVersion 0 ;
|
||||
lv2:microVersion 66 ;
|
||||
lv2:microVersion 67 ;
|
||||
|
||||
mod:brand "TooB";
|
||||
mod:label "Power Stage";
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
doap:license <https://rerdavies.github.io/pipedal/LicenseToobAmp> ;
|
||||
doap:maintainer <http://two-play.com/rerdavies#me> ;
|
||||
lv2:minorVersion 0 ;
|
||||
lv2:microVersion 66 ;
|
||||
lv2:microVersion 67 ;
|
||||
rdfs:comment "TooB spectrum analyzer" ;
|
||||
|
||||
mod:brand "TooB";
|
||||
|
||||
@@ -57,7 +57,7 @@ tonestack:eqGroup
|
||||
doap:license <https://rerdavies.github.io/pipedal/LicenseToobAmp> ;
|
||||
doap:maintainer <http://two-play.com/rerdavies#me> ;
|
||||
lv2:minorVersion 0 ;
|
||||
lv2:microVersion 66 ;
|
||||
lv2:microVersion 67 ;
|
||||
|
||||
uiext:ui <http://two-play.com/plugins/toob-tone-stack-ui>;
|
||||
|
||||
|
||||
Binary file not shown.
@@ -40,7 +40,7 @@
|
||||
doap:license <https://rerdavies.github.io/pipedal/LicenseToobAmp> ;
|
||||
doap:maintainer <http://two-play.com/rerdavies#me> ;
|
||||
lv2:minorVersion 0 ;
|
||||
lv2:microVersion 66 ;
|
||||
lv2:microVersion 67 ;
|
||||
rdfs:comment """
|
||||
Emulation of a Boss CE-2 Chorus.
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
doap:license <https://rerdavies.github.io/pipedal/LicenseToobAmp> ;
|
||||
doap:maintainer <http://two-play.com/rerdavies#me> ;
|
||||
lv2:minorVersion 0 ;
|
||||
lv2:microVersion 66 ;
|
||||
lv2:microVersion 67 ;
|
||||
rdfs:comment """
|
||||
A straightforward no-frills digital delay.
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
doap:license <https://rerdavies.github.io/pipedal/LicenseToobAmp> ;
|
||||
doap:maintainer <http://two-play.com/rerdavies#me> ;
|
||||
lv2:minorVersion 0 ;
|
||||
lv2:microVersion 66 ;
|
||||
lv2:microVersion 67 ;
|
||||
rdfs:comment """
|
||||
Emulation of a Boss BF-2 Flanger, based on circuit analysis and simulation of the original.
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
doap:license <https://rerdavies.github.io/pipedal/LicenseToobAmp> ;
|
||||
doap:maintainer <http://two-play.com/rerdavies#me> ;
|
||||
lv2:minorVersion 0 ;
|
||||
lv2:microVersion 66 ;
|
||||
lv2:microVersion 67 ;
|
||||
rdfs:comment """
|
||||
Digital emulation of a Boss BF-2 Flanger.
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
doap:license <https://rerdavies.github.io/pipedal/LicenseToobAmp> ;
|
||||
doap:maintainer <http://two-play.com/rerdavies#me> ;
|
||||
lv2:minorVersion 0 ;
|
||||
lv2:microVersion 66 ;
|
||||
lv2:microVersion 67 ;
|
||||
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.
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
doap:license <https://rerdavies.github.io/pipedal/LicenseToobAmp> ;
|
||||
doap:maintainer <http://two-play.com/rerdavies#me> ;
|
||||
lv2:minorVersion 0 ;
|
||||
lv2:microVersion 66 ;
|
||||
lv2:microVersion 67 ;
|
||||
rdfs:comment """
|
||||
A 7 octave graphic equalizer, with frequencies chosen to be useful for EQ-ing guitar signals.
|
||||
""" ;
|
||||
|
||||
@@ -92,7 +92,7 @@ myprefix:output_group
|
||||
doap:license <https://opensource.org/license/mit/> ;
|
||||
doap:maintainer <http://two-play.com/rerdavies#me> ;
|
||||
lv2:minorVersion 1 ;
|
||||
lv2:microVersion 66 ;
|
||||
lv2:microVersion 67 ;
|
||||
|
||||
ui:ui <http://two-play.com/plugins/toob-looper-four-ui>;
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ myprefix:output_group
|
||||
doap:license <https://opensource.org/license/mit/> ;
|
||||
doap:maintainer <http://two-play.com/rerdavies#me> ;
|
||||
lv2:minorVersion 1 ;
|
||||
lv2:microVersion 66 ;
|
||||
lv2:microVersion 67 ;
|
||||
|
||||
ui:ui <http://two-play.com/plugins/toob-looper-one-ui>;
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ toobml:sagGroup
|
||||
doap:license <https://rerdavies.github.io/pipedal/LicenseToobAmp> ;
|
||||
doap:maintainer <http://two-play.com/rerdavies#me> ;
|
||||
lv2:minorVersion 0 ;
|
||||
lv2:microVersion 66 ;
|
||||
lv2:microVersion 67 ;
|
||||
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.
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
doap:license <https://rerdavies.github.io/pipedal/LicenseToobAmp> ;
|
||||
doap:maintainer <http://two-play.com/rerdavies#me> ;
|
||||
lv2:minorVersion 0 ;
|
||||
lv2:microVersion 66 ;
|
||||
lv2:microVersion 67 ;
|
||||
rdfs:comment """
|
||||
Remix a stereo input signal.
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ toobNam:eqGroup
|
||||
doap:license <https://rerdavies.github.io/pipedal/LicenseToobAmp> ;
|
||||
doap:maintainer <http://two-play.com/rerdavies#me> ;
|
||||
lv2:minorVersion 0 ;
|
||||
lv2:microVersion 66 ;
|
||||
lv2:microVersion 67 ;
|
||||
rdfs:comment """
|
||||
TooB Neural Amp Modeler is a neural network based Amp Simulator. It uses .nam model files that are generated by training nueral networks
|
||||
on audio recordings of actual guitar amps, effects pedals and other equipment. .nam files contain data from the trained models, which can be loaded into
|
||||
|
||||
@@ -54,7 +54,7 @@ noisegate:envelope_group
|
||||
doap:license <https://rerdavies.github.io/pipedal/LicenseToobAmp> ;
|
||||
doap:maintainer <http://two-play.com/rerdavies#me> ;
|
||||
lv2:minorVersion 0 ;
|
||||
lv2:microVersion 66 ;
|
||||
lv2:microVersion 67 ;
|
||||
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.
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
doap:license <https://rerdavies.github.io/pipedal/LicenseToobAmp> ;
|
||||
doap:maintainer <http://two-play.com/rerdavies#me> ;
|
||||
lv2:minorVersion 0 ;
|
||||
lv2:microVersion 66 ;
|
||||
lv2:microVersion 67 ;
|
||||
rdfs:comment """
|
||||
A loose emulation of an MXR® Phase 90 Phaser.
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ toobPlayer:seek
|
||||
doap:license <https://rerdavies.github.io/pipedal/LicenseToobAmp> ;
|
||||
doap:maintainer <http://two-play.com/rerdavies#me> ;
|
||||
lv2:minorVersion 0 ;
|
||||
lv2:microVersion 66 ;
|
||||
lv2:microVersion 67 ;
|
||||
rdfs:comment """
|
||||
Play audio files. Audio files can optionally be loooped by pressing the "Set loop" button.
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ recordPrefix:audioFile
|
||||
doap:license <https://opensource.org/license/mit/> ;
|
||||
doap:maintainer <http://two-play.com/rerdavies#me> ;
|
||||
lv2:minorVersion 1 ;
|
||||
lv2:microVersion 66 ;
|
||||
lv2:microVersion 67 ;
|
||||
|
||||
ui:ui <http://two-play.com/plugins/toob-record-mono-ui>;
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ myprefix:loop3_group
|
||||
doap:license <https://opensource.org/license/mit/> ;
|
||||
doap:maintainer <http://two-play.com/rerdavies#me> ;
|
||||
lv2:minorVersion 1 ;
|
||||
lv2:microVersion 66 ;
|
||||
lv2:microVersion 67 ;
|
||||
|
||||
ui:ui <http://two-play.com/plugins/toob-record-stereo-ui>;
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
doap:license <https://rerdavies.github.io/pipedal/LicenseToobAmp> ;
|
||||
doap:maintainer <http://two-play.com/rerdavies#me> ;
|
||||
lv2:minorVersion 0 ;
|
||||
lv2:microVersion 66 ;
|
||||
lv2:microVersion 67 ;
|
||||
rdfs:comment """
|
||||
TooB Tuner is a chromatic guitar tuner.
|
||||
""" ;
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
doap:license <https://rerdavies.github.io/pipedal/LicenseToobAmp> ;
|
||||
doap:maintainer <http://two-play.com/rerdavies#me> ;
|
||||
lv2:minorVersion 0 ;
|
||||
lv2:microVersion 66 ;
|
||||
lv2:microVersion 67 ;
|
||||
rdfs:comment """
|
||||
Volume control.
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
+82
-53
@@ -24,6 +24,7 @@
|
||||
|
||||
#include "pch.h"
|
||||
#include "util.hpp"
|
||||
#include <cmath>
|
||||
#include "Finally.hpp"
|
||||
#include <bit>
|
||||
#include <memory>
|
||||
@@ -56,6 +57,7 @@ using namespace pipedal;
|
||||
namespace pipedal
|
||||
{
|
||||
|
||||
#define TRACE_BUFFER_POSITIONS 1
|
||||
static bool ShouldForceStereoChannels(snd_pcm_t *pcmHandle, snd_pcm_hw_params_t *hwParams, unsigned int channelsMin, unsigned int channelsMax)
|
||||
{
|
||||
// The problem: old IC2 drivers seem to return 1-8 channels, but 8 channels is non-functinal. The assumption is that legacy drivers
|
||||
@@ -245,7 +247,41 @@ namespace pipedal
|
||||
class AlsaDriverImpl : public AudioDriver
|
||||
{
|
||||
private:
|
||||
void TraceBuffers(size_t framesInBuffers, char code = ' ');
|
||||
struct BufferTrace
|
||||
{
|
||||
uint64_t time;
|
||||
snd_pcm_sframes_t inAvail;
|
||||
snd_pcm_sframes_t outAvail;
|
||||
snd_pcm_sframes_t buffered;
|
||||
snd_pcm_sframes_t total;
|
||||
char code;
|
||||
};
|
||||
|
||||
std::vector<BufferTrace> bufferTraces{1000};
|
||||
size_t bufferTraceIndex = 0;
|
||||
|
||||
inline void TraceBufferPositions(size_t framesInBuffer, char code = ' ')
|
||||
{
|
||||
#if TRACE_BUFFER_POSITIONS
|
||||
uint64_t time = std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::steady_clock::now().time_since_epoch()).count();
|
||||
auto inAvail = snd_pcm_avail_update(this->captureHandle);
|
||||
auto outAvail = snd_pcm_avail_update(this->playbackHandle);
|
||||
|
||||
auto total = inAvail + outAvail + framesInBuffer;
|
||||
bufferTraces[bufferTraceIndex++] = {
|
||||
time,
|
||||
inAvail,
|
||||
outAvail,
|
||||
(snd_pcm_sframes_t)framesInBuffer,
|
||||
(snd_pcm_sframes_t)total,
|
||||
code};
|
||||
if (bufferTraceIndex == bufferTraces.size())
|
||||
{
|
||||
bufferTraceIndex = 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
std::recursive_mutex restartMutex;
|
||||
|
||||
pipedal::CpuUse cpuUse;
|
||||
@@ -257,8 +293,15 @@ namespace pipedal
|
||||
#endif
|
||||
uint32_t sampleRate = 0;
|
||||
|
||||
uint32_t bufferSize;
|
||||
uint32_t numberOfBuffers;
|
||||
uint32_t bufferSize = 0;
|
||||
uint32_t numberOfBuffers = 0;
|
||||
|
||||
unsigned int capturePeriods = 0;
|
||||
unsigned int playbackPeriods = 0;
|
||||
|
||||
uint32_t captureHardwarePeriodSize = 0;
|
||||
uint32_t playbackHardwarePeriodSize = 0;
|
||||
;
|
||||
|
||||
int playbackChannels = 0;
|
||||
int captureChannels = 0;
|
||||
@@ -357,8 +400,6 @@ namespace pipedal
|
||||
snd_pcm_t *playbackHandle = nullptr;
|
||||
snd_pcm_t *captureHandle = nullptr;
|
||||
|
||||
unsigned int periods = 0;
|
||||
|
||||
snd_pcm_hw_params_t *captureHwParams = nullptr;
|
||||
snd_pcm_sw_params_t *captureSwParams = nullptr;
|
||||
snd_pcm_hw_params_t *playbackHwParams = nullptr;
|
||||
@@ -437,11 +478,14 @@ namespace pipedal
|
||||
snd_pcm_hw_params_t *hwParams,
|
||||
snd_pcm_sw_params_t *swParams,
|
||||
int *channels,
|
||||
unsigned int *periods)
|
||||
unsigned int *periods,
|
||||
unsigned int *hwPeriodSize)
|
||||
{
|
||||
int err;
|
||||
snd_pcm_uframes_t stop_th;
|
||||
|
||||
bool isCaptureStream = strcmp(streamType, "capture") == 0;
|
||||
|
||||
if ((err = snd_pcm_hw_params_any(handle, hwParams)) < 0)
|
||||
{
|
||||
AlsaError(SS("No playback configurations available (" << snd_strerror(err) << ")"));
|
||||
@@ -513,7 +557,7 @@ namespace pipedal
|
||||
{
|
||||
AlsaError(SS("Can't set period size to " << this->bufferSize << " (" << alsa_device_name << "/" << streamType << ")"));
|
||||
}
|
||||
this->bufferSize = effectivePeriodSize;
|
||||
*hwPeriodSize = effectivePeriodSize;
|
||||
|
||||
*periods = this->numberOfBuffers;
|
||||
dir = 0;
|
||||
@@ -547,7 +591,7 @@ namespace pipedal
|
||||
|
||||
snd_pcm_sw_params_current(handle, swParams);
|
||||
|
||||
if (handle == this->captureHandle)
|
||||
if (isCaptureStream)
|
||||
{
|
||||
if ((err = snd_pcm_sw_params_set_start_threshold(handle, swParams,
|
||||
0)) < 0)
|
||||
@@ -564,7 +608,7 @@ namespace pipedal
|
||||
}
|
||||
}
|
||||
|
||||
stop_th = *periods * this->bufferSize;
|
||||
stop_th = *periods * *hwPeriodSize;
|
||||
if (this->soft_mode)
|
||||
{
|
||||
stop_th = (snd_pcm_uframes_t)-1;
|
||||
@@ -582,13 +626,19 @@ namespace pipedal
|
||||
AlsaError(SS("Cannot set silence threshold for " << alsa_device_name));
|
||||
}
|
||||
|
||||
if (handle == this->playbackHandle)
|
||||
if (!isCaptureStream)
|
||||
{
|
||||
// For playback, set avail_min to one buffer size to minimize latency
|
||||
// while ensuring we have enough buffered data to prevent underruns
|
||||
snd_pcm_uframes_t playback_avail_min = this->bufferSize;
|
||||
err = snd_pcm_sw_params_set_avail_min(
|
||||
handle, swParams,
|
||||
this->bufferSize * (*periods - this->numberOfBuffers + 1));
|
||||
handle, swParams, playback_avail_min);
|
||||
}
|
||||
else
|
||||
{
|
||||
err = snd_pcm_sw_params_set_avail_min(
|
||||
handle, swParams, this->bufferSize);
|
||||
}
|
||||
|
||||
if (err < 0)
|
||||
{
|
||||
@@ -636,7 +686,8 @@ namespace pipedal
|
||||
captureHwParams,
|
||||
captureSwParams,
|
||||
&captureChannels,
|
||||
&this->periods);
|
||||
&this->capturePeriods,
|
||||
&this->captureHardwarePeriodSize);
|
||||
}
|
||||
if (this->playbackHandle)
|
||||
{
|
||||
@@ -647,7 +698,8 @@ namespace pipedal
|
||||
playbackHwParams,
|
||||
playbackSwParams,
|
||||
&playbackChannels,
|
||||
&this->periods);
|
||||
&this->playbackPeriods,
|
||||
&this->playbackHardwarePeriodSize);
|
||||
}
|
||||
|
||||
#ifdef ALSADRIVER_CONFIG_DBG
|
||||
@@ -1186,8 +1238,8 @@ namespace pipedal
|
||||
}
|
||||
|
||||
captureFrameSize = captureSampleSize * captureChannels;
|
||||
rawCaptureBuffer.resize(captureFrameSize * bufferSize);
|
||||
memset(rawCaptureBuffer.data(), 0, captureFrameSize * bufferSize);
|
||||
rawCaptureBuffer.resize(captureFrameSize * bufferSize * 2);
|
||||
memset(rawCaptureBuffer.data(), 0, rawCaptureBuffer.size());
|
||||
|
||||
AllocateBuffers(captureBuffers, captureChannels);
|
||||
}
|
||||
@@ -1401,17 +1453,22 @@ namespace pipedal
|
||||
{
|
||||
validate_capture_handle();
|
||||
|
||||
memset(rawPlaybackBuffer.data(), 0, playbackFrameSize * bufferSize);
|
||||
memset(rawPlaybackBuffer.data(), 0, rawPlaybackBuffer.size());
|
||||
int retry = 0;
|
||||
while (true)
|
||||
{
|
||||
auto avail = snd_pcm_avail(this->playbackHandle);
|
||||
if (avail < 0)
|
||||
{
|
||||
if (avail == -EAGAIN)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (++retry >= 5) // kinda sus code. let's make sure we don't spin forever.
|
||||
{
|
||||
throw std::runtime_error("Timed out trying to fill the audio output buffer.");
|
||||
}
|
||||
|
||||
int err = snd_pcm_prepare(playbackHandle);
|
||||
if (err < 0)
|
||||
{
|
||||
@@ -1422,8 +1479,9 @@ namespace pipedal
|
||||
}
|
||||
if (avail == 0)
|
||||
break;
|
||||
if (avail > this->bufferSize)
|
||||
avail = this->bufferSize;
|
||||
|
||||
if (avail * playbackFrameSize > this->rawPlaybackBuffer.size())
|
||||
this->rawPlaybackBuffer.resize(avail * playbackFrameSize);
|
||||
|
||||
ssize_t err = WriteBuffer(playbackHandle, rawPlaybackBuffer.data(), avail);
|
||||
if (err < 0)
|
||||
@@ -1439,7 +1497,7 @@ namespace pipedal
|
||||
try
|
||||
{
|
||||
|
||||
TraceBuffers(framesRead,'w');
|
||||
TraceBufferPositions(framesRead, 'w');
|
||||
if (err == -EPIPE)
|
||||
{
|
||||
err = snd_pcm_prepare(playback_handle);
|
||||
@@ -1471,7 +1529,7 @@ namespace pipedal
|
||||
|
||||
try
|
||||
{
|
||||
TraceBuffers(bufferedFrames,'r');
|
||||
TraceBufferPositions(bufferedFrames, 'r');
|
||||
if (err == -EPIPE)
|
||||
{
|
||||
|
||||
@@ -1575,7 +1633,7 @@ namespace pipedal
|
||||
{
|
||||
snd_pcm_wait(captureHandle, 1);
|
||||
}
|
||||
TraceBuffers(framesRead);
|
||||
TraceBufferPositions(framesRead);
|
||||
} while (frames > 0);
|
||||
return framesRead;
|
||||
}
|
||||
@@ -1659,7 +1717,7 @@ namespace pipedal
|
||||
int err;
|
||||
if ((err = snd_pcm_start(captureHandle)) < 0)
|
||||
{
|
||||
throw PiPedalStateException("Unable to start ALSA capture.");
|
||||
throw PiPedalStateException(SS("Unable to start ALSA capture. " << snd_strerror(err)));
|
||||
}
|
||||
|
||||
CrashGuardLock crashGuardLock;
|
||||
@@ -1733,6 +1791,7 @@ namespace pipedal
|
||||
this->driverHost->OnUnderrun();
|
||||
|
||||
recover_from_output_underrun(captureHandle, playbackHandle, err, framesRead);
|
||||
framesRead = 0;
|
||||
}
|
||||
cpuUse.AddSample(ProfileCategory::Write);
|
||||
}
|
||||
@@ -2270,36 +2329,6 @@ namespace pipedal
|
||||
#endif
|
||||
}
|
||||
|
||||
struct BufferTrace
|
||||
{
|
||||
snd_pcm_sframes_t inAvail;
|
||||
snd_pcm_sframes_t outAvail;
|
||||
snd_pcm_sframes_t buffered;
|
||||
snd_pcm_sframes_t total;
|
||||
char code;
|
||||
};
|
||||
|
||||
std::vector<BufferTrace> bufferTraces(1000);
|
||||
size_t bufferTraceIndex;
|
||||
|
||||
void AlsaDriverImpl::TraceBuffers(size_t framesInBuffer,char code)
|
||||
{
|
||||
auto inAvail = snd_pcm_avail_update(this->captureHandle);
|
||||
auto outAvail = snd_pcm_avail_update(this->playbackHandle);
|
||||
|
||||
auto total = inAvail + outAvail + framesInBuffer;
|
||||
bufferTraces[bufferTraceIndex++] = {
|
||||
inAvail,
|
||||
outAvail,
|
||||
(snd_pcm_sframes_t)framesInBuffer,
|
||||
(snd_pcm_sframes_t)total,
|
||||
code};
|
||||
if (bufferTraceIndex == bufferTraces.size())
|
||||
{
|
||||
bufferTraceIndex = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void FreeAlsaGlobals()
|
||||
{
|
||||
snd_config_update_free_global(); // to get a clean Valgrind report.
|
||||
|
||||
Reference in New Issue
Block a user