pipedald uses service.conf instead of a commandline option.
This commit is contained in:
+1
-1
@@ -1315,7 +1315,7 @@ namespace pipedal
|
||||
throw PiPedalStateException(SS("ALSA error:" << snd_strerror(err)));
|
||||
}
|
||||
|
||||
std::jthread *audioThread;
|
||||
std::jthread *audioThread = nullptr;
|
||||
bool audioRunning;
|
||||
|
||||
bool block = false;
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 Robin E. R. Davies
|
||||
* Copyright (c) 2022 Robin E. R. Davies
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
|
||||
+1
-1
@@ -951,7 +951,7 @@ void Install(const fs::path &programPrefix, const std::string endpointAddress)
|
||||
}
|
||||
s
|
||||
<< (programPrefix / "sbin" / PIPEDALD_SERVICE).string()
|
||||
<< " /etc/pipedal/config /etc/pipedal/react -port " << endpointAddress << " -systemd";
|
||||
<< " /etc/pipedal/config /etc/pipedal/react -systemd";
|
||||
|
||||
map["COMMAND"] = s.str();
|
||||
}
|
||||
|
||||
+18
-18
@@ -118,7 +118,7 @@ std::vector<AlsaDeviceInfo> PiPedalAlsaDevices::GetAlsaDevices()
|
||||
if (err == 0)
|
||||
{
|
||||
unsigned int minRate = 0, maxRate = 0;
|
||||
snd_pcm_uframes_t minBufferSize, maxBufferSize;
|
||||
snd_pcm_uframes_t minBufferSize = 0, maxBufferSize = 0;
|
||||
int dir;
|
||||
err = snd_pcm_hw_params_get_rate_min(params, &minRate, &dir);
|
||||
if (err == 0)
|
||||
@@ -143,6 +143,10 @@ std::vector<AlsaDeviceInfo> PiPedalAlsaDevices::GetAlsaDevices()
|
||||
info.sampleRates_.push_back(rate);
|
||||
}
|
||||
}
|
||||
if (minBufferSize < 16) {
|
||||
minBufferSize = 16;
|
||||
}
|
||||
|
||||
info.minBufferSize_ = (uint32_t)minBufferSize;
|
||||
info.maxBufferSize_ = (uint32_t)maxBufferSize;
|
||||
cacheDevice(info.name_, info);
|
||||
@@ -169,15 +173,14 @@ std::vector<AlsaDeviceInfo> PiPedalAlsaDevices::GetAlsaDevices()
|
||||
snd_config_update_free_global();
|
||||
|
||||
Lv2Log::debug("GetAlsaDevices --");
|
||||
for (auto& device: result)
|
||||
for (auto &device : result)
|
||||
{
|
||||
Lv2Log::debug(SS(" " << device.name_ << " " << device.longName_ << " " << device.cardId_));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
static std::vector<AlsaMidiDeviceInfo> GetAlsaDevices(const char*devname, const char*direction)
|
||||
static std::vector<AlsaMidiDeviceInfo> GetAlsaDevices(const char *devname, const char *direction)
|
||||
{
|
||||
std::vector<AlsaMidiDeviceInfo> result;
|
||||
{
|
||||
@@ -206,9 +209,9 @@ static std::vector<AlsaMidiDeviceInfo> GetAlsaDevices(const char*devname, const
|
||||
|
||||
if (desc != nullptr) // skip virtual device
|
||||
{
|
||||
if (ioid == nullptr || strcmp(ioid,direction) == 0)
|
||||
if (ioid == nullptr || strcmp(ioid, direction) == 0)
|
||||
{
|
||||
result.push_back(AlsaMidiDeviceInfo(name,desc));
|
||||
result.push_back(AlsaMidiDeviceInfo(name, desc));
|
||||
}
|
||||
}
|
||||
if (name && strcmp("null", name) != 0)
|
||||
@@ -226,40 +229,37 @@ static std::vector<AlsaMidiDeviceInfo> GetAlsaDevices(const char*devname, const
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
std::vector<AlsaMidiDeviceInfo> pipedal::GetAlsaMidiInputDevices()
|
||||
{
|
||||
return GetAlsaDevices("rawmidi","Input");
|
||||
return GetAlsaDevices("rawmidi", "Input");
|
||||
}
|
||||
std::vector<AlsaMidiDeviceInfo> pipedal::GetAlsaMidiOutputDevices()
|
||||
{
|
||||
return GetAlsaDevices("rawmidi","Output");
|
||||
return GetAlsaDevices("rawmidi", "Output");
|
||||
}
|
||||
|
||||
AlsaMidiDeviceInfo::AlsaMidiDeviceInfo(const char*name, const char*description)
|
||||
:name_(name)
|
||||
AlsaMidiDeviceInfo::AlsaMidiDeviceInfo(const char *name, const char *description)
|
||||
: name_(name)
|
||||
{
|
||||
// extract just the display name from description.
|
||||
// undocumented but e.g.: M2, M2\nM2 Raw Midi
|
||||
const char *p = description;
|
||||
const char *pEnd = p;
|
||||
// undocumented but e.g.: M2, M2\nM2 Raw Midi
|
||||
while (pEnd != nullptr && *pEnd != 0
|
||||
&& *pEnd != ','
|
||||
&& *pEnd != '\n'
|
||||
)
|
||||
while (pEnd != nullptr && *pEnd != 0 && *pEnd != ',' && *pEnd != '\n')
|
||||
{
|
||||
++pEnd;
|
||||
}
|
||||
if (p != pEnd)
|
||||
{
|
||||
description_ = std::string(p,pEnd);
|
||||
} else {
|
||||
description_ = std::string(p, pEnd);
|
||||
}
|
||||
else
|
||||
{
|
||||
description = name;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
JSON_MAP_BEGIN(AlsaDeviceInfo)
|
||||
JSON_MAP_REFERENCE(AlsaDeviceInfo, cardId)
|
||||
JSON_MAP_REFERENCE(AlsaDeviceInfo, id)
|
||||
|
||||
@@ -559,11 +559,6 @@ void UninstallP2p()
|
||||
|
||||
}
|
||||
|
||||
WifiDirectConfigSettings wifiDirectConfigSettings;
|
||||
wifiDirectConfigSettings.Load();
|
||||
wifiDirectConfigSettings.enable_ = false;
|
||||
SetWifiDirectConfig(wifiDirectConfigSettings);
|
||||
|
||||
}
|
||||
::sync();
|
||||
}
|
||||
@@ -655,7 +650,7 @@ static void ConfigDhcpcdForP2p()
|
||||
}
|
||||
void pipedal::SetWifiDirectConfig(const WifiDirectConfigSettings &settings)
|
||||
{
|
||||
|
||||
settings.Save();
|
||||
try
|
||||
{
|
||||
char band;
|
||||
@@ -675,7 +670,6 @@ void pipedal::SetWifiDirectConfig(const WifiDirectConfigSettings &settings)
|
||||
else
|
||||
{
|
||||
InstallP2p(settings);
|
||||
sysExec(SYSTEMCTL_BIN " restart pipedald");
|
||||
}
|
||||
}
|
||||
catch (const std::exception &e)
|
||||
|
||||
+6
-1
@@ -1252,7 +1252,12 @@ namespace pipedal
|
||||
|
||||
for (auto it = m_connections.begin(); it != m_connections.end(); ++it)
|
||||
{
|
||||
m_endpoint.close(*it, websocketpp::close::status::normal, "");
|
||||
try {
|
||||
m_endpoint.close(*it, websocketpp::close::status::normal, "");
|
||||
} catch (const std::exception&ignored)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user