Difference between revisions of "Toolbox/Effects"

From Audacity Wiki
Jump to: navigation, search
(Effects.)
 
(Interactive chart.)
Line 25: Line 25:
 
* '''EffectHostInterface''' - Virtual functions to handle presets, factory defaults and duration.  Whereas ConfigClientInterface works on individual settings, this class works on groups of settings.
 
* '''EffectHostInterface''' - Virtual functions to handle presets, factory defaults and duration.  Whereas ConfigClientInterface works on individual settings, this class works on groups of settings.
  
 +
 +
{{#widget:WikiDiagram|page=EffectsHierarchy}}
  
 
==Inside an Effect==
 
==Inside an Effect==

Revision as of 13:33, 15 March 2020

This page of developer code and/or digital audio documentation is part of a collection of pages for learning about our code. We aim to increasingly add interactive diagrams to these pages and over time connect better to the doxygen documentation.

Parameters in and Out

Most effects have settings, and they have a GUI to hold the settings.

  • Toolbox/Dialogs explains how dialogs for settings are constructed, and gives the Echo Effect as an example.

Effects can also persist their values to the audacity.cfg file. The same mechanism is also used for setting parameter values for scripting.

  • Toolbox/Commands explains how audacity.cfg values are set and parameters are set/retrieved for scripting.


Hierarchy

EffectClasses.png

  • wxEventHandler - wxWidgets class for handling events, such as clicking on a control on the effects dialog.
  • ComponentInterface - Provides a name or identifier, version and vendor that uniquely identifies a plug in.
  • EffectDefinitionInterface - Adds virtual functions for meta data about audio specific roles. Does the effect support real time and automation? What family of effects does it belong to?
  • EffectClientInterface - Provides virtual functions for the nitty gritty of transferring audio blocks and real time start and finish.
  • Effect - The actual effect class for Audacity built-in effects. Note that 3rd party effects like LADSPA and VST effects have their own versions, e.g. LadspaEffect and do not derive from Effect.
  • EffectUIClientInterface - Has virtual functions for management of the dialog, to show/hide/validate for example.
  • ConfigClientInterface - Virtual functions for setting/getting individual configuration values, using wxWidgets mechanisms.
  • EffectHostInterface - Virtual functions to handle presets, factory defaults and duration. Whereas ConfigClientInterface works on individual settings, this class works on groups of settings.


Inside an Effect

Here's the core part of the Echo Effects.


 127 size_t EffectEcho::ProcessBlock(float **inBlock, float **outBlock, size_t blockLen)
 128 {
 129    float *ibuf = inBlock[0];
 130    float *obuf = outBlock[0];
 131 
 132    for (decltype(blockLen) i = 0; i < blockLen; i++, histPos++)
 133    {
 134       if (histPos == histLen)
 135       {
 136          histPos = 0;
 137       }
 138       history[histPos] = obuf[i] = ibuf[i] + history[histPos] * decay;
 139    }
 140 
 141    return blockLen;
 142 }


Rough notes...

Relevant Classes

Here are some more classes relevant to effects.