Various Ubuntu changes.

This commit is contained in:
Robin Davies
2021-09-08 13:15:49 -04:00
parent eb0dc52322
commit 210e496ffd
12 changed files with 130 additions and 105 deletions
+1 -1
View File
@@ -58,7 +58,7 @@ set(CPACK_PACKAGE_DESCRIPTION "IoT guitar effect pedal for Raspberry Pi, with ph
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "IoT guitar effect for Raspberry Pi")
set(CPACK_DEBIAN_PACKAGE_SECTION non-free/sound)
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
set(CPACK_DEBIAN_PACKAGE_PREDEPENDS hostapd)
set(CPACK_DEBIAN_PACKAGE_PREDEPENDS hostapd authbind )
set(CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION TRUE)
set(CPACK_PACKAGING_INSTALL_PREFIX /usr/local)
set(CPACK_PROJECT_NAME ${PROJECT_NAME})
+4 -3
View File
@@ -57,13 +57,13 @@ set(CMAKE_CXX_STANDARD_REQUIRED True)
if (CMAKE_BUILD_TYPE MATCHES Debug)
message(STATUS "Debug build")
set (CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-Wno-psabi -fsanitize=address -static-libasan -O0 -DDEBUG" )
set (CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-Wno-psabi -fsanitize=address -static-libasan -O0 -DDEBUG -Werror" )
elseif(CMAKE_BUILD_TYPE MATCHES RelWithDebInfo)
message(STATUS "RelWithgDebInfo build")
set (CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-Wno-psabi" )
set (CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-Wno-psabi -Werror" )
else()
message(STATUS "Release build")
set (CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-Wno-psabi" )
set (CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-Wno-psabi -Werror" )
endif()
@@ -182,6 +182,7 @@ add_executable(pipedalconfig json.cpp json.hpp
SystemConfigFile.hpp SystemConfigFile.cpp
SysExec.hpp SysExec.cpp
asan_options.cpp
Lv2Log.cpp Lv2Log.hpp
)
target_link_libraries(pipedalconfig PRIVATE pthread atomic stdc++fs
+48 -37
View File
@@ -38,8 +38,8 @@ using namespace pipedal;
#define SERVICE_ACCOUNT_NAME "pipedal_d"
#define SERVICE_GROUP_NAME "pipedal_d"
#define JACK_SERVICE_ACCOUNT_NAME "jack"
#define JACK_SERVICE_GROUP_NAME "jack"
#define AUDIO_SERVICE_GROUP_NAME "audio"
#define JACK_SERVICE_GROUP_NAME AUDIO_SERVICE_GROUP_NAME
#define SYSTEMCTL_BIN "/usr/bin/systemctl"
#define GROUPADD_BIN "/usr/sbin/groupadd"
@@ -86,22 +86,22 @@ std::filesystem::path findOnPath(const std::string &command)
void EnableService()
{
if (SysExec(SYSTEMCTL_BIN " enable " NATIVE_SERVICE ".service") != EXIT_SUCCESS)
if (sysExec(SYSTEMCTL_BIN " enable " NATIVE_SERVICE ".service") != EXIT_SUCCESS)
{
cout << "Error: Failed to enable the " NATIVE_SERVICE " service.";
}
if (SysExec(SYSTEMCTL_BIN " enable " SHUTDOWN_SERVICE ".service") != EXIT_SUCCESS)
if (sysExec(SYSTEMCTL_BIN " enable " SHUTDOWN_SERVICE ".service") != EXIT_SUCCESS)
{
cout << "Error: Failed to enable the " SHUTDOWN_SERVICE " service.";
}
}
void DisableService()
{
if (SysExec(SYSTEMCTL_BIN " disable " NATIVE_SERVICE ".service") != EXIT_SUCCESS)
if (sysExec(SYSTEMCTL_BIN " disable " NATIVE_SERVICE ".service") != EXIT_SUCCESS)
{
cout << "Error: Failed to disable the " NATIVE_SERVICE " service.";
}
if (SysExec(SYSTEMCTL_BIN " disable " SHUTDOWN_SERVICE ".service") != EXIT_SUCCESS)
if (sysExec(SYSTEMCTL_BIN " disable " SHUTDOWN_SERVICE ".service") != EXIT_SUCCESS)
{
cout << "Error: Failed to disable the " SHUTDOWN_SERVICE " service.";
}
@@ -109,18 +109,18 @@ void DisableService()
void StopService(bool excludeShutdownService = false)
{
if (SysExec(SYSTEMCTL_BIN " stop " NATIVE_SERVICE ".service") != EXIT_SUCCESS)
if (sysExec(SYSTEMCTL_BIN " stop " NATIVE_SERVICE ".service") != EXIT_SUCCESS)
{
cout << "Error: Failed to stop the " NATIVE_SERVICE " service.";
}
if (!excludeShutdownService)
{
if (SysExec(SYSTEMCTL_BIN " stop " SHUTDOWN_SERVICE ".service") != EXIT_SUCCESS)
if (sysExec(SYSTEMCTL_BIN " stop " SHUTDOWN_SERVICE ".service") != EXIT_SUCCESS)
{
cout << "Error: Failed to stop the " SHUTDOWN_SERVICE " service.";
}
}
if (SysExec(SYSTEMCTL_BIN " stop " JACK_SERVICE ".service") != EXIT_SUCCESS)
if (sysExec(SYSTEMCTL_BIN " stop " JACK_SERVICE ".service") != EXIT_SUCCESS)
{
throw PiPedalException("Failed to stop the " JACK_SERVICE " service.");
}
@@ -130,22 +130,25 @@ void Uninstall()
{
StopService();
DisableService();
system(SYSTEMCTL_BIN " stop jack");
system(SYSTEMCTL_BIN " disable jack");
silentSysExec(SYSTEMCTL_BIN " stop jack");
silentSysExec(SYSTEMCTL_BIN " disable jack");
std::filesystem::remove("/usr/bin/systemd/system/" SHUTDOWN_SERVICE ".service");
std::filesystem::remove("/usr/bin/systemd/system/" NATIVE_SERVICE ".service");
std::filesystem::remove("/usr/bin/systemd/system/" JACK_SERVICE ".service");
}
void StartService(bool excludeShutdownService = false)
{
SilentSysExec("/usr/bin/pulseaudio --kill"); // interferes with Jack audio service startup.
silentSysExec("/usr/bin/pulseaudio --kill"); // interferes with Jack audio service startup.
if (!excludeShutdownService)
{
if (SysExec(SYSTEMCTL_BIN " start " SHUTDOWN_SERVICE ".service") != EXIT_SUCCESS)
if (sysExec(SYSTEMCTL_BIN " start " SHUTDOWN_SERVICE ".service") != EXIT_SUCCESS)
{
throw PiPedalException("Failed to start the " SHUTDOWN_SERVICE " service.");
}
}
if (SysExec(SYSTEMCTL_BIN " start " NATIVE_SERVICE ".service") != EXIT_SUCCESS)
if (sysExec(SYSTEMCTL_BIN " start " NATIVE_SERVICE ".service") != EXIT_SUCCESS)
{
throw PiPedalException("Failed to start the " NATIVE_SERVICE " service.");
}
@@ -153,7 +156,7 @@ void StartService(bool excludeShutdownService = false)
serverSettings.ReadJackConfiguration();
if (serverSettings.IsValid())
{
if (SysExec(SYSTEMCTL_BIN " start " JACK_SERVICE ".service") != EXIT_SUCCESS)
if (sysExec(SYSTEMCTL_BIN " start " JACK_SERVICE ".service") != EXIT_SUCCESS)
{
throw PiPedalException("Failed to start the " JACK_SERVICE " service.");
}
@@ -195,7 +198,7 @@ static bool userExists(const char *userName)
void InstallPamEnv()
{
std::string newLine = "JACK_PROMISCOUS_SERVER DEFAULT=jack";
std::string newLine = "JACK_PROMISCUOUS_SERVER DEFAULT=" JACK_SERVICE_GROUP_NAME;
std::vector<std::string> lines;
std::filesystem::path path = "/etc/security/pam_env.conf";
try
@@ -248,7 +251,7 @@ void InstallPamEnv()
void InstallLimits()
{
if (SysExec(GROUPADD_BIN " -f " AUDIO_SERVICE_GROUP_NAME) != EXIT_SUCCESS)
if (sysExec(GROUPADD_BIN " -f " AUDIO_SERVICE_GROUP_NAME) != EXIT_SUCCESS)
{
throw PiPedalException("Failed to create audio service group.");
}
@@ -270,34 +273,34 @@ void MaybeStartJackService()
if (std::filesystem::exists(drcFile) && std::filesystem::file_size(drcFile) != 0)
{
system(SYSTEMCTL_BIN " start jack");
sysExec(SYSTEMCTL_BIN " start jack");
}
else
{
system(SYSTEMCTL_BIN " mask jack");
silentSysExec(SYSTEMCTL_BIN " mask jack");
}
}
void InstallJackService()
{
InstallLimits();
InstallPamEnv();
if (SysExec(GROUPADD_BIN " -f " JACK_SERVICE_GROUP_NAME) != EXIT_SUCCESS)
if (sysExec(GROUPADD_BIN " -f " JACK_SERVICE_GROUP_NAME) != EXIT_SUCCESS)
{
throw PiPedalException("Failed to create jack service group.");
}
if (!userExists(JACK_SERVICE_ACCOUNT_NAME))
{
if (SysExec(USERADD_BIN " " JACK_SERVICE_ACCOUNT_NAME " -g " JACK_SERVICE_GROUP_NAME " -M -N -r") != EXIT_SUCCESS)
if (sysExec(USERADD_BIN " " JACK_SERVICE_ACCOUNT_NAME " -g " JACK_SERVICE_GROUP_NAME " -M -N -r") != EXIT_SUCCESS)
{
// throw PiPedalException("Failed to create service account.");
}
// lock account for login.
SysExec("passwd -l " JACK_SERVICE_ACCOUNT_NAME);
silentSysExec("passwd -l " JACK_SERVICE_ACCOUNT_NAME);
}
// Add to audio groups.
SysExec(USERMOD_BIN " -a -G " JACK_SERVICE_GROUP_NAME " " JACK_SERVICE_ACCOUNT_NAME);
SysExec(USERMOD_BIN " -a -G" AUDIO_SERVICE_GROUP_NAME " " JACK_SERVICE_ACCOUNT_NAME);
// sysExec(USERMOD_BIN " -a -G " JACK_SERVICE_GROUP_NAME " " JACK_SERVICE_ACCOUNT_NAME);
sysExec(USERMOD_BIN " -a -G" AUDIO_SERVICE_GROUP_NAME " " JACK_SERVICE_ACCOUNT_NAME);
// deploy the systemd service file
std::map<std::string, std::string> map; // nothing to customize.
@@ -309,6 +312,10 @@ void InstallJackService()
void Install(const std::filesystem::path &programPrefix, const std::string endpointAddress)
{
if (sysExec(GROUPADD_BIN " -f " AUDIO_SERVICE_GROUP_NAME) != EXIT_SUCCESS)
{
throw PiPedalException("Failed to create audio service group.");
}
InstallJackService();
auto endpos = endpointAddress.find_last_of(':');
@@ -341,23 +348,23 @@ void Install(const std::filesystem::path &programPrefix, const std::string endpo
// Create and configure service account.
if (SysExec(GROUPADD_BIN " -f " SERVICE_GROUP_NAME) != EXIT_SUCCESS)
if (sysExec(GROUPADD_BIN " -f " SERVICE_GROUP_NAME) != EXIT_SUCCESS)
{
throw PiPedalException("Failed to create service group.");
}
if (!userExists(SERVICE_ACCOUNT_NAME))
{
if (SysExec(USERADD_BIN " " SERVICE_ACCOUNT_NAME " -g " SERVICE_GROUP_NAME " -M -N -r") != EXIT_SUCCESS)
if (sysExec(USERADD_BIN " " SERVICE_ACCOUNT_NAME " -g " SERVICE_GROUP_NAME " -M -N -r") != EXIT_SUCCESS)
{
// throw PiPedalException("Failed to create service account.");
}
// lock account for login.
SysExec("passwd -l " SERVICE_ACCOUNT_NAME);
silentSysExec("passwd -l " SERVICE_ACCOUNT_NAME);
}
// Add to audio groups.
SysExec(USERMOD_BIN " -a -G jack " SERVICE_ACCOUNT_NAME);
SysExec(USERMOD_BIN " -a -G audio " SERVICE_ACCOUNT_NAME);
sysExec(USERMOD_BIN " -a -G " AUDIO_SERVICE_GROUP_NAME " " SERVICE_ACCOUNT_NAME);
// create and configure /var directory.
@@ -367,51 +374,55 @@ void Install(const std::filesystem::path &programPrefix, const std::string endpo
{
std::stringstream s;
s << CHGRP_BIN " " SERVICE_GROUP_NAME " " << varDirectory.c_str();
SysExec(s.str().c_str());
sysExec(s.str().c_str());
}
{
std::stringstream s;
s << CHOWN_BIN << " " << SERVICE_ACCOUNT_NAME << " " << varDirectory.c_str();
SysExec(s.str().c_str());
sysExec(s.str().c_str());
}
{
std::stringstream s;
s << CHMOD_BIN << " 775 " << varDirectory.c_str();
SysExec(s.str().c_str());
sysExec(s.str().c_str());
}
{
std::stringstream s;
s << CHMOD_BIN << " g+s " << varDirectory.c_str(); // child files/directories inherit ownership.
SysExec(s.str().c_str());
sysExec(s.str().c_str());
}
// authbind port.
if (authBindRequired)
{
std::filesystem::create_directories("/etc/authbind/byport");
std::filesystem::path portAuthFile = std::filesystem::path("/etc/authbind/byport") / strPort;
{
// create it.
std::ofstream f(portAuthFile);
if (!f.is_open()) {
throw PiPedalException("Failed to create " + portAuthFile.string());
}
}
{
// own it.
std::stringstream s;
s << CHOWN_BIN << " " SERVICE_ACCOUNT_NAME " " << portAuthFile.c_str();
SysExec(s.str().c_str());
sysExec(s.str().c_str());
}
{
// group own it.
std::stringstream s;
s << CHGRP_BIN << " " SERVICE_GROUP_NAME " " << portAuthFile.c_str();
SysExec(s.str().c_str());
sysExec(s.str().c_str());
}
{
std::stringstream s;
s << CHMOD_BIN << " 770 " << portAuthFile.c_str();
SysExec(s.str().c_str());
sysExec(s.str().c_str());
}
}
@@ -448,7 +459,7 @@ void Install(const std::filesystem::path &programPrefix, const std::string endpo
}
WriteTemplateFile(map, std::filesystem::path("/etc/pipedal/templateShutdown.service"), GetServiceFileName(SHUTDOWN_SERVICE));
SysExec(SYSTEMCTL_BIN " daemon-reload");
sysExec(SYSTEMCTL_BIN " daemon-reload");
cout << "Starting service" << endl;
RestartService(false);
@@ -607,7 +618,7 @@ int main(int argc, char **argv)
std::string pkexec = "/usr/bin/pkexec"; // staged because "ISO C++ forbids converting a string constant to std::vector<char*>::value_type"(!)
args.push_back((char *)(pkexec.c_str()));
std::string sPath = GetSelfExePath();
std::string sPath = getSelfExePath();
args.push_back(const_cast<char *>(sPath.c_str()));
for (int arg = 1; arg < argc; ++arg)
{
+7 -4
View File
@@ -25,6 +25,8 @@
#include <string>
#include "unistd.h"
#include <filesystem>
#include "Lv2Log.hpp"
#include "SysExec.hpp"
#define DRC_FILENAME "/etc/jackdrc"
@@ -205,7 +207,7 @@ void JackServerSettings::Write()
{
// jack1 incantation for promiscuous servers.
output << "#!/bin/sh" <<endl;
output << "export JACK_PROMISCUOUS_SERVER=jack" << endl;
output << "export JACK_PROMISCUOUS_SERVER=audio" << endl;
output << "export JACK_NO_AUDIO_RESERVATION=1" << endl;
output << "umask 0" << endl;
}
@@ -222,9 +224,10 @@ void JackServerSettings::Write()
<< " -p" << this->bufferSize_
<< " -n" << this->numberOfBuffers_ << " -Xseq"
<< endl;
system("/usr/bin/chmod 755 " DRC_FILENAME);
system("/usr/bin/systemctl unmask jack");
system("/usr/bin/systemctl enable jack");
if (silentSysExec("/usr/bin/chmod 755 " DRC_FILENAME) != 0)
{
Lv2Log::error("Failed to set permissions on /etc/jackdrc");
}
}
catch (const std::exception &e)
{
+7 -1
View File
@@ -880,7 +880,6 @@ void PiPedalModel::SetJackServerSettings(const JackServerSettings &jackServerSet
this->jackServerSettings = jackServerSettings;
// take a snapshot incase a client unsusbscribes in the notification handler (in which case the mutex won't protect us)
IPiPedalModelSubscriber **t = new IPiPedalModelSubscriber *[this->subscribers.size()];
for (size_t i = 0; i < subscribers.size(); ++i)
@@ -896,6 +895,13 @@ void PiPedalModel::SetJackServerSettings(const JackServerSettings &jackServerSet
if (ShutdownClient::CanUseShutdownClient())
{
// save the current (edited) preset now in case the service shutdown isn't clean.
CurrentPreset currentPreset;
currentPreset.modified_ = this->hasPresetChanged;
currentPreset.preset_ = this->pedalBoard;
storage.SaveCurrentPreset(currentPreset);
this->jackConfiguration.SetIsRestarting(true);
fireJackConfigurationChanged(this->jackConfiguration);
this->jackHost->UpdateServerConfiguration(
+1 -1
View File
@@ -298,7 +298,7 @@ static void requestShutdown(bool restart)
}
s << " now";
if (SysExec(s.str().c_str()) != EXIT_SUCCESS)
if (sysExec(s.str().c_str()) != EXIT_SUCCESS)
{
Lv2Log::error("shutdown failed.");
if (restart) {
+16 -16
View File
@@ -37,11 +37,11 @@ void pipedal::SetWifiConfig(const WifiConfigSettings&settings)
char band;
if (!settings.enable_)
{
SysExec(SYSTEMCTL_BIN " stop hostapd");
SysExec(SYSTEMCTL_BIN " disable hostapd");
sysExec(SYSTEMCTL_BIN " stop hostapd");
sysExec(SYSTEMCTL_BIN " disable hostapd");
SysExec(SYSTEMCTL_BIN " enable wpa_supplicant");
SysExec(SYSTEMCTL_BIN " start wpa_supplicant");
sysExec(SYSTEMCTL_BIN " enable wpa_supplicant");
sysExec(SYSTEMCTL_BIN " start wpa_supplicant");
} else {
std::filesystem::path path("/etc/hostapd/hostapd.conf");
SystemConfigFile apdConfig;
@@ -167,29 +167,29 @@ void pipedal::SetWifiConfig(const WifiConfigSettings&settings)
// **************** start services ************
SysExec("rfkill unblock wlan");
SysExec(SYSTEMCTL_BIN " daemon-reload");
sysExec("rfkill unblock wlan");
sysExec(SYSTEMCTL_BIN " daemon-reload");
SysExec(SYSTEMCTL_BIN " mask wpa_supplicant");
SysExec(SYSTEMCTL_BIN " stop wpa_supplicant");
sysExec(SYSTEMCTL_BIN " mask wpa_supplicant");
sysExec(SYSTEMCTL_BIN " stop wpa_supplicant");
SysExec(SYSTEMCTL_BIN " unmask hostapd");
if (SysExec(SYSTEMCTL_BIN " restart hostapd") != 0)
sysExec(SYSTEMCTL_BIN " unmask hostapd");
if (sysExec(SYSTEMCTL_BIN " restart hostapd") != 0)
{
throw PiPedalException("Unable to start the access point.");
}
if (SysExec("systemctl is-active --quiet hostapd") != 0)
if (sysExec("systemctl is-active --quiet hostapd") != 0)
{
throw PiPedalException("Unable to start the access point.");
}
SysExec(SYSTEMCTL_BIN " enable hostapd");
sysExec(SYSTEMCTL_BIN " enable hostapd");
SysExec(SYSTEMCTL_BIN " stop wpa_supplicant");
SysExec(SYSTEMCTL_BIN " mask wpa_supplicant");
sysExec(SYSTEMCTL_BIN " stop wpa_supplicant");
sysExec(SYSTEMCTL_BIN " mask wpa_supplicant");
SysExec(SYSTEMCTL_BIN " restart dnsmasq");
SysExec(SYSTEMCTL_BIN " enable dnsmasq");
sysExec(SYSTEMCTL_BIN " restart dnsmasq");
sysExec(SYSTEMCTL_BIN " enable dnsmasq");
}
+6 -3
View File
@@ -87,7 +87,7 @@ void delayedRestartProc()
{
sleep(1); // give a chance for websocket messages to propagate.
Lv2Log::error("Delayed Restart");
std::string pipedalConfigPath = std::filesystem::path(GetSelfExePath()).parent_path() / "pipedalconfig";
std::string pipedalConfigPath = std::filesystem::path(getSelfExePath()).parent_path() / "pipedalconfig";
std::stringstream s;
s << pipedalConfigPath.c_str() << " --restart --excludeShutdownService";
@@ -104,6 +104,9 @@ bool setJackConfiguration(JackServerSettings serverSettings)
serverSettings.Write();
silentSysExec("/usr/bin/systemctl unmask jack");
silentSysExec("/usr/bin/systemctl enable jack");
std::thread delayedRestartThread(delayedRestartProc);
delayedRestartThread.detach();
return true;
@@ -241,11 +244,11 @@ private:
} else if (s == "shutdown")
{
result = SysExec("/usr/sbin/shutdown -P now");
result = sysExec("/usr/sbin/shutdown -P now");
}
else if (s == "restart")
{
result = SysExec("/usr/sbin/shutdown -r now");
result = sysExec("/usr/sbin/shutdown -r now");
} else if (startsWith(s,"setJackConfiguration "))
{
auto remainder = s.substr(strlen("setJackConfiguration "));
+31 -31
View File
@@ -117,66 +117,66 @@ namespace pipedal
}
}
void AbTopMonoMono(uint32_t frames)
void abTopMonoMono(uint32_t frames)
{
Copy(this->inputs[0], this->topInputs[0], frames);
}
void AbTopMonoStereo(uint32_t frames)
void abTopMonoStereo(uint32_t frames)
{
Copy(this->inputs[0], this->topInputs[0], frames);
Copy(this->inputs[0], this->topInputs[1], frames);
}
void AbTopStereoStereo(uint32_t frames)
void abTopStereoStereo(uint32_t frames)
{
Copy(this->inputs[0], this->topInputs[0], frames);
Copy(this->inputs[1], this->topInputs[1], frames);
}
void AbBottomMonoMono(uint32_t frames)
void abBottomMonoMono(uint32_t frames)
{
Copy(this->inputs[0], this->bottomInputs[0], frames);
}
void AbBottomMonoStereo(uint32_t frames)
void abBottomMonoStereo(uint32_t frames)
{
Copy(this->inputs[0], this->bottomInputs[0], frames);
Copy(this->inputs[0], this->bottomInputs[1], frames);
}
void AbBottomStereoStereo(uint32_t frames)
void abBottomStereoStereo(uint32_t frames)
{
Copy(this->inputs[0], this->bottomInputs[0], frames);
Copy(this->inputs[1], this->bottomInputs[1], frames);
}
void LrTopMonoMono(uint32_t frames)
void lrTopMonoMono(uint32_t frames)
{
Copy(this->inputs[0], this->topInputs[0], frames);
}
void LrTopMonoStereo(uint32_t frames)
void lrTopMonoStereo(uint32_t frames)
{
Copy(this->inputs[0], this->topInputs[0], frames);
Copy(this->inputs[0], this->topInputs[1], frames);
}
void LrTopStereoStereo(uint32_t frames)
void lrTopStereoStereo(uint32_t frames)
{
Copy(this->inputs[0], this->topInputs[0], frames);
Copy(this->inputs[0], this->topInputs[1], frames);
}
void LrBottomMonoMono(uint32_t frames)
void lrBottomMonoMono(uint32_t frames)
{
Copy(this->inputs[0], this->bottomInputs[0], frames);
}
void LrBottomMonoStereo(uint32_t frames)
void lrBottomMonoStereo(uint32_t frames)
{
Copy(this->inputs[0], this->bottomInputs[0], frames);
Copy(this->inputs[0], this->bottomInputs[1], frames);
}
void LrBottomStereoStereo(uint32_t frames)
void lrBottomStereoStereo(uint32_t frames)
{
Copy(this->inputs[1], this->bottomInputs[0], frames);
Copy(this->inputs[1], this->bottomInputs[1], frames);
}
void UpdateMixFunction()
void updateMixFunction()
{
if (activated)
{
@@ -187,37 +187,37 @@ namespace pipedal
if (this->inputs.size() == 1)
{
if (this->topInputs.size() == 1)
this->preAbTop = &SplitEffect::AbTopMonoMono;
this->preAbTop = &SplitEffect::abTopMonoMono;
else
{
this->preAbTop = &SplitEffect::AbTopMonoStereo;
this->preAbTop = &SplitEffect::abTopMonoStereo;
}
if (this->bottomInputs.size() == 1)
{
this->preAbBottom = &SplitEffect::AbBottomMonoMono;
this->preAbBottom = &SplitEffect::abBottomMonoMono;
}
else
{
this->preAbBottom = &SplitEffect::AbBottomMonoStereo;
this->preAbBottom = &SplitEffect::abBottomMonoStereo;
}
}
else
{
if (this->topInputs.size() == 1)
{
this->preAbTop == &SplitEffect::AbTopMonoMono;
this->preAbTop == &SplitEffect::abTopMonoMono;
}
else
{
this->preAbTop = &SplitEffect::AbTopStereoStereo;
this->preAbTop = &SplitEffect::abTopStereoStereo;
}
if (this->bottomInputs.size() == 1)
{
this->preAbBottom == &SplitEffect::AbBottomMonoMono;
this->preAbBottom == &SplitEffect::abBottomMonoMono;
}
else
{
this->preAbBottom = &SplitEffect::AbBottomStereoStereo;
this->preAbBottom = &SplitEffect::abBottomStereoStereo;
}
}
}
@@ -226,37 +226,37 @@ namespace pipedal
if (this->inputs.size() == 1)
{
if (this->topInputs.size() == 1)
this->preAbTop = &SplitEffect::LrTopMonoMono;
this->preAbTop = &SplitEffect::lrTopMonoMono;
else
{
this->preAbTop = &SplitEffect::LrTopMonoStereo;
this->preAbTop = &SplitEffect::lrTopMonoStereo;
}
if (this->bottomInputs.size() == 1)
{
this->preAbBottom = &SplitEffect::LrBottomMonoMono;
this->preAbBottom = &SplitEffect::lrBottomMonoMono;
}
else
{
this->preAbBottom = &SplitEffect::LrBottomMonoStereo;
this->preAbBottom = &SplitEffect::lrBottomMonoStereo;
}
}
else
{
if (this->topInputs.size() == 1)
{
this->preAbTop == &SplitEffect::LrTopMonoMono;
this->preAbTop == &SplitEffect::lrTopMonoMono;
}
else
{
this->preAbTop = &SplitEffect::LrTopStereoStereo;
this->preAbTop = &SplitEffect::lrTopStereoStereo;
}
if (this->bottomInputs.size() == 1)
{
this->preAbBottom == &SplitEffect::LrBottomMonoMono;
this->preAbBottom == &SplitEffect::lrBottomMonoMono;
}
else
{
this->preAbBottom = &SplitEffect::LrBottomStereoStereo;
this->preAbBottom = &SplitEffect::lrBottomStereoStereo;
}
}
}
@@ -303,7 +303,7 @@ namespace pipedal
void Activate()
{
activated = true;
UpdateMixFunction();
updateMixFunction();
snapToMixTarget();
mixBottomInputs.clear();
@@ -471,7 +471,7 @@ namespace pipedal
if (splitType != t)
{
splitType = t;
UpdateMixFunction();
updateMixFunction();
}
break;
}
+5 -4
View File
@@ -63,7 +63,7 @@ static std::filesystem::path findOnSystemPath(const std::string &command)
throw PiPedalException(s.str());
}
void pipedal::SilentSysExec(const char *szCommand)
int pipedal::silentSysExec(const char *szCommand)
{
std::stringstream s;
s << szCommand << " 2>&1";
@@ -76,10 +76,11 @@ void pipedal::SilentSysExec(const char *szCommand)
{
fgets(buffer, sizeof(buffer), output);
}
pclose(output);
return pclose(output);
}
return -1;
}
int pipedal::SysExec(const char *szCommand)
int pipedal::sysExec(const char *szCommand)
{
char *args = strdup(szCommand);
int argc;
@@ -135,7 +136,7 @@ int pipedal::SysExec(const char *szCommand)
}
std::string pipedal::GetSelfExePath()
std::string pipedal::getSelfExePath()
{
char result[PATH_MAX+1];
ssize_t count = readlink("/proc/self/exe", result, PATH_MAX);
+3 -3
View File
@@ -22,10 +22,10 @@
namespace pipedal {
// exec a command, returning the actual exit code (unlike execXX() or system() )
int SysExec(const char*szCommand);
int sysExec(const char*szCommand);
// execute a command, suppressing output.
void SilentSysExec(const char *szCommand);
int silentSysExec(const char *szCommand);
std::string GetSelfExePath();
std::string getSelfExePath();
}
+1 -1
View File
@@ -16,7 +16,7 @@ Group=jack
Restart=always
RestartSec=15
Environment=JACK_PROMISCUOUS_SERVER=jack
Environment=JACK_PROMISCUOUS_SERVER=audio
Environment=JACK_NO_AUDIO_RESERVATION=1