SynthLab SDK
synthlabdm.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "../synthbase.h"
4 #include "../synthconstants.h"
5 #include "../synthfunctions.h"
6 #include "modulegetter.h"
7 
8 // --------------------------------------
9 // --- OPTIONAL SynthLab SDK File --- //
10 // -------------------------------------
19 // -----------------------------------------------------------------------------
20 // --- number of modules per voice
21 const uint32_t NUM_LFO_MODULE = 2;
22 const uint32_t NUM_EG_MODULE = 3;
23 const uint32_t NUM_DCA_MODULE = 1; /* not supported, but reserved for future*/
24 const uint32_t NUM_FILTER_MODULE = 2;
25 const uint32_t NUM_WTO_MODULE = 4;
26 const uint32_t NUM_VAO_MODULE = 4;
27 const uint32_t NUM_FMO_MODULE = 4;
28 const uint32_t NUM_PCMO_MODULE = 4;
29 const uint32_t NUM_KSO_MODULE = 4;
30 const uint32_t NUM_OSC_MODULE = 4; /* general oscillator, not supported, but reserved for future*/
31 
52 {
53 public:
55  virtual ~DynamicModuleManager();
56 
58  bool loadDMConfig(std::string folderPath, SynthLab::DMConfig& config);
59  void setConfigData(std::string fileline, SynthLab::DMConfig& config);
60  uint32_t loadAllDynamicModulesInFolder(std::string folderPath);
61  uint32_t loadAllDynamicModulesInSubFolder(std::string folderPath);
62  uint32_t loadDynamicModule(std::string modulePath);
63  void addLoadableModule(uint32_t module) { loadableModules.push_back(module); }
64 
66  bool haveDynamicModules() { return modules.size() > 0 ? true : false; }
67  std::vector<std::shared_ptr<SynthLab::ModuleCore>> getDynamicModules() { return modules; }
68  uint32_t getModuleCountForType(uint32_t type);
69  void setDoubleOscillators(bool b) { doubleOscillatorSet = b; }
70 
71 protected:
72  std::vector<std::shared_ptr<SynthLab::ModuleCore>> modules;
73  std::vector<uint32_t> loadableModules;
74  bool doubleOscillatorSet = false;
75 };
76 
uint32_t loadAllDynamicModulesInFolder(std::string folderPath)
Opens a folder and loads all of the modules it finds in succession.
Definition: synthlabdm.cpp:176
See also Designing Software Synthesizers in C++ 2nd Ed. by Will Pirkle.
uint32_t loadDynamicModule(std::string modulePath)
Tries to load a DLL or dylib.
Definition: synthlabdm.cpp:330
bool loadDMConfig(std::string folderPath, SynthLab::DMConfig &config)
Loads the DM configuration from the config.txt file; if the file does not exist, the default config i...
Definition: synthlabdm.cpp:132
bool haveDynamicModules()
Definition: synthlabdm.h:66
DynamicModuleManager()
empty constructor
Definition: synthlabdm.h:54
This object maintains a set of SynthLab-DM Dynamic Modules.
Definition: synthlabdm.h:51
Definition: synthbase.h:37
std::vector< uint32_t > loadableModules
set of module types that may be loaded in this synth; see synthconstants.h e.g. LFO_MODULE ...
Definition: synthlabdm.h:73
uint32_t loadAllDynamicModulesInSubFolder(std::string folderPath)
Opens a folder and loads all of the modules it finds in succession.
Definition: synthlabdm.cpp:220
virtual ~DynamicModuleManager()
virtual deleter
Definition: synthlabdm.cpp:48
void setConfigData(std::string fileline, SynthLab::DMConfig &config)
Sets the DM configuration booleans from the config.txt file; if the file does not exist...
Definition: synthlabdm.cpp:59
std::vector< std::shared_ptr< SynthLab::ModuleCore > > modules
set of pointers fo modules
Definition: synthlabdm.h:72