Toolbox/Commands

From Audacity Wiki
Revision as of 14:23, 13 March 2020 by James (talk | contribs) (frm -> from)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
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.


Purpose

Commands 'do' a single action. They may be bound to menu items, and may participate in scripts.


Parameters

Many commands have parameters. Here's the parameter definitions for the Select Time command.


  66 bool SelectTimeCommand::DefineParams( ShuttleParams & S ){
  67    // Allow selection down to -ve 100seconds.
  68    // Typically used to expand/contract selections by a small amount.
  69    S.OptionalY( bHasT0           ).Define( mT0, wxT("Start"), 0.0, -100.0, (double)FLT_MAX);
  70    S.OptionalY( bHasT1           ).Define( mT1, wxT("End"), 0.0, -100.0, (double)FLT_MAX);
  71    S.OptionalN( bHasRelativeSpec ).DefineEnum( mRelativeTo,   wxT("RelativeTo"), 0, kRelativeTo, nRelativeTos );
  72    return true;
  73 }

Here three parameters are defined, mT0 and mT1 for the start and end time, and mRelativeTo an enum which says how the time is measured, e.g. from the start of the track, or backwards from the end of the track.

OptionalY and OptionalN mean that the parameter is optional. The Y means by default it should be included, and N by default not.


Rough notes...

Relevant Classes

Here are some more classes relevant to commands.