MCPcopy Create free account
hub / github.com/Audio4Linux/JDSP4Linux / updateConvolver

Method updateConvolver

src/audio/base/DspHost.cpp:328–446  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

326}
327
328void DspHost::updateConvolver(DspConfig *config)
329{
330 bool fileExists;
331 bool waveEditExists;
332 bool optModeExists;
333 bool enableExists;
334
335 QString file = chopDoubleQuotes(config->get<QString>(DspConfig::convolver_file, &fileExists));
336 QString waveEdit = chopDoubleQuotes(config->get<QString>(DspConfig::convolver_waveform_edit, &waveEditExists));
337 int optMode = config->get<int>(DspConfig::convolver_optimization_mode, &optModeExists);
338 bool enabled = config->get<bool>(DspConfig::convolver_enable, &enableExists);
339
340 if(!enableExists)
341 {
342 util::warning("Enable switch unset. Disabling convolver.");
343 enabled = false;
344 }
345
346 if(!fileExists)
347 {
348 util::error("convolver_file property missing. Disabling convolver.");
349 enabled = false;
350 }
351
352 if(file.isEmpty())
353 {
354 util::error("Impulse response is empty. Disabling convolver.");
355 enabled = false;
356 }
357
358 if(!optModeExists || !waveEditExists)
359 {
360 util::warning("Opt mode or advanced wave editing unset. Using defaults.");
361
362 if(!optModeExists) optMode = 0;
363 if(!waveEditExists) waveEdit = "-80;-100;23;12;17;28";
364 }
365
366 std::vector<string> v;
367 std::stringstream ss(waveEdit.toStdString());
368
369 while (ss.good()) {
370 std::string substr;
371 getline(ss, substr, ';');
372 v.push_back(substr);
373 }
374
375 int param[6];
376 if(v.size() != 6)
377 {
378 util::warning("Invalid advanced impulse editing data. 6 semicolon-separateds field expected, "
379 "found " + std::to_string(v.size()) + " fields instead.");
380
381 param[0] = -80;
382 param[1] = -100;
383 param[2] = 23;
384 param[3] = 12;
385 param[4] = 17;

Callers

nothing calls this directly

Calls 10

chopDoubleQuotesFunction · 0.85
to_stringFunction · 0.85
castFunction · 0.85
Convolver1DDisableFunction · 0.85
Convolver1DEnableFunction · 0.85
push_backMethod · 0.80
isEmptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected