Lomse library. API documentation
0.30.0
|
AMidiInfo provides access to the MIDI information associated to a ASoundInfo object for an instrument. MIDI info always exists in the ASoundInfo object. By default, when no MIDI information is provided in the source file or when programatically building a score, MIDI information is initialized as follows:
device name = "" program name = "" bank = 1 port = 0 port 0 is invalid. Means "not initialized" channel = 0 channel 0 is invalid. Means "not initialized" program = 1 unpitched = 0 volume = 1.0 maximum volume pan = 0 in front, centered elevation = 0 at listener head level
When MIDI information has been specified when building the score, notice that 'port', 'channel' or both could have not been specified and, thus, any of them can still in "not initialized". In these cases, port and channel are automatically assigned right values when the score is finished, that is, when invoking AScore::end_of_changes() method. The algorithm, in method MidiAssigner::assign_port_and_channel(), ensures that each instrument is assigned a unique combination (port, channel) for all instruments with port or channel containig the "not initialized" value.
Important. Please notice that currently, lomse sound API for playback generate play events that only uses the MIDI channel, program and volume information. All other MIDI information, such as bank, port or elevation is currently ignored.
Public Member Functions | |
ImoMidiInfo * | internal_object () const |
int | port () const |
std::string & | device_name () const |
std::string & | program_name () const |
int | bank () const |
int | channel () const |
int | program () const |
int | unpitched () const |
float | volume () const |
int | pan () const |
int | elevation () const |
void | set_port (int value) |
void | set_device_name (const std::string &value) |
void | set_program_name (const std::string &value) |
void | set_bank (int value) |
void | set_channel (int value) |
void | set_program (int value) |
void | set_unpitched (int value) |
void | set_volume (float value) |
void | set_pan (int value) |
void | set_elevation (int value) |
Public Member Functions inherited from AObject | |
AObject () | |
bool | is_valid () const |
ImoObj * | internal_object () const |
ImoId | object_id () const |
const std::string & | object_name () const |
ADocument | owner_document () const |
ADynamic | downcast_to_dynamic () const |
AInstrument | downcast_to_instrument () const |
AInstrGroup | downcast_to_instr_group () const |
ALink | downcast_to_link () const |
AList | downcast_to_list () const |
AParagraph | downcast_to_paragraph () const |
AScore | downcast_to_score () const |
ATextItem | downcast_to_text_item () const |
bool | is_anonymous_block () const |
bool | is_button () const |
bool | is_content () const |
bool | is_control () const |
bool | is_dynamic () const |
bool | is_heading () const |
bool | is_image () const |
bool | is_inline_wrapper () const |
bool | is_instrument () const |
bool | is_instr_group () const |
bool | is_link () const |
bool | is_list () const |
bool | is_list_item () const |
bool | is_midi_info () const |
bool | is_multicolumn () const |
bool | is_music_data () const |
bool | is_paragraph () const |
bool | is_score () const |
bool | is_sound_info () const |
bool | is_table () const |
bool | is_table_cell () const |
bool | is_table_body () const |
bool | is_table_head () const |
bool | is_table_row () const |
bool | is_text_item () const |
int bank | ( | ) | const |
Returns the MIDI bank assigned to this sound. MIDI 1.0 bank numbers range from 1 to 16,384.
int channel | ( | ) | const |
Returns the MIDI channel assigned to this sound. MIDI 1.0 channel numbers range from 1 to 16.
std::string & device_name | ( | ) | const |
Returns the MIDI device name assigned to this sound. It will be used in the DeviceName meta-event when exporting the score as a Standard MIDI File (not yet implemented).
int elevation | ( | ) | const |
Returns the MIDI elevation value assigned to this sound. Pan and elevation allow placing of sound in a 3-D space relative to the listener. Elevation refers to the vertical position around the listener, expressed in degrees, ranging from -180 to 180. Some values: 0 is level with the listener head, 90 is directly above, and -90 is directly below.
ImoMidiInfo * internal_object | ( | ) | const |
Transitional, to facilitate migration to the new public API. Notice that this method will be removed in future so, please, if you need to use this method open an issue at https://github.com/lenmus/lomse/issues explaining the need, so that the public API could be fixed and your app. would not be affected in future when this method is removed.
int pan | ( | ) | const |
Returns the MIDI pan value assigned to this sound. Pan and elevation allow placing of sound in a 3-D space relative to the listener. Pan refers to the horizontal position around the listener, expressed in degrees, ranging from -180 to 180. Some values: 0 is straight ahead, in front of the listener, centered. -90 is hard left, 90 is hard right, and -180 or 180 are directly behind the listener, centered.
int port | ( | ) | const |
Returns the MIDI port assigned to this sound. It is a number from 1 to 16 that can be used with the unofficial MIDI port (or cable) meta event.
int program | ( | ) | const |
Returns the MIDI program number assigned to this sound. MIDI 1.0 program numbers range from 1 to 128.
std::string & program_name | ( | ) | const |
Returns the MIDI program name assigned to this sound. It will be used in the ProgramName meta-events when exporting the score as a Standard MIDI File (not yet implemented).
void set_bank | ( | int | value | ) |
Sets the MIDI bank to use for this sound. MIDI 1.0 bank numbers range from 1 to 16,384.
void set_channel | ( | int | value | ) |
Sets the MIDI channel to use for this sound. MIDI 1.0 channel numbers range from 1 to 16.
void set_device_name | ( | const std::string & | value | ) |
Sets the MIDI device name to use for this sound. It will be used in the DeviceName meta-event when exporting the score as a Standard MIDI File (not yet implemented).
void set_elevation | ( | int | value | ) |
Sets the MIDI pan value to use for this sound. Pan and elevation allow placing of sound in a 3-D space relative to the listener. Elevation refers to the vertical position around the listener, expressed in degrees, ranging from -180 to 180. Some values: 0 is level with the listener head, 90 is directly above, and -90 is directly below.
void set_pan | ( | int | value | ) |
Sets the MIDI pan value to use for this sound. Pan and elevation allow placing of sound in a 3-D space relative to the listener. Pan refers to the horizontal position around the listener, expressed in degrees, ranging from -180 to 180. Some values: 0 is straight ahead, in front of the listener, centered. -90 is hard left, 90 is hard right, and -180 or 180 are directly behind the listener, centered.
void set_port | ( | int | value | ) |
Sets the MIDI port to use for this sound. It is a number from 1 to 16 that can be used with the unofficial MIDI port (or cable) meta event.
void set_program | ( | int | value | ) |
Sets the MIDI program number to use for this sound. MIDI 1.0 program numbers range from 1 to 128.
void set_program_name | ( | const std::string & | value | ) |
Sets the MIDI program name to use for this sound. It will be used in the ProgramName meta-events when exporting the score as a Standard MIDI File (not yet implemented).
void set_unpitched | ( | int | value | ) |
Sets the unpitched note number to use for this sound. It is only meaningfull for unpitched instruments and, for them, it specifies a MIDI 1.0 note number ranging from 0 to 127. It is usually used with MIDI banks for percussion.
void set_volume | ( | float | value | ) |
Sets the MIDI volume to use for this sound. The volume value is a percentage of the maximum, ranging from 0.0 to 1.0, with decimal values allowed. This corresponds to a scaling value for the MIDI 1.0 channel volume controller.
int unpitched | ( | ) | const |
Returns the unpitched note number assigned to this sound. It is only meaningfull for unpitched instruments and, for them, it specifies a MIDI 1.0 note number ranging from 0 to 127. It is usually used with MIDI banks for percussion.
float volume | ( | ) | const |
Returns the MIDI volume assigned to this sound. The volume value is a percentage of the maximum, ranging from 0.0 to 1.0, with decimal values allowed. This corresponds to a scaling value for the MIDI 1.0 channel volume controller.