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

Method reloadLiveprog

src/audio/base/DspHost.cpp:714–790  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

712}
713
714void DspHost::reloadLiveprog(DspConfig* config)
715{
716 if(config == nullptr)
717 {
718 config = _cache;
719 }
720
721 bool propExists;
722 bool enableExists;
723 QString file = chopDoubleQuotes(config->get<QString>(DspConfig::liveprog_file, &propExists));
724 bool enabled = config->get<bool>(DspConfig::liveprog_enable, &enableExists);
725
726 if(!enableExists)
727 {
728 util::warning("Liveprog enable switch unset. Disabling liveprog.");
729 enabled = false;
730 }
731
732 if(!propExists)
733 {
734 util::warning("liveprog_file property not found in cache. Disabling liveprog.");
735 enabled = false;
736 }
737
738 // Attach log listener
739 setStdOutHandler(receiveLiveprogStdOut, this);
740
741 QFile f(file);
742 if(!f.exists())
743 {
744 util::warning("Referenced file does not exist anymore. Disabling liveprog.");
745 enabled = false;
746 }
747
748 if (!f.open(QFile::ReadOnly | QFile::Text))
749 {
750 util::error("Cannot open file path. Disabling liveprog.");
751 enabled = false;
752 }
753 QTextStream in(&f);
754
755
756 LiveProgDisable(cast(this->_dsp));
757 dispatch(EelCompilerStart, f.fileName());
758
759 QElapsedTimer timer;
760 timer.start();
761 int ret = LiveProgStringParser(cast(this->_dsp), in.readAll().toLocal8Bit().data());
762
763 // Workaround due to library bug
764 jdsp_unlock(cast(this->_dsp));
765
766 float msecs = timer.nsecsElapsed() / 1000000.0;
767
768 const char* errorString = NSEEL_code_getcodeerror(cast(this->_dsp)->eel.vm);
769 if(errorString != NULL)
770 {
771 util::warning("Syntax error in script file, cannot load. Reason: " + std::string(errorString));

Callers 1

MainWindowMethod · 0.45

Calls 13

chopDoubleQuotesFunction · 0.85
setStdOutHandlerFunction · 0.85
LiveProgDisableFunction · 0.85
castFunction · 0.85
LiveProgStringParserFunction · 0.85
jdsp_unlockFunction · 0.85
NSEEL_code_getcodeerrorFunction · 0.85
checkErrorCodeFunction · 0.85
LiveProgEnableFunction · 0.85
startMethod · 0.80
appendMethod · 0.80
existsMethod · 0.45

Tested by

no test coverage detected