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

SynthCore::Module Class Reference

Base class for all modules. More...

#include <Modules.h>

Inheritance diagram for SynthCore::Module:

SynthCore::BiQuad SynthCore::Dummy SynthCore::Envelope3 SynthCore::Multiplier SynthCore::Polyphony SynthCore::Sampler SynthCore::Tube SynthCore::WaveShaper List of all members.

Public Methods

 Module ()
 Constructor.

virtual void update ()=0
virtual int getNoInputs ()
virtual InputgetInput (int no)
 Returns pointer to an input.

virtual void addInput (Input *I)
virtual int getNoOutputs ()
 Returns number of outputs.

virtual OutputgetOutput (int no)
 Returns pointer to an output.

virtual void addOutput (Output *I)
virtual std::string getName ()
 The name is just a virtual placeholder.

virtual void newMidiEvent ()
virtual std::string getXML (int indent=0)
virtual void loadXML (XMLNode *n, bool firstPass)
std::string saveID (int indent=0)
virtual Module * sharedClone ()
void loadParameter (string tagName, float par, XMLNode *n)

Static Public Methods

int getUniqueID ()
 Call this to get an unique ID for a module.

void resetIDCount (int i)
 Resets ID Count.

Module * newInstance ()
 Use this as a 'factory' constructor.

std::string saveParameter (std::string tag, float f, int indent=0)
std::string saveParameter (std::string tag, std::string s, int indent=0)

Public Attributes

SynthVoicehostVoice
int ModID
bool firstVoice

Static Public Attributes

int IDCount = 1
 The counter for the unique ID.


Friends

std::ostream & operator<< (std::ostream &ostr, Module &myMod)
 Modules can be streamed to an ostream.

std::ostream & operator<< (std::ostream &ostr, Module *myMod)
 Modules pointers can also be streamed to an ostream.


Detailed Description

Base class for all modules.

Todo:
consider the RTTI reflection.

Definition at line 39 of file Modules.h.


Member Function Documentation

virtual void SynthCore::Module::addInput Input   I [inline, virtual]
 

Adds the input to the list of inputs (myInputs) This is called from the Input constructor - so it shouldnt be called manually.

Definition at line 68 of file Modules.h.

Referenced by SynthCore::Input::Input().

virtual void SynthCore::Module::addOutput Output   I [inline, virtual]
 

Adds the output to the list of outputs (myOutputs) This is called from the Output constructor - so it shouldnt be called manually.

Definition at line 78 of file Modules.h.

Referenced by SynthCore::Output::Output().

virtual int SynthCore::Module::getNoInputs   [inline, virtual]
 

A bit of 'reflection' must be implemented This returns the number of inputs. Used with getInput()

Definition at line 61 of file Modules.h.

string SynthCore::Module::getXML int    indent = 0 [virtual]
 

Return XML representation of parameters. Used for serializing modules.

Reimplemented in SynthCore::Envelope3, SynthCore::BiQuad, SynthCore::Polyphony, SynthCore::Sampler, SynthCore::Tube, and SynthCore::WaveShaper.

Definition at line 27 of file Modules.cpp.

References getName(), Utils::newline(), and Utils::space().

Referenced by SynthCore::operator<<().

void SynthCore::Module::loadXML XMLNode *    n,
bool    firstPass
[virtual]
 

Loads parameter setting from an XML file. Returns true if succesfull.

Reimplemented in SynthCore::Envelope3, SynthCore::BiQuad, SynthCore::Polyphony, SynthCore::Sampler, SynthCore::Tube, and SynthCore::WaveShaper.

Definition at line 132 of file Modules.cpp.

Referenced by SynthCore::Synth::loadXML().

virtual void SynthCore::Module::newMidiEvent   [inline, virtual]
 

This function is called if the module is part of a synthVoice, and a midi event occours (As of now, the detected events are: key up/down) Overwrite this if the module needs to react on midi events (IE oscillators).

Reimplemented in SynthCore::Sampler.

Definition at line 91 of file Modules.h.

virtual Module* SynthCore::Module::sharedClone   [inline, virtual]
 

Creates a copy of the Module. If any ressources can be shared across a voice the method should utilize it.

Reimplemented in SynthCore::Envelope3, SynthCore::BiQuad, SynthCore::Sampler, SynthCore::Tube, and SynthCore::WaveShaper.

Definition at line 132 of file Modules.h.

virtual void SynthCore::Module::update   [pure virtual]
 

update() is where the main sound processing in a module takes place. Called every sample-step. It is purely virtual

Implemented in SynthCore::Envelope3, SynthCore::BiQuad, SynthCore::Multiplier, SynthCore::Dummy, SynthCore::Polyphony, SynthCore::Sampler, SynthCore::Tube, and SynthCore::WaveShaper.

Referenced by SynthCore::Input::updateRead().


Member Data Documentation

bool SynthCore::Module::firstVoice
 

If an module is cloned (for use in a polyphonic context) the flag indicate if this is the original module. This is important if modules shares ressources: IE: you have 32 voices with a sampler module in each. These will share the waveform data. when cleaning up, only one of these modules is allowed to delete waveform.

Definition at line 111 of file Modules.h.

Referenced by SynthCore::Sampler::sharedClone(), SynthCore::BiQuad::sharedClone(), and SynthCore::Envelope3::sharedClone().

SynthVoice* SynthCore::Module::hostVoice
 

Used if the Module is part of a HostVoice. When a polyphonic instrument is played, certain modules (IE the oscillators and envelopes) must be duplicated. These units, which are to be duplicated are called voices.

Todo:
Change HostSynth to HostVoice

Definition at line 100 of file Modules.h.

Referenced by SynthCore::BiQuad::BiQuad(), SynthCore::Envelope3::Envelope3(), Module(), SynthCore::Multiplier::Multiplier(), SynthCore::Sampler::newMidiEvent(), SynthCore::Polyphony::Polyphony(), SynthCore::WaveShaper::sharedClone(), SynthCore::Tube::sharedClone(), SynthCore::Sampler::sharedClone(), SynthCore::BiQuad::sharedClone(), SynthCore::Envelope3::sharedClone(), SynthCore::Tube::Tube(), SynthCore::BiQuad::update(), SynthCore::Envelope3::update(), and SynthCore::WaveShaper::WaveShaper().

int SynthCore::Module::ModID
 

A HostVoice consists of modules with different ModID's But all HostVoices should share the same set of ModID's Thereby establishing an identity between modules in different Voices.

Definition at line 105 of file Modules.h.

Referenced by Module(), SynthCore::Sampler::sharedClone(), SynthCore::BiQuad::sharedClone(), and SynthCore::Envelope3::sharedClone().


The documentation for this class was generated from the following files:
Syntopia Project. Visit the web page, or the SourceForge page.
Docs made by Doxygen. Email: Mikael Christensen