ReactOS 0.4.15-dev-5666-gc548b97
midimap.c File Reference
#include <stdarg.h>
#include <windef.h>
#include <winuser.h>
#include <mmddk.h>
#include <winreg.h>
#include <wine/unicode.h>
#include <wine/debug.h>
Include dependency graph for midimap.c:

Go to the source code of this file.

Classes

struct  tagMIDIOUTPORT
 
struct  tagMIDIMAPDATA
 

Typedefs

typedef struct tagMIDIOUTPORT MIDIOUTPORT
 
typedef struct tagMIDIMAPDATA MIDIMAPDATA
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (msacm)
 
static BOOL MIDIMAP_IsBadData (MIDIMAPDATA *mm)
 
static BOOL MIDIMAP_FindPort (const WCHAR *name, unsigned *dev)
 
static BOOL MIDIMAP_LoadSettingsDefault (MIDIMAPDATA *mom, const WCHAR *port)
 
static BOOL MIDIMAP_LoadSettingsScheme (MIDIMAPDATA *mom, const WCHAR *scheme)
 
static BOOL MIDIMAP_LoadSettings (MIDIMAPDATA *mom)
 
static DWORD modOpen (DWORD_PTR *lpdwUser, LPMIDIOPENDESC lpDesc, DWORD dwFlags)
 
static DWORD modClose (MIDIMAPDATA *mom)
 
static DWORD modLongData (MIDIMAPDATA *mom, LPMIDIHDR lpMidiHdr, DWORD_PTR dwParam2)
 
static DWORD modData (MIDIMAPDATA *mom, DWORD_PTR dwParam)
 
static DWORD modPrepare (MIDIMAPDATA *mom, LPMIDIHDR lpMidiHdr, DWORD_PTR dwParam2)
 
static DWORD modUnprepare (MIDIMAPDATA *mom, LPMIDIHDR lpMidiHdr, DWORD_PTR dwParam2)
 
static DWORD modGetDevCaps (UINT wDevID, MIDIMAPDATA *mom, LPMIDIOUTCAPSW lpMidiCaps, DWORD_PTR size)
 
static DWORD modReset (MIDIMAPDATA *mom)
 
DWORD WINAPI MIDIMAP_modMessage (UINT wDevID, UINT wMsg, DWORD_PTR dwUser, DWORD_PTR dwParam1, DWORD_PTR dwParam2)
 
static LRESULT MIDIMAP_drvOpen (LPSTR str)
 
static LRESULT MIDIMAP_drvClose (DWORD_PTR dwDevID)
 
LRESULT CALLBACK MIDIMAP_DriverProc (DWORD_PTR dwDevID, HDRVR hDriv, UINT wMsg, LPARAM dwParam1, LPARAM dwParam2)
 

Variables

static MIDIOUTPORTmidiOutPorts
 
static unsigned numMidiOutPorts
 

Typedef Documentation

◆ MIDIMAPDATA

◆ MIDIOUTPORT

Function Documentation

◆ MIDIMAP_DriverProc()

LRESULT CALLBACK MIDIMAP_DriverProc ( DWORD_PTR  dwDevID,
HDRVR  hDriv,
UINT  wMsg,
LPARAM  dwParam1,
LPARAM  dwParam2 
)

Definition at line 549 of file midimap.c.

551{
552/* EPP TRACE("(%08lX, %04X, %08lX, %08lX, %08lX)\n", */
553/* EPP dwDevID, hDriv, wMsg, dwParam1, dwParam2); */
554
555 switch (wMsg)
556 {
557 case DRV_LOAD: return 1;
558 case DRV_FREE: return 1;
559 case DRV_OPEN: return MIDIMAP_drvOpen((LPSTR)dwParam1);
560 case DRV_CLOSE: return MIDIMAP_drvClose(dwDevID);
561 case DRV_ENABLE: return 1;
562 case DRV_DISABLE: return 1;
563 case DRV_QUERYCONFIGURE: return 1;
564 case DRV_CONFIGURE: MessageBoxA(0, "MIDIMAP MultiMedia Driver !", "OSS Driver", MB_OK); return 1;
565 case DRV_INSTALL: return DRVCNF_RESTART;
566 case DRV_REMOVE: return DRVCNF_RESTART;
567 default:
568 return DefDriverProc(dwDevID, hDriv, wMsg, dwParam1, dwParam2);
569 }
570}
LRESULT WINAPI DefDriverProc(DWORD_PTR dwDriverIdentifier, HDRVR hDrv, UINT Msg, LPARAM lParam1, LPARAM lParam2)
Definition: driver.c:554
#define DRV_LOAD(x)
static LRESULT MIDIMAP_drvClose(DWORD_PTR dwDevID)
Definition: midimap.c:535
static LRESULT MIDIMAP_drvOpen(LPSTR str)
Definition: midimap.c:500
#define DRV_CLOSE
Definition: mmsystem.h:122
#define DRV_QUERYCONFIGURE
Definition: mmsystem.h:126
#define DRVCNF_RESTART
Definition: mmsystem.h:135
#define DRV_REMOVE
Definition: mmsystem.h:128
#define DRV_ENABLE
Definition: mmsystem.h:120
#define DRV_CONFIGURE
Definition: mmsystem.h:125
#define DRV_OPEN
Definition: mmsystem.h:121
#define DRV_INSTALL
Definition: mmsystem.h:127
#define DRV_FREE
Definition: mmsystem.h:124
#define DRV_DISABLE
Definition: mmsystem.h:123
int WINAPI MessageBoxA(_In_opt_ HWND hWnd, _In_opt_ LPCSTR lpText, _In_opt_ LPCSTR lpCaption, _In_ UINT uType)
#define MB_OK
Definition: winuser.h:784
char * LPSTR
Definition: xmlstorage.h:182

◆ MIDIMAP_drvClose()

static LRESULT MIDIMAP_drvClose ( DWORD_PTR  dwDevID)
static

Definition at line 535 of file midimap.c.

536{
537 if (midiOutPorts)
538 {
541 return 1;
542 }
543 return 0;
544}
#define NULL
Definition: types.h:112
#define GetProcessHeap()
Definition: compat.h:736
#define HeapFree(x, y, z)
Definition: compat.h:735
static MIDIOUTPORT * midiOutPorts
Definition: midimap.c:99

Referenced by MIDIMAP_DriverProc().

◆ MIDIMAP_drvOpen()

static LRESULT MIDIMAP_drvOpen ( LPSTR  str)
static

Definition at line 500 of file midimap.c.

501{
502 MIDIOUTCAPSW moc;
503 unsigned dev, i;
504
505 if (midiOutPorts)
506 return 0;
507
510 numMidiOutPorts * sizeof(MIDIOUTPORT));
511 for (dev = 0; dev < numMidiOutPorts; dev++)
512 {
513 if (midiOutGetDevCapsW(dev, &moc, sizeof(moc)) == 0L)
514 {
520 for (i = 0; i < 16; i++)
521 midiOutPorts[dev].aChn[i] = i;
522 }
523 else
524 {
525 midiOutPorts[dev].loaded = -1;
526 }
527 }
528
529 return 1;
530}
#define HeapAlloc
Definition: compat.h:733
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static unsigned numMidiOutPorts
Definition: midimap.c:100
#define L(x)
Definition: ntvdm.h:50
#define strcpyW(d, s)
Definition: unicode.h:29
Definition: name.c:39
WCHAR szPname[MAXPNAMELEN]
Definition: mmsystem.h:1126
HMIDIOUT hMidi
Definition: midimap.c:87
unsigned short uDevID
Definition: midimap.c:88
LPBYTE lpbPatch
Definition: midimap.c:89
UINT WINAPI midiOutGetNumDevs(void)
Definition: winmm.c:809
UINT WINAPI midiOutGetDevCapsW(UINT_PTR uDeviceID, LPMIDIOUTCAPSW lpCaps, UINT uSize)
Definition: winmm.c:817

Referenced by MIDIMAP_DriverProc().

◆ MIDIMAP_FindPort()

static BOOL MIDIMAP_FindPort ( const WCHAR name,
unsigned dev 
)
static

Definition at line 110 of file midimap.c.

111{
112 for (*dev = 0; *dev < numMidiOutPorts; (*dev)++)
113 {
115 if (strcmpW(midiOutPorts[*dev].name, name) == 0)
116 return TRUE;
117 }
118 /* try the form #nnn */
119 if (*name == '#' && isdigit(name[1]))
120 {
121 const WCHAR* ptr = name + 1;
122 *dev = 0;
123 do
124 {
125 *dev = *dev * 10 + *ptr - '0';
126 } while (isdigit(*++ptr));
127 if (*dev < numMidiOutPorts)
128 return TRUE;
129 }
130 return FALSE;
131}
#define isdigit(c)
Definition: acclib.h:68
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define wine_dbgstr_w
Definition: kernel32.h:34
static PVOID ptr
Definition: dispmode.c:27
#define strcmpW(s1, s2)
Definition: unicode.h:38
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by MIDIMAP_LoadSettingsDefault(), and MIDIMAP_LoadSettingsScheme().

◆ MIDIMAP_IsBadData()

static BOOL MIDIMAP_IsBadData ( MIDIMAPDATA mm)
static

Definition at line 102 of file midimap.c.

103{
104 if (!IsBadReadPtr(mm, sizeof(MIDIMAPDATA)) && mm->self == mm)
105 return FALSE;
106 TRACE("Bad midimap data (%p)\n", mm);
107 return TRUE;
108}
BOOL WINAPI IsBadReadPtr(IN LPCVOID lp, IN UINT_PTR ucb)
Definition: except.c:803
struct tagMIDIMAPDATA * self
Definition: midimap.c:95

Referenced by modClose(), modData(), modLongData(), modPrepare(), modReset(), and modUnprepare().

◆ MIDIMAP_LoadSettings()

static BOOL MIDIMAP_LoadSettings ( MIDIMAPDATA mom)
static

Definition at line 203 of file midimap.c.

204{
205 HKEY hKey;
206 BOOL ret;
207
209 "Software\\Microsoft\\Windows\\CurrentVersion\\Multimedia\\MIDIMap", &hKey))
210 {
212 }
213 else
214 {
215 DWORD type, size, out;
216 WCHAR buffer[256];
217
218 ret = 2;
219 size = sizeof(out);
220 if (!RegQueryValueExA(hKey, "UseScheme", 0, &type, (void*)&out, &size) && out)
221 {
222 static const WCHAR cs[] = {'C','u','r','r','e','n','t','S','c','h','e','m','e',0};
223 size = sizeof(buffer);
224 if (!RegQueryValueExW(hKey, cs, 0, &type, (void*)buffer, &size))
225 {
228 }
229 else
230 {
231 ERR("Wrong registry: UseScheme is active, but no CurrentScheme found\n");
232 }
233 }
234 if (ret == 2)
235 {
236 static const WCHAR ci[] = {'C','u','r','r','e','n','t','I','n','s','t','r','u','m','e','n','t',0};
237 size = sizeof(buffer);
238 if (!RegQueryValueExW(hKey, ci, 0, &type, (void*)buffer, &size) && *buffer)
239 {
241 }
242 else if (!RegQueryValueExW(hKey, L"szPname", 0, &type, (void*)buffer, &size) && *buffer)
243 {
244 /* Windows XP and higher setting */
246 }
247 else
248 {
250 }
251 }
252 }
254
255 if (ret && TRACE_ON(msacm))
256 {
257 unsigned i;
258
259 for (i = 0; i < 16; i++)
260 {
261 TRACE("chnMap[%2d] => %d\n",
262 i, mom->ChannelMap[i] ? mom->ChannelMap[i]->uDevID : -1);
263 }
264 }
265 return ret;
266}
#define ERR(fmt,...)
Definition: debug.h:110
#define RegCloseKey(hKey)
Definition: registry.h:47
LONG WINAPI RegOpenKeyA(HKEY hKey, LPCSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3257
LONG WINAPI RegQueryValueExA(_In_ HKEY hkeyorg, _In_ LPCSTR name, _In_ LPDWORD reserved, _Out_opt_ LPDWORD type, _Out_opt_ LPBYTE data, _Inout_opt_ LPDWORD count)
Definition: reg.c:4027
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4121
#define TRACE_ON(x)
Definition: compat.h:75
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
FxAutoRegKey hKey
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLsizeiptr size
Definition: glext.h:5919
GLuint buffer
Definition: glext.h:5915
#define cs
Definition: i386-dis.c:443
static BOOL MIDIMAP_LoadSettingsScheme(MIDIMAPDATA *mom, const WCHAR *scheme)
Definition: midimap.c:152
static BOOL MIDIMAP_LoadSettingsDefault(MIDIMAPDATA *mom, const WCHAR *port)
Definition: midimap.c:133
static FILE * out
Definition: regtests2xml.c:44
MIDIOUTPORT * ChannelMap[16]
Definition: midimap.c:96
int ret
#define HKEY_CURRENT_USER
Definition: winreg.h:11

Referenced by modOpen().

◆ MIDIMAP_LoadSettingsDefault()

static BOOL MIDIMAP_LoadSettingsDefault ( MIDIMAPDATA mom,
const WCHAR port 
)
static

Definition at line 133 of file midimap.c.

134{
135 unsigned i, dev = 0;
136
137 if (port != NULL && !MIDIMAP_FindPort(port, &dev))
138 {
139 ERR("Registry glitch: couldn't find midi out (%s)\n", wine_dbgstr_w(port));
140 dev = 0;
141 }
142
143 /* this is necessary when no midi out ports are present */
144 if (dev >= numMidiOutPorts)
145 return FALSE;
146 /* sets default */
147 for (i = 0; i < 16; i++) mom->ChannelMap[i] = &midiOutPorts[dev];
148
149 return TRUE;
150}
USHORT port
Definition: uri.c:228
static BOOL MIDIMAP_FindPort(const WCHAR *name, unsigned *dev)
Definition: midimap.c:110

Referenced by MIDIMAP_LoadSettings().

◆ MIDIMAP_LoadSettingsScheme()

static BOOL MIDIMAP_LoadSettingsScheme ( MIDIMAPDATA mom,
const WCHAR scheme 
)
static

Definition at line 152 of file midimap.c.

153{
154 HKEY hSchemesKey, hKey, hPortKey;
155 unsigned i, idx, dev;
156 WCHAR buffer[256], port[256];
158
159 for (i = 0; i < 16; i++) mom->ChannelMap[i] = NULL;
160
162 "System\\CurrentControlSet\\Control\\MediaProperties\\PrivateProperties\\Midi\\Schemes",
163 &hSchemesKey))
164 {
165 return FALSE;
166 }
167 if (RegOpenKeyW(hSchemesKey, scheme, &hKey))
168 {
169 RegCloseKey(hSchemesKey);
170 return FALSE;
171 }
172
173 for (idx = 0; !RegEnumKeyW(hKey, idx, buffer, sizeof(buffer)); idx++)
174 {
175 if (RegOpenKeyW(hKey, buffer, &hPortKey)) continue;
176
177 size = sizeof(port);
178 if (RegQueryValueExW(hPortKey, NULL, 0, &type, (void*)port, &size)) continue;
179
180 if (!MIDIMAP_FindPort(port, &dev)) continue;
181
182 size = sizeof(mask);
183 if (RegQueryValueExA(hPortKey, "Channels", 0, &type, (void*)&mask, &size))
184 continue;
185
186 for (i = 0; i < 16; i++)
187 {
188 if (mask & (1 << i))
189 {
190 if (mom->ChannelMap[i])
191 ERR("Quirks in registry, channel %u is mapped twice\n", i);
192 mom->ChannelMap[i] = &midiOutPorts[dev];
193 }
194 }
195 }
196
197 RegCloseKey(hSchemesKey);
199
200 return TRUE;
201}
unsigned int idx
Definition: utils.c:41
LONG WINAPI RegOpenKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3291
LONG WINAPI RegEnumKeyW(HKEY hKey, DWORD dwIndex, LPWSTR lpName, DWORD cbName)
Definition: reg.c:2416
GLenum GLint GLuint mask
Definition: glext.h:6028
if(dx< 0)
Definition: linetemp.h:194
DWORD scheme
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

Referenced by MIDIMAP_LoadSettings().

◆ MIDIMAP_modMessage()

DWORD WINAPI MIDIMAP_modMessage ( UINT  wDevID,
UINT  wMsg,
DWORD_PTR  dwUser,
DWORD_PTR  dwParam1,
DWORD_PTR  dwParam2 
)

Definition at line 459 of file midimap.c.

461{
462 TRACE("(%u, %04X, %08lX, %08lX, %08lX);\n",
463 wDevID, wMsg, dwUser, dwParam1, dwParam2);
464
465 switch (wMsg)
466 {
467 case DRVM_INIT:
468 case DRVM_EXIT:
469 case DRVM_ENABLE:
470 case DRVM_DISABLE:
471 /* FIXME: Pretend this is supported */
472 return 0;
473
474 case MODM_OPEN: return modOpen((DWORD_PTR *)dwUser, (LPMIDIOPENDESC)dwParam1, dwParam2);
475 case MODM_CLOSE: return modClose ((MIDIMAPDATA*)dwUser);
476
477 case MODM_DATA: return modData ((MIDIMAPDATA*)dwUser, dwParam1);
478 case MODM_LONGDATA: return modLongData ((MIDIMAPDATA*)dwUser, (LPMIDIHDR)dwParam1, dwParam2);
479 case MODM_PREPARE: return modPrepare ((MIDIMAPDATA*)dwUser, (LPMIDIHDR)dwParam1, dwParam2);
480 case MODM_UNPREPARE: return modUnprepare ((MIDIMAPDATA*)dwUser, (LPMIDIHDR)dwParam1, dwParam2);
481 case MODM_RESET: return modReset ((MIDIMAPDATA*)dwUser);
482
483 case MODM_GETDEVCAPS: return modGetDevCaps (wDevID, (MIDIMAPDATA*)dwUser, (LPMIDIOUTCAPSW)dwParam1,dwParam2);
484 case MODM_GETNUMDEVS: return 1;
487 default:
488 FIXME("unknown message %d!\n", wMsg);
489 }
491}
#define FIXME(fmt,...)
Definition: debug.h:111
#define MODM_GETDEVCAPS
Definition: mmddk.h:155
#define DRVM_INIT
Definition: mmddk.h:56
#define MODM_PREPARE
Definition: mmddk.h:158
#define DRVM_DISABLE
Definition: mmddk.h:58
#define MODM_RESET
Definition: mmddk.h:162
#define MODM_GETNUMDEVS
Definition: mmddk.h:154
#define MODM_DATA
Definition: mmddk.h:160
#define MODM_GETVOLUME
Definition: mmddk.h:163
#define DRVM_ENABLE
Definition: mmddk.h:59
#define MODM_OPEN
Definition: mmddk.h:156
#define MODM_SETVOLUME
Definition: mmddk.h:164
#define MODM_UNPREPARE
Definition: mmddk.h:159
#define DRVM_EXIT
Definition: mmddk.h:57
#define MODM_LONGDATA
Definition: mmddk.h:161
#define MODM_CLOSE
Definition: mmddk.h:157
static DWORD modClose(MIDIMAPDATA *mom)
Definition: midimap.c:287
static DWORD modPrepare(MIDIMAPDATA *mom, LPMIDIHDR lpMidiHdr, DWORD_PTR dwParam2)
Definition: midimap.c:401
static DWORD modLongData(MIDIMAPDATA *mom, LPMIDIHDR lpMidiHdr, DWORD_PTR dwParam2)
Definition: midimap.c:314
static DWORD modUnprepare(MIDIMAPDATA *mom, LPMIDIHDR lpMidiHdr, DWORD_PTR dwParam2)
Definition: midimap.c:411
static DWORD modData(MIDIMAPDATA *mom, DWORD_PTR dwParam)
Definition: midimap.c:338
static DWORD modOpen(DWORD_PTR *lpdwUser, LPMIDIOPENDESC lpDesc, DWORD dwFlags)
Definition: midimap.c:268
static DWORD modGetDevCaps(UINT wDevID, MIDIMAPDATA *mom, LPMIDIOUTCAPSW lpMidiCaps, DWORD_PTR size)
Definition: midimap.c:421
static DWORD modReset(MIDIMAPDATA *mom)
Definition: midimap.c:437
#define MMSYSERR_NOTSUPPORTED
Definition: mmsystem.h:104
uint32_t DWORD_PTR
Definition: typedefs.h:65

◆ modClose()

static DWORD modClose ( MIDIMAPDATA mom)
static

Definition at line 287 of file midimap.c.

288{
289 UINT i;
291
292 if (MIDIMAP_IsBadData(mom)) return MMSYSERR_ERROR;
293
294 for (i = 0; i < 16; i++)
295 {
296 DWORD t;
297 if (mom->ChannelMap[i] && mom->ChannelMap[i]->loaded > 0)
298 {
299 t = midiOutClose(mom->ChannelMap[i]->hMidi);
300 if (t == MMSYSERR_NOERROR)
301 {
302 mom->ChannelMap[i]->loaded = 0;
303 mom->ChannelMap[i]->hMidi = 0;
304 }
305 else if (ret == MMSYSERR_NOERROR)
306 ret = t;
307 }
308 }
309 if (ret == MMSYSERR_NOERROR)
310 HeapFree(GetProcessHeap(), 0, mom);
311 return ret;
312}
GLdouble GLdouble t
Definition: gl.h:2047
static BOOL MIDIMAP_IsBadData(MIDIMAPDATA *mm)
Definition: midimap.c:102
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
#define MMSYSERR_ERROR
Definition: mmsystem.h:97
unsigned int UINT
Definition: ndis.h:50
UINT WINAPI midiOutClose(HMIDIOUT hMidiOut)
Definition: winmm.c:981

Referenced by MIDIMAP_modMessage().

◆ modData()

static DWORD modData ( MIDIMAPDATA mom,
DWORD_PTR  dwParam 
)
static

Definition at line 338 of file midimap.c.

339{
340 BYTE lb = LOBYTE(LOWORD(dwParam));
341 WORD chn = lb & 0x0F;
343
344 if (MIDIMAP_IsBadData(mom))
345 return MMSYSERR_ERROR;
346
347 if (!mom->ChannelMap[chn]) return MMSYSERR_NOERROR;
348
349 switch (lb & 0xF0)
350 {
351 case 0x80:
352 case 0x90:
353 case 0xA0:
354 case 0xB0:
355 case 0xC0:
356 case 0xD0:
357 case 0xE0:
358 if (mom->ChannelMap[chn]->loaded == 0)
359 {
360 if (midiOutOpen(&mom->ChannelMap[chn]->hMidi, mom->ChannelMap[chn]->uDevID,
362 mom->ChannelMap[chn]->loaded = 1;
363 else
364 mom->ChannelMap[chn]->loaded = -1;
365 /* FIXME: should load here the IDF midi data... and allow channel and
366 * patch mappings
367 */
368 }
369 if (mom->ChannelMap[chn]->loaded > 0)
370 {
371 /* change channel */
372 dwParam &= ~0x0F;
373 dwParam |= mom->ChannelMap[chn]->aChn[chn];
374
375 if ((LOBYTE(LOWORD(dwParam)) & 0xF0) == 0xC0 /* program change */ &&
376 mom->ChannelMap[chn]->lpbPatch)
377 {
378 BYTE patch = HIBYTE(LOWORD(dwParam));
379
380 /* change patch */
381 dwParam &= ~0x0000FF00;
382 dwParam |= mom->ChannelMap[chn]->lpbPatch[patch];
383 }
384 ret = midiOutShortMsg(mom->ChannelMap[chn]->hMidi, dwParam);
385 }
386 break;
387 case 0xF0:
388 for (chn = 0; chn < 16; chn++)
389 {
390 if (mom->ChannelMap[chn]->loaded > 0)
391 ret = midiOutShortMsg(mom->ChannelMap[chn]->hMidi, dwParam);
392 }
393 break;
394 default:
395 FIXME("ooch %lx\n", dwParam);
396 }
397
398 return ret;
399}
unsigned short WORD
Definition: ntddk_ex.h:93
#define LOBYTE(W)
Definition: jmemdos.c:487
#define HIBYTE(W)
Definition: jmemdos.c:486
#define CALLBACK_NULL
Definition: mmsystem.h:147
#define LOWORD(l)
Definition: pedump.c:82
unsigned int aChn[16]
Definition: midimap.c:90
UINT WINAPI midiOutShortMsg(HMIDIOUT hMidiOut, DWORD dwMsg)
Definition: winmm.c:1042
MMRESULT WINAPI midiOutOpen(LPHMIDIOUT lphMidiOut, UINT uDeviceID, DWORD_PTR dwCallback, DWORD_PTR dwInstance, DWORD dwFlags)
Definition: winmm.c:942
unsigned char BYTE
Definition: xxhash.c:193

Referenced by MIDIMAP_modMessage().

◆ modGetDevCaps()

static DWORD modGetDevCaps ( UINT  wDevID,
MIDIMAPDATA mom,
LPMIDIOUTCAPSW  lpMidiCaps,
DWORD_PTR  size 
)
static

Definition at line 421 of file midimap.c.

422{
423 static const WCHAR name[] = {'W','i','n','e',' ','m','i','d','i',' ','m','a','p','p','e','r',0};
424 lpMidiCaps->wMid = 0x00FF;
425 lpMidiCaps->wPid = 0x0001;
426 lpMidiCaps->vDriverVersion = 0x0100;
427 lstrcpyW(lpMidiCaps->szPname, name);
428 lpMidiCaps->wTechnology = MOD_MAPPER;
429 lpMidiCaps->wVoices = 0;
430 lpMidiCaps->wNotes = 0;
431 lpMidiCaps->wChannelMask = 0xFFFF;
432 lpMidiCaps->dwSupport = 0L;
433
434 return MMSYSERR_NOERROR;
435}
#define lstrcpyW
Definition: compat.h:749
#define MOD_MAPPER
Definition: mmsystem.h:263
MMVERSION vDriverVersion
Definition: mmsystem.h:1125

Referenced by MIDIMAP_modMessage().

◆ modLongData()

static DWORD modLongData ( MIDIMAPDATA mom,
LPMIDIHDR  lpMidiHdr,
DWORD_PTR  dwParam2 
)
static

Definition at line 314 of file midimap.c.

315{
316 WORD chn;
318 MIDIHDR mh;
319
320 if (MIDIMAP_IsBadData(mom))
321 return MMSYSERR_ERROR;
322
323 mh = *lpMidiHdr;
324 for (chn = 0; chn < 16; chn++)
325 {
326 if (mom->ChannelMap[chn] && mom->ChannelMap[chn]->loaded > 0)
327 {
328 mh.dwFlags = 0;
329 midiOutPrepareHeader(mom->ChannelMap[chn]->hMidi, &mh, sizeof(mh));
330 ret = midiOutLongMsg(mom->ChannelMap[chn]->hMidi, &mh, sizeof(mh));
331 midiOutUnprepareHeader(mom->ChannelMap[chn]->hMidi, &mh, sizeof(mh));
332 if (ret != MMSYSERR_NOERROR) break;
333 }
334 }
335 return ret;
336}
DWORD dwFlags
Definition: mmsystem.h:1155
UINT WINAPI midiOutLongMsg(HMIDIOUT hMidiOut, MIDIHDR *lpMidiOutHdr, UINT uSize)
Definition: winmm.c:1057
UINT WINAPI midiOutUnprepareHeader(HMIDIOUT hMidiOut, MIDIHDR *lpMidiOutHdr, UINT uSize)
Definition: winmm.c:1019
UINT WINAPI midiOutPrepareHeader(HMIDIOUT hMidiOut, MIDIHDR *lpMidiOutHdr, UINT uSize)
Definition: winmm.c:1000

Referenced by MIDIMAP_modMessage().

◆ modOpen()

static DWORD modOpen ( DWORD_PTR lpdwUser,
LPMIDIOPENDESC  lpDesc,
DWORD  dwFlags 
)
static

Definition at line 268 of file midimap.c.

269{
270 MIDIMAPDATA* mom = HeapAlloc(GetProcessHeap(), 0, sizeof(MIDIMAPDATA));
271
272 TRACE("(%p %p %08lx)\n", lpdwUser, lpDesc, dwFlags);
273
274 if (!mom) return MMSYSERR_NOMEM;
275
276 if (MIDIMAP_LoadSettings(mom))
277 {
278 *lpdwUser = (DWORD_PTR)mom;
279 mom->self = mom;
280
281 return MMSYSERR_NOERROR;
282 }
283 HeapFree(GetProcessHeap(), 0, mom);
285}
static BOOL MIDIMAP_LoadSettings(MIDIMAPDATA *mom)
Definition: midimap.c:203
#define MMSYSERR_NOMEM
Definition: mmsystem.h:103
#define MIDIERR_INVALIDSETUP
Definition: mmsystem.h:236
#define DWORD_PTR
Definition: treelist.c:76
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1176

Referenced by MIDIMAP_modMessage().

◆ modPrepare()

static DWORD modPrepare ( MIDIMAPDATA mom,
LPMIDIHDR  lpMidiHdr,
DWORD_PTR  dwParam2 
)
static

Definition at line 401 of file midimap.c.

402{
403 if (MIDIMAP_IsBadData(mom)) return MMSYSERR_ERROR;
404 if (lpMidiHdr->dwFlags & (MHDR_ISSTRM|MHDR_PREPARED))
405 return MMSYSERR_INVALPARAM;
406
407 lpMidiHdr->dwFlags |= MHDR_PREPARED;
408 return MMSYSERR_NOERROR;
409}
#define MHDR_PREPARED
Definition: mmsystem.h:269
#define MMSYSERR_INVALPARAM
Definition: mmsystem.h:107
#define MHDR_ISSTRM
Definition: mmsystem.h:271

Referenced by MIDIMAP_modMessage().

◆ modReset()

static DWORD modReset ( MIDIMAPDATA mom)
static

Definition at line 437 of file midimap.c.

438{
439 WORD chn;
441
442 if (MIDIMAP_IsBadData(mom))
443 return MMSYSERR_ERROR;
444
445 for (chn = 0; chn < 16; chn++)
446 {
447 if (mom->ChannelMap[chn] && mom->ChannelMap[chn]->loaded > 0)
448 {
449 ret = midiOutReset(mom->ChannelMap[chn]->hMidi);
450 if (ret != MMSYSERR_NOERROR) break;
451 }
452 }
453 return ret;
454}
UINT WINAPI midiOutReset(HMIDIOUT hMidiOut)
Definition: winmm.c:1073

Referenced by MIDIMAP_modMessage().

◆ modUnprepare()

static DWORD modUnprepare ( MIDIMAPDATA mom,
LPMIDIHDR  lpMidiHdr,
DWORD_PTR  dwParam2 
)
static

Definition at line 411 of file midimap.c.

412{
413 if (MIDIMAP_IsBadData(mom)) return MMSYSERR_ERROR;
414 if ((lpMidiHdr->dwFlags & MHDR_ISSTRM) || !(lpMidiHdr->dwFlags & MHDR_PREPARED))
415 return MMSYSERR_INVALPARAM;
416
417 lpMidiHdr->dwFlags &= ~MHDR_PREPARED;
418 return MMSYSERR_NOERROR;
419}

Referenced by MIDIMAP_modMessage().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( msacm  )

Variable Documentation

◆ midiOutPorts

◆ numMidiOutPorts

unsigned numMidiOutPorts
static

Definition at line 100 of file midimap.c.

Referenced by MIDIMAP_drvOpen(), MIDIMAP_FindPort(), and MIDIMAP_LoadSettingsDefault().