Lomse library. API documentation
0.30.0
|
#include <lomse_command.h>
A command for transposing a selection to a different key signature.
Transposing a melody to a new key signature is a two steps process: replace the key signature symbol by the new key signature and transpose the affected notes, chromatically, by the interval between the new key and the old key signatures.
Therefore, for transposing by key no special command is needed, just CmdTransposeChromatically; and also a method to compute the interval between two key signatures. Class KeyUtilities provides three methods for this: KeyUtilities::up_interval() KeyUtilities::down_interval() KeyUtilities::closest_interval()
Take into account that a command for transposing to a different key signature can not be a general basic command because it must deal with notes and with keys, and how to deal with them is an application behaviour decision that can not be generalized. There are many scenarios to consider:
Because all of these considerations and possible application scenarios, Lomse can not provide a generic key transposition command. Nevertheless, for convenience, the CmdTransposeKey command has been created to be used in simple cases.
See constructor for details.
Public Member Functions | |
CmdTransposeKey (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 |
CmdTransposeKey::CmdTransposeKey | ( | FIntval | interval, |
const std::string & | name = "" |
||
) |
This command changes all the keys in the selection, and transposes chromatically all the notes in the selection.
interval | The 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'. |
name | The displayable name for the command. If not specified or empty will be replaced by "Transpose key signature". |
Remarks
Example