opening slow audio devices on boot
This commit is contained in:
+1
-1
@@ -1961,7 +1961,7 @@ namespace pipedal
|
||||
for (int retry = 0; retry < 15; ++retry)
|
||||
{
|
||||
err = snd_pcm_open(&playbackHandle, alsaDeviceName.c_str(), SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK);
|
||||
if (err == -EBUSY)
|
||||
if (err < 0) // field report of a device that is present, but won't immediately open.
|
||||
{
|
||||
sleep(1);
|
||||
continue;
|
||||
|
||||
+10
-7
@@ -603,12 +603,19 @@ void SetVarPermissions(
|
||||
using namespace std::filesystem;
|
||||
try {
|
||||
if (fs::exists(path)) {
|
||||
|
||||
chown(path.c_str(),uid,gid);
|
||||
if (fs::is_directory(path)) {
|
||||
fs::permissions(path, directoryPermissions, fs::perm_options::replace);
|
||||
for (const auto& entry : fs::recursive_directory_iterator(path)) {
|
||||
cout << " " << entry.path() << endl;
|
||||
|
||||
if (chown(entry.path().c_str(),uid,gid) != 0)
|
||||
{
|
||||
std::cout << "Error: failed to set ownership of file " << entry.path() << std::endl;
|
||||
}
|
||||
|
||||
try {
|
||||
if (fs::is_directory(entry))
|
||||
if (fs::is_directory(entry.path()))
|
||||
{
|
||||
fs::permissions(entry.path(), directoryPermissions, fs::perm_options::replace);
|
||||
} else {
|
||||
@@ -618,15 +625,11 @@ void SetVarPermissions(
|
||||
{
|
||||
std::cout << "Error: failed to set permissions on file " << entry.path() << std::endl;
|
||||
}
|
||||
if (chown(path.c_str(),uid,gid) != 0)
|
||||
{
|
||||
std::cout << "Error: failed to set ownership of file " << entry.path() << std::endl;
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
fs::permissions(path,filePermissions, fs::perm_options::replace);
|
||||
chown(path.c_str(),uid,gid);
|
||||
|
||||
}
|
||||
} else {
|
||||
std::cout << "Error: Path does not exist: " << path << std::endl;
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace pipedal
|
||||
std::string alsaDevice_;
|
||||
uint64_t sampleRate_ = 0;
|
||||
uint32_t bufferSize_ = 64;
|
||||
uint32_t numberOfBuffers_ = 2;
|
||||
uint32_t numberOfBuffers_ = 3;
|
||||
|
||||
public:
|
||||
JackServerSettings();
|
||||
|
||||
+7
-1
@@ -701,7 +701,10 @@ int main(int argc, char *argv[])
|
||||
// wait up to 15 seconds for the midi device to come online.
|
||||
auto devices = model.GetAlsaDevices();
|
||||
bool found = false;
|
||||
if (!HasAlsaDevice(devices, serverSettings.GetAlsaInputDevice()))
|
||||
if (HasAlsaDevice(devices, serverSettings.GetAlsaInputDevice()))
|
||||
{
|
||||
Lv2Log::info(SS("Found ALSA device " << serverSettings.GetAlsaInputDevice() << "."));
|
||||
} else
|
||||
{
|
||||
for (int i = 0; i < 5; ++i)
|
||||
{
|
||||
@@ -727,6 +730,9 @@ int main(int argc, char *argv[])
|
||||
Lv2Log::info(SS("ALSA device " << serverSettings.GetAlsaInputDevice() << " not found."));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Lv2Log::info("No ALSA device selected.");
|
||||
|
||||
}
|
||||
|
||||
// pre-cache device info before we let audio services run.
|
||||
|
||||
Reference in New Issue
Block a user