1
0
Fork 0

Add support for selecting midi devices by name to win32 midi. Rewritten patch of rcblanke.

Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@4017
This commit is contained in:
Peter Veenstra 2017-05-10 18:35:36 +00:00
parent 00ae500d59
commit d93ef7f826

View file

@ -41,9 +41,24 @@ public:
if(conf && *conf) {
std::string strconf(conf);
std::istringstream configmidi(strconf);
unsigned int nummer = midiOutGetNumDevs();
unsigned int total = midiOutGetNumDevs();
unsigned int nummer = total;
configmidi >> nummer;
if(nummer < midiOutGetNumDevs()){
if (configmidi.fail() && total) {
lowcase(strconf);
for(unsigned int i = 0; i< total;i++) {
MIDIOUTCAPS mididev;
midiOutGetDevCaps(i, &mididev, sizeof(MIDIOUTCAPS));
std::string devname(mididev.szPname);
lowcase(devname);
if (devname.find(strconf) != std::string::npos) {
nummer = i;
break;
}
}
}
if (nummer < total) {
MIDIOUTCAPS mididev;
midiOutGetDevCaps(nummer, &mididev, sizeof(MIDIOUTCAPS));
LOG_MSG("MIDI: win32 selected %s",mididev.szPname);