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:
parent
00ae500d59
commit
d93ef7f826
1 changed files with 17 additions and 2 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue