MIDIAddLink: Difference between revisions
Appearance
m Ak120 moved page OS2 API:MM:MIDI:MIDIAddLink to MIDIAddLink |
|||
(4 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
MIDIAddLink creates a link from the source instance (''minstanceSource'') to the target instance (''minstanceTarget'') on the specified slot (''ulSlotNumber''). | |||
==Syntax== | |||
MIDIAddLink( ''minstanceSource'', ''minstanceTarget'', ''ulSlotNumber'', ''ulFlag'' ) | |||
===Parameters=== | ===Parameters=== | ||
; minstanceSource (MINSTANCE) - input: The source instance number. | |||
; | ; minstanceTarget (MINSTANCE) - input: The target instance number. | ||
: The source instance number. | ; ulSlotNumber ([[ULONG]]) - input: The slot number of the source instance. | ||
; | ; ulFlag ([[ULONG]]) - input: This parameter is not currently used and must be set to 0. | ||
: The target instance number. | |||
; | |||
: The slot number of the source instance. | |||
; | |||
: This parameter is not currently used and must be set to 0. | |||
===Returns=== | ===Returns=== | ||
;ULONG rc:The following values can be returned | |||
{|class="wikitable" | |||
|align="RIGHT" |0 | |||
|NO_ERROR | |||
{| | |Operation was successful. | ||
| align="RIGHT" | 0 | |||
|- | |- | ||
| align="RIGHT" | 7003 | |align="RIGHT" | 7003 | ||
|MIDIERR_INTERNAL_SYSTEM | |||
|Error, The RTMIDI subsystem has become corrupt, and the application should terminate immediately, cleaning up as much as possible. Rebooting will most likely be necessary to restore RTMIDI to a functional state. | |||
|- | |- | ||
| align="RIGHT" | 7007 | | align="RIGHT" | 7007 | ||
|MIDIERR_INVALID_FLAG | |||
|Error, The ''ulFlag'' value is not set to 0. | |||
|- | |- | ||
| align="RIGHT" | 7009 | | align="RIGHT" | 7009 | ||
|MIDIERR_INVALID_INSTANCE_NUMBER | |||
|Error, Either the source or target instance number is invalid. | |||
|- | |- | ||
| align="RIGHT" | 7010 | | align="RIGHT" | 7010 | ||
|MIDIERR_INVALID_PARAMETER | |||
|Error, The ''ulSlotNumber'' parameter contains an invalid value. | |||
|- | |- | ||
| align="RIGHT" | 7014 | | align="RIGHT" | 7014 | ||
|MIDIERR_NOT_ALLOWED | |||
|Error, An attempt was made to create a link either between two instances not owned by this process or between a hardware node and an instance owned by another process. | |||
|- | |- | ||
| align="RIGHT" | 7016 | | align="RIGHT" | 7016 | ||
|MIDIERR_RESOURCE_NOT_AVAILABLE | |||
|Error, There are not enough resources to create any new links. | |||
|} | |} | ||
==Gotchas== | |||
A link is only allowed between two hardware nodes, a hardware node and an instance owned by this process, or between two instances which are owned by this process. | A link is only allowed between two hardware nodes, a hardware node and an instance owned by this process, or between two instances which are owned by this process. | ||
The value of the slot number (''ulSlotNumber'') depends on the class of the source instance. The class defines the number and meaning of the slots of its instances. Most classes only provide one slot, so ''ulSlotNumber'' will be 0 for these classes. | The value of the slot number (''ulSlotNumber'') depends on the class of the source instance. The class defines the number and meaning of the slots of its instances. Most classes only provide one slot, so ''ulSlotNumber'' will be 0 for these classes. | ||
==Sample Code== | |||
<pre> | |||
#include <mididll.h> | #include <mididll.h> | ||
Line 79: | Line 66: | ||
/* We got an error to take care of. */ | /* We got an error to take care of. */ | ||
} | } | ||
</pre> | |||
===See Also=== | ===See Also=== | ||
*MIDIRemoveLink | |||
*MIDIQueryInstanceInfo | |||
[[ | [[Category:MIDI]] | ||
Latest revision as of 03:53, 25 April 2025
MIDIAddLink creates a link from the source instance (minstanceSource) to the target instance (minstanceTarget) on the specified slot (ulSlotNumber).
Syntax
MIDIAddLink( minstanceSource, minstanceTarget, ulSlotNumber, ulFlag )
Parameters
- minstanceSource (MINSTANCE) - input
- The source instance number.
- minstanceTarget (MINSTANCE) - input
- The target instance number.
- ulSlotNumber (ULONG) - input
- The slot number of the source instance.
- ulFlag (ULONG) - input
- This parameter is not currently used and must be set to 0.
Returns
- ULONG rc
- The following values can be returned
0 | NO_ERROR | Operation was successful. |
7003 | MIDIERR_INTERNAL_SYSTEM | Error, The RTMIDI subsystem has become corrupt, and the application should terminate immediately, cleaning up as much as possible. Rebooting will most likely be necessary to restore RTMIDI to a functional state. |
7007 | MIDIERR_INVALID_FLAG | Error, The ulFlag value is not set to 0. |
7009 | MIDIERR_INVALID_INSTANCE_NUMBER | Error, Either the source or target instance number is invalid. |
7010 | MIDIERR_INVALID_PARAMETER | Error, The ulSlotNumber parameter contains an invalid value. |
7014 | MIDIERR_NOT_ALLOWED | Error, An attempt was made to create a link either between two instances not owned by this process or between a hardware node and an instance owned by another process. |
7016 | MIDIERR_RESOURCE_NOT_AVAILABLE | Error, There are not enough resources to create any new links. |
Gotchas
A link is only allowed between two hardware nodes, a hardware node and an instance owned by this process, or between two instances which are owned by this process.
The value of the slot number (ulSlotNumber) depends on the class of the source instance. The class defines the number and meaning of the slots of its instances. Most classes only provide one slot, so ulSlotNumber will be 0 for these classes.
Sample Code
#include <mididll.h> MINSTANCE miSource; MINSTANCE miTarget; ULONG ulSlot; /* Create a link from the instance identified with miSource */ /* to the instance identified with miTarget, on the slot */ /* of the source instance rc = MIDIAddLink(miSource, miTarget, ulSlot, 0); if (rc != 0) { /* We got an error to take care of. */ }
See Also
- MIDIRemoveLink
- MIDIQueryInstanceInfo