SynFactory III
-------------------

This is the third generation of the Desktop audio/video studio based on
modular synthesizer techniques.


Source structure
-------------------

The SynFactory tree consists of many small files that are parsed and combined
together with the m4 macro processor. The use of this pre-prosessing step
allows some action be done during compilation. In previous versions the same
was done with Perl files. Parts of the application can be selectively enabled.
There is also some use of aspect oriented techiniques to organise the code
better. This process generates a single cpp file that is compiled to optain
the application. To be able to combine all the files correctly into an
application, they must obey certain rules.


Compilation
-------------------

To generate the .cpp file run the m4 macro processor on the synfactory.m4
file. This will first include maker.m4, which contains all the generic build
macros. The files use [ and ] as quotation markers. The default markers of m4
can cause problems as the same characters are used in C++ code. The [ and ]
markers are less problemetic as they are always used in pairs in normal C++
code and are therefore normally always balanced.

The main code weaving macros are MacroBack and MacroFront that collect code
incrementally. Most other macros are build up from these two. All code is
processed and collected into hidden macros that start with double underscore.
__defs, __const, __enums, __structs, __code1 .. __code9

The final file contents is a concatination of the contents of all these macros.


Code blocks
-------------------

code1
	- convert enum to string functions
code2
	- Log file
code3
	- Language routines
code4
	- DSP Objects
code5
	- GUI primitives, fonts and rendering
code6
	- Menus
code7
	- Application GUI layer
code9
	- Main


Set-vars
-------------------

Set-vars are variables where code can register itself to follow updates.
A Set-var is defined with the DefSetVar macro. It takes 3 arguments.
- a type
- a variable name
- a default value
For example DefSetVar([color_t], [theColor], [COLOR_BLACK]). Updates are
done by using the SetVar macro. This inserts code that calls the function
__set_<variablename>. To add code on the watch list call
WatchVar(<varname>, <code>). This code is added to the __set_X function.
Boolean flags that signal change are a good choice.
Keep in mind the performance inpact of too many watchers when using SetVars.

In the code they are used for refreshing windows when related preference
parameters change. You can safely add Watches for none existing variables.
This allows modular design where submodules can be removed with the remaining
parts still working.