Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add: [Win32] Select MIDI device by port name #7666

Merged
merged 1 commit into from Aug 31, 2019

Conversation

nielsmh
Copy link
Contributor

@nielsmh nielsmh commented Jul 22, 2019

Also listing the available MIDI ports in debug on the win32_m driver, previously only the DMusic driver did that.

@glx22
Copy link
Contributor

glx22 commented Jul 22, 2019

I get a different detection for dmusic and win32, but I guess it's expected.

dbg: [driver] Detected DirectMusic ports:
dbg: [driver]  0: Microsoft MIDI Mapper [Émulé]
dbg: [driver]  1: Microsoft GS Wavetable Synth [Émulé]
dbg: [driver]  2: Microsoft Synthesizer
dbg: [driver] Successfully probed music driver 'dmusic'

dbg: [driver] Win32-MIDI: Found 1 output devices:
dbg: [driver] MIDI port  0: Microsoft GS Wavetable Synth
dbg: [driver] Successfully loaded music driver 'win32'

@michicc
Copy link
Member

michicc commented Jul 22, 2019

Yeah, DMusic and normal Win synths are not identical or duplicates (which was the whole reason to make DMusic work on 64-bit as well).

@nielsmh
Copy link
Contributor Author

nielsmh commented Jul 22, 2019

The MIDI Mapper is not enumerated as a regular port in WinMM, you instead request it by a magical device ID. Actually, that may be one of the things that changed with the Mapper in one of the recent-ish Windows versions, maybe it was different in the old days.

uint numports = midiOutGetNumDevs();
DEBUG(driver, 1, "Win32-MIDI: Found %d output devices:", numports);
for (uint tryport = 0; tryport < numports; tryport++) {
MIDIOUTCAPS moc{};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a particular need for {} ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's probably not strictly required, mainly for being 110% sure nobody complains about passing pointers to uninitialised memory.

@LordAro LordAro merged commit a933afa into OpenTTD:master Aug 31, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants