Lomse library. API documentation  0.30.0
CmdTransposeChromatically Class Reference

#include <lomse_command.h>

Inheritance diagram for CmdTransposeChromatically:
CmdTranspose DocCmdSimple DocCommand

Detailed Description

A command for applying a chromatic transposition to the score or to a selection.

See constructor for details.

Public Member Functions

 CmdTransposeChromatically (FIntval interval, const std::string &name="")
 
- Public Member Functions inherited from CmdTranspose
int get_cursor_update_policy () override
 
int get_undo_policy () override
 
int get_selection_update_policy () override
 
- Public Member Functions inherited from DocCmdSimple
virtual ~DocCmdSimple ()
 
bool is_composite () override
 
- Public Member Functions inherited from DocCommand
virtual ~DocCommand ()
 
std::string get_name ()
 
bool is_reversible ()
 
bool is_recordable ()
 
std::string get_error ()
 

Additional Inherited Members

- Public Types inherited from DocCommand
enum  ECmdCursorPolicy
 
enum  ECmdUndoPolicy
 
enum  ECmdSelectionPolicy
 

Constructor & Destructor Documentation

◆ CmdTransposeChromatically()

CmdTransposeChromatically::CmdTransposeChromatically ( FIntval  interval,
const std::string &  name = "" 
)

This command shifts chromatically every pitch, up or down, by the interval you specify, adding or subtracting accidentals as necessary to maintain original intervals between notes. The command applies only to the notes in the current selection set.

This kind of transposition has nothing to do with the key signature which remains unchanged.

Parameters
intervalThe interval by which you want the selected music transposed. If the interval is negative, the direction of the transposition will be 'down'; otherwise it will be 'up'.
nameThe displayable name for the command. If not specified or empty will be replaced by "Chromatic transposition".

Remarks

  • If the selection is empty or does not contain notes, the command will not be executed and will return a failure code.
  • After executing the command:
    • the selection set will be unmodified.
    • the cursor will not change its position.

Example

void CommandHandler::transpose(FIntval interval)
{
if (SpInteractor spInteractor = m_pPresenter->get_interactor(0).lock())
{
string name = gettext("Chromatic transposition");
SpInteractor->exec_command(
new CmdTransposeChromatically(interval, name) );
}
}