28 #include "FaustCode.hpp"
29 #define FAUST_BLOCK(class, member, file, nVoices) Faust_##class member {#class, file, nVoices}
31 #define FAUST_BLOCK(class, member, file, nVoices) iplug::FaustGen member {#class, file, nVoices}
43#ifndef FAUST_RECOMPILE_INTERVAL
44 #define FAUST_RECOMPILE_INTERVAL 1000
47class interpreter_dsp_factory;
61 FaustGen(
const char* name,
const char* inputDSPFile =
nullptr,
int nVoices = 0,
const char* libraryPath =
FAUST_SHARE_PATH);
98 void SetOnCompileFunc(std::function<
void(
bool success)> func) { mOnCompileFunc = func; }
103 const char* GetSourceCode()
const {
return mSourceCode.c_str(); }
104 const char* GetDSPFile()
const {
return mDSPFile.c_str(); }
107 bool Compile(
const std::string& sourceCode);
108 void CompileDefault();
109 bool ReadFile(std::string& contents);
110 void OnTimer(
Timer& timer);
111 void OnCompiled(
bool success);
113 std::string mDSPFile;
114 std::string mSourceCode;
115 std::string mErrorMessage;
116 std::vector<std::string> mLibraryPaths;
117 std::vector<std::string> mCompileOptions;
118 int64_t mFileModifiedTime = 0;
120 interpreter_dsp_factory* mFactory =
nullptr;
121 std::unique_ptr<Timer> mFileWatchTimer;
122 std::function<void(
bool success)> mOnCompileFunc;
#define FAUST_SHARE_PATH
Default search path for the Faust standard libraries (stdfaust.lib etc.), used by the interpreter bac...
FaustGen compiles Faust code at runtime using the libfaust interpreter backend, so that the DSP can b...
const char * GetErrorMessage() const
void SetBundleResourcePath(const char *resourcesPath)
Use the .dsp file and Faust libraries that iplug_add_faust(... BUNDLE) copies into the bundle's resou...
void AddLibraryPath(const char *path)
Add a path that is searched for imported .lib/.dsp files.
void Init() override
Compile the DSP.
void SetOnCompileFunc(std::function< void(bool success)> func)
Set a function that is called on the main thread after a (re)compilation.
void SetAutoRecompile(bool enable)
Watch the .dsp file and recompile it when it changes.
bool LoadFile(const char *path)
Load and compile a .dsp file, replacing the current DSP if compilation succeeds.
bool SetSourceCode(const char *sourceCode)
Compile Faust source code, replacing the current DSP if compilation succeeds.
void AddCompileOption(const char *option)
Add a compiler option such as "-vec" (see faust –help)
IPlugFaust is the base class for hosting a Faust DSP inside an iPlug2 plug-in.