CFugue
|
Class representing the Key Signature. More...
#include <KeySignature.h>
Public Types | |
enum | Scale { MAJOR_SCALE = 0, MINOR_SCALE = 1 } |
enum | Mode { WESTERN =0, CARNATIC = 1 } |
enum | Defaults { DEFAULT_KEY = 0, DEFAULT_RAGAM = 29 } |
Public Member Functions | |
KeySignature () | |
Default constructor. | |
KeySignature (const signed short nKeySig, const Scale bScale) | |
Western Mode constructor. | |
KeySignature (const unsigned short nRagam, const unsigned short nTalam) | |
Carnatic Mode constructor. | |
signed char | GetKey () const |
Returns the Key Signature value. Based on the Mode, Value will be in the range [-7, 7] or [1, 72]. Use GetMode() to find the Mode. | |
unsigned char | GetMajMin () const |
Mode | GetMode () const |
Returns if the KeySignature refers to Carnatic Mode or Western Mode. | |
const Talam & | GetTalam () const |
Returns the Talam Value. Valid only when the Mode is CARNATIC. Use GetMode() to find the Mode;. | |
void | SetKey (const signed short nKeySig) |
void | SetMajMin (const Scale bScale) |
void | SetRagam (const unsigned short nRagam) |
void | SetTalam (const Talam &talam) |
unsigned short & | Speed () |
Returns the current Song speed. Valid only for Carnatic Mode. Use GetMode() to verify the Mode. | |
Static Public Member Functions | |
static void | PopulateWesternDefinitions (DICTIONARY &stdDefns) |
Populates Western Music Scale values. | |
static void | PopulateCarnaticDefinitions (DICTIONARY &stdDefns) |
Populates Carnatic Ragas and Mela values. | |
static void | PopulateSpeedDefinitions (DICTIONARY &stdDefns) |
Populates Speed values for Carnatic music. | |
static void | PopulateStandardDefinitions (DICTIONARY &stdDefns) |
Populates the standard KeySignature Macro defintions into Music String Dictionary Western Key Signatures, Carnatic Ragas, Talam and Speed values are populated. | |
static unsigned short | LookupSwaraSthanaForMela (short nSwara, unsigned short nMela) |
Protected Attributes | |
signed short | m_nKeySig |
Scale | m_bScale |
Mode | m_bMode |
Talam | m_nTalam |
unsigned short | m_nSpeed |
Class representing the Key Signature.
Key Signatures are applicable for the whole song, independent of tracks. It can be changed during a song, though. Player will automatically adjust note values based on the current Key Signature. For example, in a F-Major Key Signature, all B notes will be converted to B-Flat automatically, unless explicitly indicated as a B natural (i.e., "Bn"). However, note that such modifications are applied only to the Notes that are specified in alphabetic format. Notes specified using numeric form will not get affected by the KeySignature manipulations. They will be played as is.
Key Signatures support both Carnatic and Western Music modes. Use the appropriate Macros to distinguish between them.
In Carnatic mode, all the basic 72 Key Signatures, known as the Melakartha Janya Ragas, are supported. These are accessible through MELA_x macro, where x specifies a number in the range [1, 72]. In addition, MELA_0 and MELA_DEFAULT are available, that map to Melakartha 29 - the Shankarabharanam scale.
In addition, numerous Ragas are accessible through their names directly, such as KALYANI, MOHANA etc. Any missing notes in those ragas will default to their 29th scale values (and not to their Parent Janya raga values, be careful). In other words, Shankarabharanam is the default scale for all default Note values, no matter from which Ragam you are referring.
In Western mode, a total of 15 Key Signatures are present. These are accessible through their names, such as CMAJ, DMAJ, F#MIN etc... Additionally SCALE_DEFAULT Macro is available that maps to CMAJ scale.
Western is the default mode, and C-Major is the default KeySignature. All Parsers start in Western mode with C-Major scale set to their default. If you rather want the Parser to use a different Scale or different Mode, then you should explicitly supply a KeySignature token with appropriate macro values before passing on any Notes.
Note that once a KeySignature is encountered in one particular mode (Carnatic or Western), then all the subsequent Notes will be interpreted as being in that mode, till another KeySignature token is encountered with a different mode.
For example, once the parser encounters a token such as K[MELA_22] then it will start interpreting all the subsequent Notes in S R G M P D N style, instead of the default western C D E F G A B style. So any notes that use the latter style of notation will fail to render properly, unless a token with western Key Signature, such as K[F#MAJ] or K[AMIN] etc, is inserted before them. Same is the case the other way round. Once a KeySignature token with Western mode is encountered, all the subsequent Notes will be parsed using the Western C D E F G A B notation, and any notes that are inscribed using the S R G M P D N notation will fail to render properly, unless an appropriate Carnatic KeySignature such as K[MELA_65] or K[KALYANI] etc.. is used to appropriately direct the Parser about the notation switch to Carnatic Mode.
Use K[MELA_DEFAULT] for Carnatic Mode and K[SCALE_DEFAULT] for Western Mode if you are not sure which value to specify for the KeySignature.
Definition at line 79 of file KeySignature.h.
unsigned char CFugue::KeySignature::GetMajMin | ( | ) | const |
Returns if the Key Signature refers to a Major (0) scale or Minor(1) scale. Valid only if the Mode is set to KeySignature::WESTERN. Use GetMode() to verify the Mode.
Definition at line 118 of file KeySignature.h.
|
static |
Takes a plain Swara and converts it to the correct value based on the supplied Melakartha Raga.
nSwara | the Swara to be looked up. A value in the range [0, 6] |
nMela | the index of the Mela the Swara sthana is being looked for. A value in the range [1, 72] |
Definition at line 459 of file KeySignature.h.
void CFugue::KeySignature::SetKey | ( | const signed short | nKeySig | ) |
Sets the Key Signature value for Western Scales
nKeySig | Key Signature value in the range [-7, 7] |
Definition at line 129 of file KeySignature.h.
void CFugue::KeySignature::SetMajMin | ( | const Scale | bScale | ) |
Sets if the Key Signature refers to a Major (0) scale or Minor(1) scale
bScale | Value indicating if the scale is Major (0) or Minor (1) |
Definition at line 133 of file KeySignature.h.
void CFugue::KeySignature::SetRagam | ( | const unsigned short | nRagam | ) |
Sets the Key Signature value for Carnatic Ragams
nRagam | Melakartha Janya Ragam number in the range [1, 72] |
Definition at line 137 of file KeySignature.h.
void CFugue::KeySignature::SetTalam | ( | const Talam & | talam | ) |
Sets the Talam to the specified value
talam | The Talam value to be used from now on |
Definition at line 141 of file KeySignature.h.
CFugue, the C++ Music Programming Library | © Copyright 2009 Cenacle Research India Private Limited | Gopalakrishna Palem |