logo
Main Page | Namespaces | Classes | Compounds | Files | Compound Members | Related

Synth.h

00001 //
00002 //  SYNTOPIA. See http://Syntopia.sourceforge.net for details and documentation.        
00003 //
00004 //      Author of this file: Mikael Hvidtfeldt Christensen (mikaelc@users.sourceforge.net)
00005 //
00006 
00007 // Visual C++ compiler warnings: 255 char limit on var names.....
00008 #pragma warning(disable: 4786)
00009 
00080 #ifndef __Synth__
00081 #define __Synth__
00082 
00083 #include "Modules.h"
00084 #include "Output.h"
00085 #include "SynthVoice.h"
00086 #include <list>
00087 #include "tube.h"
00088 #include <map>
00089 #include "polyphony.h"
00090 
00091 namespace SynthCore {
00092 
00093 typedef std::list<Module *> ModuleMap ;
00094 typedef std::list<Module *>::const_iterator ModuleMapIter ;
00095 
00096 
00097 class WaveShaper;
00098 class SynthVoice;
00099 class Dummy;
00100 
00102 
00109 class Synth {
00110 public:
00111         Synth();
00112         ~Synth();
00113         
00115         Output * Output1;                       
00117         Output * Output2;                       
00118 
00123         bool active;
00124 
00126         void update() ;         
00127         
00131         void StateChange();                     
00132 
00135         
00138         void add(Module * m);
00139 
00141         void noteOff(int note);
00142 
00145         void noteOn(int note);
00146         
00148         void allNotesOff();
00149 
00150 
00153         SynthVoice * voices[4];         
00154 
00156         ModuleMap UpdateMap;            
00157 
00159         ModuleMap totalMap;             
00160         
00162         std::string getXML(int indent= 0) ;
00163 
00165         void loadXML(std::string fileName);
00166 
00168         void XMLRegister(string Attr, Output * out) {
00169                 XMLOutputs[Attr] = out;
00170         }
00171 
00174         Output * XMLGetOutput(string Attr) {            
00175                 // find string in map
00176                 std::map<string, Output *>::iterator it = XMLOutputs.find(Attr);
00177                 
00178                 if (it == XMLOutputs.end()) {return 0 ;}
00179                                         
00180                 return (*it).second;
00181         
00182 
00183         }
00184 private:
00185         //
00186         FreqTable * myFreqTable;
00187 
00189         bool isOnUpdateMap(Module * m); 
00191         void makemap(Module * m);       
00192         void buildupdateMap();
00193         
00194         bool isOnTotalMap(Module * m);  
00195         void makeTotalMap(Module * m);
00196 
00197         // Used during loadXML phase.
00198         std::map<string, Output *> XMLOutputs;
00199 
00200         ModuleMapIter it;
00201         ModuleMapIter itbegin;
00202         ModuleMapIter itend;
00203         Module * QuickMap[1000];
00204 
00205         void (*FuncPointer)(void *);
00206         int PathLength;
00207         int ii;
00208 
00209         Polyphony * myPolyphony;        // This module adds the SynthVoices
00210         Tube * myComb;                          // Simple DelayFilter
00211         WaveShaper * myWS;                      // PostProccesing waveshaping.
00212         BiQuad * myFilter;
00213         int availVoice;                         // Number of free (available) voice.
00214         int noVoices;                           // Max. Polyphony
00215         
00216         Dummy * myDummy[100];   
00217 };
00218 
00219 }; // end of namespace: SynthCore
00220 
00221 #endif

Syntopia Project. Visit the web page, or the SourceForge page.
Docs made by Doxygen. Email: Mikael Christensen