Created
December 2, 2014 10:21
-
-
Save t-mat/d422d9e167b171050408 to your computer and use it in GitHub Desktop.
WIN32 : Enumerate MIDI Devices
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Enumerate MIDI Devices | |
#include <windows.h> | |
#include <stdio.h> | |
#include <locale.h> | |
#pragma comment(lib, "winmm.lib") | |
int main() { | |
setlocale(LC_ALL, ""); | |
const UINT_PTR nMidiOut = midiOutGetNumDevs(); | |
for(UINT_PTR iMidiOut = 0; iMidiOut < nMidiOut; ++iMidiOut) { | |
MIDIOUTCAPS moc {}; | |
midiOutGetDevCaps(iMidiOut, &moc, sizeof(moc)); | |
wprintf(L"MIDI Out#%2d [%s]\n", iMidiOut, moc.szPname); | |
} | |
const UINT_PTR nMidiIn = midiInGetNumDevs(); | |
for(UINT_PTR iMidiIn = 0; iMidiIn < nMidiIn; ++iMidiIn) { | |
MIDIINCAPS mic {}; | |
midiInGetDevCaps(iMidiIn, &mic, sizeof(mic)); | |
wprintf(L"MIDI Inp#%2d [%s]\n", iMidiIn, mic.szPname); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment