[ Home | Alpha index | Topic index | Tutorials | Download | Feedback ]

The OS/2 API Project

MIDISimpleOpen

[ Syntax | Params | Returns | Include | Usage | Structs | Gotchas | Code | Also ]

Syntax

rc = MIDISimpleOpen( pminstance, ulFlag ); 

Parameters

PMINSTANCE pminstance (output)
Pointer to an instance number, filled in with the instance number of a new Application Node.

 

ULONG ulFlag (input)
This parameter is not currently used and must be set to 0.

 

Returns

ULONG rc
The following values can be returned
7014 MIDIERR_NOT_ALLOWED Error, The function is not implemented on this version of RTMIDI. 
 

Include Info

#include <mididll.h> 

Usage Explanation

MIDISimpleOpen is not implemented in any version of RTMIDI.

The idea behind MIDISimpleOpen (and MIDISimpleClose) is to provide a single API for an application to use for basic MIDI input and output, and typically only output.  MIDISimpleOpen uses the Default Hardware Node (another concept not yet implemented), which is Hardware Node that has been previously selected by the user via some control panel.  This API performs the following steps:
 

  1. Locates the Default Hardware Node by looking up it's name in OS2.INI.  If none exists, or if the select name does not exist, an error is returned, probably.
  2. Enables this Hardware Node.
  3. Creates an Application Node.  The instance number for this node is returned in pminstance.
  4. Creates a link from the new Application Node to the Hardware Node.  Also creates another link in the reverse direction.
  5. Starts the RTMIDI Timer

Relevant Structures

typedef ULONG MINSTANCE;
typedef MINSTANCE *PMINSTANCE;

Gotchas

MIDISimpleOpen is not implemented in any version of RTMIDI.

Sample Code

#include <mididll.h>

MINSTANCE miApplicationNode;
MESSAGE msg;


   /* This sample demonstrates the easiest way to send a single */
   /* note to the default device                                */

        rc = MIDISimpleOpen(&miApplicationNode, 0);

        if (rc != 0)
        {
            /* Either this API isn't implemented, or the Default */
            /* Hardware Node has been specified or doesn't exist */
        }

        msg.ulTime = 0;
        msg.ulTrack = 0;
        msg.msg.bytes.bStatus = 0x90;
        msg.msg.bytes.abData[0] = 0x40;
        msg.msg.bytes.abData[1] = 0x7F;

        rc = MIDISendMessages(miApplicationNode, &msg, sizeof(msg), 0);

        if (rc != 0)
        {
            /* Some error occurred */
        }

        MIDISimpleClose(miApplicationNode);

See Also

MIDISendMessages, MIDISendSysexMessage

Author

Timur Tabi - http://www.io.com/~timur/index.html
mailto:timur@io.com

Additions

Last Modified September 25/1997
Please send all errors, comments, and suggestions to: timur@io.com

The OS/2 API Project

MIDISimpleOpen