Note that there are some explanatory texts on larger screens.

plurals
  1. POANSI or OEM Codepage when using MME and DirectMusic?
    primarykey
    data
    text
    <p>I noticed that when reading MIDI port names from MME, the names are multi-byte strings encoded using the ANSI Codepage, which my app uses by default. When receiving those names from the DirectMusic driver, the names are wide-character strings encoded with the OEM Codepage. See <a href="http://blogs.msdn.com/oldnewthing/archive/2005/03/08/389527.aspx" rel="nofollow noreferrer">this article by Raymond Chen</a> for a quick refresher on Codepages.</p> <p>On my German system, this means that when using the current codepage, which turns out to be the ANSI one, I get "Audiogerät" from MME, and "Audioger<b>ö</b>t" from DirectMusic, the latter being wrong. This gets fixed when I treat that last name as OEM-encoded instead.</p> <p>So how do I know with which codepage to decode those names? Why does the name coming from DirectMusic get encoded differently? Does it come from the USB driver? The COM framework? DirectMusic? <strong>How can I know for sure which codepage to use when reading the names of my MIDI ports?</strong></p> <p>For info:</p> <ul> <li>I use the <code>MultiByteToWideChar()</code> and <code>WideCharToMultiByte()</code> functions to perform the conversions, with <code>CP_ACP</code> and <code>CP_OEMCP</code> as argument for the codepage to use.</li> <li>I use <code>midiInGetDeviceCaps()</code> to get MIDI port information from the MME subsystem...</li> <li>... and convert <code>MIDIINCAPS.szPname</code> using the <code>CP_ACP</code> (ANSI) codepage.</li> <li>I use <code>IID_IDirectMusic8::EnumPort()</code> to get port information from DirectMusic...</li> <li>... and convert <code>DMUS_PORTCAPS.wszDescription</code> using the <code>CP_OEMCP</code> codepage.</li> </ul>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload