Search
Module:
Directory

   Desktop Functions:

   Smart Device Functions:


Show Recent Changes
Subscribe (RSS)
Misc. Pages
Comments
FAQ
Helpful Tools
Playground
Suggested Reading
Website TODO List
Download Visual Studio Add-In

midiOutShortMsg (winmm)
 
.
Summary

C# Signature:

[DllImport("winmm.dll")]
static extern uint midiOutShortMsg(IntPtr hMidiOut, uint dwMsg);

VB Signature:

Declare Function midiOutShortMsg Lib "winmm.dll" (hMidiOut As Intptr,dwMsg As UInt32) As UInt32

User-Defined Types:

None.

Alternative Managed API:

Do you know one? Please contribute it!

Notes:

None.

Tips & Tricks:

Please add some!

Sample Code:

//hmidi is an IntPtr obtained via midiOutOpen or other means.

byte[] data = new byte[4];

//[0] = status byte containing voice message and channel

//[1] = data 1

//[2] = data 2 (empty on some messages)

//[3] = empty

data[0] = 0xC0;//change instrument, channel 0

data[1] = 127;//gunshot

uint msg = BitConverter.ToUInt32(data, 0);

midiOutShortMsg(hmidi, msg);

data[0] = 0x90;//note on, channel 0

data[1] = 50;//pitch

data[2] = 100;//velocity

msg = BitConverter.ToUInt32(data, 0);

midiOutShortMsg(hmidi, msg);

Documentation

Please edit this page!

Do you have...

  • helpful tips or sample code to share for using this API in managed code?
  • corrections to the existing content?
  • variations of the signature you want to share?
  • additional languages you want to include?

Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).

 
Access PInvoke.net directly from VS:
Terms of Use
Edit This Page
Find References
Show Printable Version
Revisions