Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
FactoryType Class Referenceabstract

This interface class lets the MainController do its work. More...

Inheritance diagram for FactoryType:
EnvelopeModulatorFactoryType ModulatorChainFactoryType TimeVariantModulatorFactoryType VoiceStartModulatorFactoryType

Classes

class  Constrainer
 A Constrainer objects can impose restrictions on a particular FactoryType. More...
 
struct  ProcessorEntry
 a simple POD which contains the id and the name of a Processor type. More...
 

Public Member Functions

virtual bool allowType (const Identifier &typeName) const
 Checks if the type of the processor is found in the type name. More...
 
virtual ProcessorcreateProcessor (int typeIndex, const String &ProcessorId)=0
 Overwrite this function and return a processor of the specific type index. More...
 
 FactoryType (Processor *owner_)
 Creates a Factory type. More...
 
virtual int fillPopupMenu (PopupMenu &m, int startIndex=1)
 Fills a popupmenu with all allowed processor types. More...
 
virtual Array< ProcessorEntrygetAllowedTypes ()
 Returns a string array with all allowed types that this factory can produce. More...
 
String getNameFromPopupMenuResult (int resultFromPopupMenu)
 Returns the typeName using the result from the previously created popupmenu. More...
 
virtual int getNumProcessors ()
 Returns the number of Processors that this factory can create. More...
 
virtual int getProcessorTypeIndex (const Identifier &typeName) const
 Returns the index of the type. More...
 
Identifier getTypeNameFromPopupMenuResult (int resultFromPopupMenu)
 Returns the typeName using the result from the previously created popupmenu. More...
 
virtual void setConstrainer (Constrainer *newConstrainer, bool ownConstrainer=true)
 adds a Constrainer to a FactoryType. More...
 

Static Public Member Functions

static String getUniqueName (Processor *id, String name=String())
 Returns a unique ID for the new Processor. More...
 

Protected Member Functions

virtual const Array< ProcessorEntry > & getTypeNames () const =0
 This should only be overwritten by the subclasses. More...
 

Detailed Description

This interface class lets the MainController do its work.

You can tell a Processor (which should also be a Chain to make sense) to use a specific FactoryType with Processor::setFactoryType(), which will then use it in its popup menu to create the possible Processors. Simply overwrite these two functions in your subclass:

Processor* createProcessor  (int typeIndex, const String &id);
const StringArray& getTypeNames() const;

A FactoryType constrains the number of creatable Processors by

Constructor & Destructor Documentation

FactoryType ( Processor owner_)

Creates a Factory type.

Member Function Documentation

bool allowType ( const Identifier &  typeName) const
virtual

Checks if the type of the processor is found in the type name.

You can overwrite this and add more conditions (in this case, call the base class method first to keep things safe!

virtual Processor* createProcessor ( int  typeIndex,
const String &  ProcessorId 
)
pure virtual

Overwrite this function and return a processor of the specific type index.

int fillPopupMenu ( PopupMenu &  m,
int  startIndex = 1 
)
virtual

Fills a popupmenu with all allowed processor types.

You can pass in a startIndex, if you overwrite this method for nested calls.

It returns the last index that can be used for the next menus.

Array< FactoryType::ProcessorEntry > getAllowedTypes ( )
virtual

Returns a string array with all allowed types that this factory can produce.

String getNameFromPopupMenuResult ( int  resultFromPopupMenu)

Returns the typeName using the result from the previously created popupmenu.

int getNumProcessors ( )
virtual

Returns the number of Processors that this factory can create.

the rules defined in allowType are applied before counting the possible processors.

int getProcessorTypeIndex ( const Identifier &  typeName) const
virtual

Returns the index of the type.

Identifier getTypeNameFromPopupMenuResult ( int  resultFromPopupMenu)

Returns the typeName using the result from the previously created popupmenu.

virtual const Array<ProcessorEntry>& getTypeNames ( ) const
protectedpure virtual

This should only be overwritten by the subclasses.

For external usage, use getAllowedTypes().

String getUniqueName ( Processor id,
String  name = String() 
)
static

Returns a unique ID for the new Processor.

It scans all Processors and returns something like "Processor12" if there are 11 other Processors with the same ID

void setConstrainer ( Constrainer newConstrainer,
bool  ownConstrainer = true 
)
virtual

adds a Constrainer to a FactoryType.

It will be owned by the FactoryType. You can pass nullptr.

©2017 HISE. This documentation is autogenerated from the HISE source code using Doxygen.