39#define MYCBINST 0x4CAFE5A8
40#define WHATEVER 0xFEEDF00D
46 trace(
"skipping spurious message %04x\n",
msg->message);
62 trace(
"Callback! msg=%x %lx %lx\n", uMsg, dwParam1, dwParam2);
69#define test_notification(hwnd, command, m1, p2) test_notification_dbg(hwnd, command, m1, p2, __LINE__)
90 trace_(__FILE__,
line)(
"Message %x, wParam=%lx, lParam=%lx from %s\n",
92 ok_(__FILE__,
line)(
msg.hwnd==
hwnd,
"Didn't get the handle to our test window\n");
93 ok_(__FILE__,
line)(
msg.message==m1 &&
msg.lParam==p2,
"bad message %x/%lx from %s, expect %x/%lx\n",
msg.message,
msg.lParam,
command, m1, p2);
95 else ok_(__FILE__,
line)(m1==0,
"Expect message %x from %s\n", m1,
command);
105 else ok_(__FILE__,
line)(m1==0,
"Expect callback %x from %s\n", m1,
command);
119 "midiInGetDevCaps(dev=%d) rc=%s\n", udev,
mmsys_error(rc));
130 "midiInOpen(dev=%d) rc=%s\n", udev,
mmsys_error(rc));
135 memset(&mhdr, 0,
sizeof(mhdr));
207 ok(mhdr.
dwUser==0x56FA552C,
"MIDIHDR.dwUser changed to %lx\n", mhdr.
dwUser);
226 trace(
"Found no MIDI IN device\n");
235 trace(
"Found %d MIDI IN devices\n", ndevs);
236 for (udev=0; udev < ndevs; udev++) {
237 trace(
"** Testing device %d\n", udev);
241 trace(
"** Testing MIDI mapper\n");
253 ok(!
err,
"mci sysinfo sequencer quantity returned %d\n",
err);
254 if (!
err)
trace(
"Found %s MCI sequencer devices\n",
buf);
259 ok(!
err,
"mci sysinfo sequencer quantity returned %d\n",
err);
264 0xF0, 0x7E, 0x7F, 0x09, 0x01, 0xF7
267 0xF0, 0x7F, 0x7F, 0x04, 0x01, 0x00, 0x00, 0xF7
270 0xF0, 0x7F, 0x7F, 0x04, 0x01, 0x00, 0x7F, 0xF7
285 ok(!rc,
"midiOutGetDevCaps(dev=%d) rc=%s\n", udev,
mmsys_error(rc));
287 trace(
"* %s: manufacturer=%d, product=%d, tech=%d, support=%X: %d voices, %d notes\n",
291 ok(capsA.
wVoices == 0 && capsA.
wNotes == 0,
"external device with notes or voices\n");
303 skip(
"MIDI out not supported\n" );
306 ok(!rc,
"midiOutOpen(dev=%d) rc=%s\n", udev,
mmsys_error(rc));
315 if (!rc)
trace(
"Current volume %x on device %d\n", ovolume, udev);
331 DWORD volume2 = (ovolume < 0x80000000) ? 0xC000C000 : 0x40004000;
338 if (!rc)
trace(
"New volume %x on device %d\n", volume3, udev);
339 todo_wine ok(volume2==volume3,
"volume Set %x = Get %x\n", volume2, volume3);
342 ok(!rc,
"midiOutSetVolume restore rc=%s\n",
mmsys_error(rc));
346 ok(!rc,
"midiOutGetDevCaps(dev=%d) by handle rc=%s\n", udev,
mmsys_error(rc));
357 memset(&mhdr, 0,
sizeof(mhdr));
405 ok(mhdr.
dwUser==0x56FA552C,
"MIDIHDR.dwUser changed to %lx\n", mhdr.
dwUser);
410 if(!rc)
ok(udevid==udev,
"midiOutGetID gives %d, expect %d\n", udevid, udev);
421 ok(!rc,
"midiOutOpen(dev=%d) 0 CALLBACK_WINDOW rc=%s\n", udev,
mmsys_error(rc));
436 skip(
"FluidSynth (at least 1.1.6) doesn't support desired System Exclusive message.\n");
444 ok(!rc,
"midiOutOpen(dev=%d) rc=%s\n", udev,
mmsys_error(rc));
447 memset(&mhdr, 0,
sizeof(mhdr));
500 mmtime.
wType = typein;
503 ok(!rc && (mmtime.
wType == typeout),
"midiStreamPosition type %x converted to %x rc=%s\n", typein, mmtime.
wType,
mmsys_error(rc));
504 if (!rc)
switch(mmtime.
wType) {
506 trace(
"Stream position %ums\n", mmtime.
u.
ms);
509 trace(
"Stream position %u ticks\n", mmtime.
u.
ticks);
512 trace(
"Stream position song pointer %u\n", mmtime.
u.
midi.songptrpos);
515 trace(
"Stream position %02u:%02u:%02u.%02u/%02u\n",
530 0, 0, 0, 0, 0, 0, 0, 0,
532 0, 0, 0, 0, 0, 0, 0, 0,
534 0, 0, 0, 0, 0, 0, 0, 0,
578 switch (mmtime.
wType) {
584 return mmtime.
u.
midi.songptrpos;
609 const DWORD MARGIN = 50;
619 skip(
"MIDI stream not supported\n" );
622 ok(!rc,
"midiStreamOpen(dev=%d) rc=%s\n", udev,
mmsys_error(rc));
627 midiprop.tempo.cbStruct =
sizeof(midiprop.tempo);
629 ok(!rc,
"midiStreamProperty TEMPO rc=%s\n",
mmsys_error(rc));
630 ok(midiprop.tempo.dwTempo==500000,
"default stream tempo %u microsec per quarter note\n", midiprop.tempo.dwTempo);
632 midiprop.tdiv.cbStruct =
sizeof(midiprop.tdiv);
634 ok(!rc,
"midiStreamProperty TIMEDIV rc=%s\n",
mmsys_error(rc));
635 ok(24==
LOWORD(midiprop.tdiv.dwTimeDiv),
"default stream time division %u\n", midiprop.tdiv.dwTimeDiv);
637 memset(&mhdr, 0,
sizeof(mhdr));
658 trace(
"MIDIHDR flags=%x when submitted\n", mhdr.
dwFlags);
675 trace(
"async MIDI still queued\n");
683 trace(
"async MIDI still not done\n");
691 ok(1234567890!=mhdr.dwOffset,
"play left MIDIHDR.dwOffset at %u\n", mhdr.dwOffset);
698 trace(
"MIDIHDR stream flags=%x when finished\n", mhdr.dwFlags);
699 ok(mhdr.dwFlags &
MHDR_DONE,
"MHDR.dwFlags when done %x\n", mhdr.dwFlags);
710 midiprop.tempo.cbStruct =
sizeof(midiprop.tempo);
712 ok(!rc,
"midiStreamProperty TEMPO rc=%s\n",
mmsys_error(rc));
713 ok(0x0493E0==midiprop.tempo.dwTempo,
"stream set tempo %u\n", midiprop.tdiv.dwTimeDiv);
721 ok(!rc,
"midiOutPrepare used flags %x rc=%s\n", mhdr.dwFlags,
mmsys_error(rc));
723 ok(!rc,
"midiOutUnprepare used flags %x rc=%s\n", mhdr.dwFlags,
mmsys_error(rc));
728 ok(mhdr.
dwUser==0x56FA552C,
"MIDIHDR.dwUser changed to %lx\n", mhdr.
dwUser);
745 ok(!rc,
"midiStreamOut 0 bytes recorded rc=%s\n",
mmsys_error(rc));
761 ok(!rc,
"midiStreamOut 1 event out of 2 rc=%s\n",
mmsys_error(rc));
772 ok(!rc,
"midiStreamOut 1 event out of 2 rc=%s\n",
mmsys_error(rc));
785 ok(!rc,
"midiStreamOut 1 event out of 2 rc=%s\n",
mmsys_error(rc));
806 ok(mhdr.
dwUser==0x56FA552C,
"MIDIHDR.dwUser changed to %lx\n", mhdr.
dwUser);
836 trace(
"Device %d accepts NULL CALLBACK_FUNCTION\n", udev);
849 memset(&records, 0,
sizeof(records));
851 ok(records.
done !=
NULL,
"CreateEvent failed (dev=%d)\n", udev);
854 ok(!rc,
"midiStreamOpen(dev=%d) rc=%s\n", udev,
mmsys_error(rc));
860 memset(&mhdr, 0,
sizeof(mhdr));
864 ok(!rc,
"midiOutPrepareHeader(dev=%d) rc=%s\n", udev,
mmsys_error(rc));
867 ok(!rc,
"midiStreamOut(dev=%d) rc=%s\n", udev,
mmsys_error(rc));
873 ok(!rc,
"midiStreamRestart(dev=%d) rc=%s\n", udev,
mmsys_error(rc));
877 ok(!rc,
"midiStreamPause(dev=%d) rc=%s\n", udev,
mmsys_error(rc));
890 ok(!rc,
"midiStreamRestart(dev=%d) rc=%s\n", udev,
mmsys_error(rc));
899 "TIME_TICKS position is continuous, got %u\n",
ret);
902 midiprop.tdiv.cbStruct =
sizeof(midiprop.tdiv);
903 midiprop.tdiv.dwTimeDiv = 24;
911 ok(!rc,
"midiStreamPause(dev=%d) rc=%s\n", udev,
mmsys_error(rc));
916 "expected greater than %ums, got %ums\n",
expected,
ret);
917 trace(
"after playing, got %ums\n",
ret);
920 midiprop.tempo.cbStruct =
sizeof(midiprop.tempo);
921 midiprop.tempo.dwTempo = 250000;
923 ok(!rc,
"midiStreamProperty(SET|TEMPO, dev=%d) rc=%s\n", udev,
mmsys_error(rc));
930 midiprop.tdiv.cbStruct =
sizeof(midiprop.tdiv);
932 ok(!rc,
"midiStreamProperty(GET|TIMEDIV, dev=%d) rc=%s\n", udev,
mmsys_error(rc));
933 ok(midiprop.tdiv.dwTimeDiv == 24,
"expected 24, got %u\n", midiprop.tdiv.dwTimeDiv);
936 expected = (
ret + midiprop.tdiv.dwTimeDiv/8) / (midiprop.tdiv.dwTimeDiv/4);
940 ok(records.
count == 2,
"expected 2 MM_MOM_DONE messages, got %d\n", records.
count);
947 "expected %u ~ %ums, got %ums (dev=%d)\n",
expected - MARGIN,
expected + MARGIN, diff, udev);
950 ok(!rc,
"midiOutUnprepareHeader(dev=%d) rc=%s\n", udev,
mmsys_error(rc));
953 ok(!rc,
"midiStreamStop(dev=%d) rc=%s\n", udev,
mmsys_error(rc));
956 ok(
ret == 0,
"expected 0ms, got %ums\n",
ret);
958 midiprop.tdiv.cbStruct =
sizeof(midiprop.tdiv);
959 midiprop.tdiv.dwTimeDiv = 0xe204;
961 ok(!rc,
"midiStreamProperty(SET|TIMEDIV, dev=%d) rc=%s\n", udev,
mmsys_error(rc));
971 ok(!rc,
"midiStreamClose(dev=%d) rc=%s\n", udev,
mmsys_error(rc));
975 ok(!rc,
"midiOutGetDevCaps(dev=%d) rc=%s\n", udev,
mmsys_error(rc));
979 skip(
"FluidSynth (at least 1.1.6) doesn't support desired System Exclusive message.\n");
983#define ROUNDUP4(n) (((n) + 3) & ~3)
989 ok(!rc,
"midiOutOpen(dev=%d) rc=%s\n", udev,
mmsys_error(rc));
992 midiprop.tdiv.cbStruct =
sizeof(midiprop.tdiv);
993 midiprop.tdiv.dwTimeDiv = 480;
995 ok(!rc,
"midiStreamProperty(TimeDiv) rc=%s\n",
mmsys_error(rc));
1000 memset(&mhdr, 0,
sizeof(mhdr));
1015 e->dwDeltaTime = 96;
1025 e->dwDeltaTime = 240;
1060 if (sub_keys[0] ==
NULL)
1073 return found_vmware;
1089 name_len =
sizeof(
name);
1093 return found_vmware;
1105 static const LPCSTR sub_keys[] = {
"Scsi Port ",
"Scsi Bus ",
"Target Id ",
"Logical Unit Id ",
NULL };
1116 return found_vmware;
1133 skip(
"Found no MIDI out device\n");
1142 "midiOutOpen MAPPER with no MIDI rc=%s\n",
mmsys_error(rc));
1149 trace(
"Found %d MIDI OUT devices\n", ndevs);
1153 for (udev=0; udev < ndevs; udev++) {
1157 trace(
"** Testing device %d\n", udev);
1164 win_skip(
"Skipping this device on VMware, driver problem\n");
1166 trace(
"** Testing MIDI mapper\n");
int strcmp(const char *String1, const char *String2)
ACPI_SIZE strlen(const char *String)
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
#define UlongToHandle(ul)
#define RegCloseKey(hKey)
static HINSTANCE instance
LONG WINAPI RegOpenKeyExA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey, _In_ DWORD ulOptions, _In_ REGSAM samDesired, _Out_ PHKEY phkResult)
LONG WINAPI RegQueryValueExA(_In_ HKEY hkeyorg, _In_ LPCSTR name, _In_ LPDWORD reserved, _Out_opt_ LPDWORD type, _Out_opt_ LPBYTE data, _Inout_opt_ LPDWORD count)
LONG WINAPI RegEnumKeyExA(_In_ HKEY hKey, _In_ DWORD dwIndex, _Out_ LPSTR lpName, _Inout_ LPDWORD lpcbName, _Reserved_ LPDWORD lpReserved, _Out_opt_ LPSTR lpClass, _Inout_opt_ LPDWORD lpcbClass, _Out_opt_ PFILETIME lpftLastWriteTime)
#define HeapFree(x, y, z)
DWORD WINAPI GetTickCount(VOID)
int WINAPI lstrcmpiA(LPCSTR str1, LPCSTR str2)
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
DWORD WINAPI mciSendStringA(LPCSTR lpstrCommand, LPSTR lpstrRet, UINT uRetLen, HWND hwndCallback)
GLuint GLuint GLsizei GLenum type
GLenum GLuint GLenum GLsizei const GLchar * buf
#define trace_(file, line,...)
int WINAPI lstrlenA(LPCSTR lpString)
#define memcpy(s1, s2, n)
#define MMSYSERR_NOTSUPPORTED
#define MIDIERR_INVALIDSETUP
#define MIDICAPS_LRVOLUME
#define MMSYSERR_NODRIVER
#define MIDIERR_UNPREPARED
#define MMSYSERR_INVALPARAM
#define MIDIERR_STILLPLAYING
#define MM_MOM_POSITIONCB
#define CALLBACK_FUNCTION
#define MMSYSERR_BADDEVICEID
#define MMSYSERR_NOTENABLED
static void test_position(void)
#define todo_wine_if(is_todo)
static BOOL scan_subkeys(HKEY parent, const LPCSTR *sub_keys)
static DWORD get_position(HMIDISTRM hm, UINT type)
static void test_midi_outfns(HWND hwnd)
static void test_midi_mci(HWND hwnd)
static const char fluidsynth_prefix[]
static BYTE SysEx_volume_full[]
static void test_notification_dbg(HWND hwnd, const char *command, UINT m1, DWORD_PTR p2, int line)
static BOOL found_fluidsynth
static BOOL spurious_message(LPMSG msg)
static BOOL on_vmware(void)
static void test_midiStream(UINT udev, HWND hwnd)
static BYTE SysEx_reset[]
#define test_notification(hwnd, command, m1, p2)
static MIDISHORTEVENT strmNopsWithDelta[]
static void test_midiOut_device(UINT udev, HWND hwnd)
static void test_midi_infns(HWND hwnd)
static BYTE SysEx_volume_off[]
static void CALLBACK time_stamp_callback(HMIDIOUT hmo, UINT msg, DWORD_PTR instance, DWORD_PTR p1, DWORD_PTR p2)
static MIDISHORTEVENT strmNops[]
static MMRESULT playStream(HMIDISTRM hm, LPMIDIHDR lpMidiHdr)
const char * mmsys_error(MMRESULT error)
static void test_midiIn_device(UINT udev, HWND hwnd)
struct midishortevent_tag MIDISHORTEVENT
static void CALLBACK callback_func(HWAVEOUT hwo, UINT uMsg, DWORD_PTR dwInstance, DWORD_PTR dwParam1, DWORD_PTR dwParam2)
unsigned __int3264 UINT_PTR
#define KEY_ENUMERATE_SUB_KEYS
_In_ DWORD _In_ DWORD dwOffset
#define offsetof(TYPE, MEMBER)
union mmtime_tag::@3048 u
struct mmtime_tag::@3048::@3050 midi
struct mmtime_tag::@3048::@3049 smpte
CHAR szPname[MAXPNAMELEN]
CHAR szPname[MAXPNAMELEN]
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventA(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCSTR lpName OPTIONAL)
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
TW_UINT32 TW_UINT16 TW_UINT16 MSG
DWORD WINAPI GetLastError(void)
MMRESULT WINAPI midiStreamPosition(HMIDISTRM hMidiStrm, LPMMTIME lpMMT, UINT cbmmt)
UINT WINAPI midiInUnprepareHeader(HMIDIIN hMidiIn, MIDIHDR *lpMidiInHdr, UINT uSize)
UINT WINAPI midiOutReset(HMIDIOUT hMidiOut)
MMRESULT WINAPI midiStreamProperty(HMIDISTRM hMidiStrm, LPBYTE lpPropData, DWORD dwProperty)
MMRESULT WINAPI midiStreamRestart(HMIDISTRM hMidiStrm)
UINT WINAPI midiInReset(HMIDIIN hMidiIn)
UINT WINAPI midiInGetNumDevs(void)
UINT WINAPI midiInGetDevCapsA(UINT_PTR uDeviceID, LPMIDIINCAPSA lpCaps, UINT uSize)
UINT WINAPI midiOutLongMsg(HMIDIOUT hMidiOut, MIDIHDR *lpMidiOutHdr, UINT uSize)
UINT WINAPI midiOutSetVolume(HMIDIOUT hMidiOut, DWORD dwVolume)
UINT WINAPI midiOutUnprepareHeader(HMIDIOUT hMidiOut, MIDIHDR *lpMidiOutHdr, UINT uSize)
UINT WINAPI midiOutGetNumDevs(void)
UINT WINAPI midiOutGetVolume(HMIDIOUT hMidiOut, DWORD *lpdwVolume)
UINT WINAPI midiOutClose(HMIDIOUT hMidiOut)
MMRESULT WINAPI midiInOpen(HMIDIIN *lphMidiIn, UINT uDeviceID, DWORD_PTR dwCallback, DWORD_PTR dwInstance, DWORD dwFlags)
UINT WINAPI midiOutGetID(HMIDIOUT hMidiOut, UINT *lpuDeviceID)
UINT WINAPI midiOutShortMsg(HMIDIOUT hMidiOut, DWORD dwMsg)
MMRESULT WINAPI midiOutOpen(LPHMIDIOUT lphMidiOut, UINT uDeviceID, DWORD_PTR dwCallback, DWORD_PTR dwInstance, DWORD dwFlags)
MMRESULT WINAPI midiStreamOut(HMIDISTRM hMidiStrm, LPMIDIHDR lpMidiHdr, UINT cbMidiHdr)
MMRESULT WINAPI midiStreamClose(HMIDISTRM hMidiStrm)
MMRESULT WINAPI midiStreamStop(HMIDISTRM hMidiStrm)
MMRESULT WINAPI midiStreamPause(HMIDISTRM hMidiStrm)
UINT WINAPI midiOutPrepareHeader(HMIDIOUT hMidiOut, MIDIHDR *lpMidiOutHdr, UINT uSize)
UINT WINAPI midiInClose(HMIDIIN hMidiIn)
MMRESULT WINAPI midiStreamOpen(HMIDISTRM *lphMidiStrm, LPUINT lpuDeviceID, DWORD cMidi, DWORD_PTR dwCallback, DWORD_PTR dwInstance, DWORD fdwOpen)
UINT WINAPI midiInAddBuffer(HMIDIIN hMidiIn, MIDIHDR *lpMidiInHdr, UINT uSize)
UINT WINAPI midiOutGetDevCapsA(UINT_PTR uDeviceID, LPMIDIOUTCAPSA lpCaps, UINT uSize)
UINT WINAPI midiInPrepareHeader(HMIDIIN hMidiIn, MIDIHDR *lpMidiInHdr, UINT uSize)
#define HKEY_LOCAL_MACHINE
HWND WINAPI CreateWindowExA(_In_ DWORD dwExStyle, _In_opt_ LPCSTR lpClassName, _In_opt_ LPCSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
DWORD WINAPI MsgWaitForMultipleObjects(_In_ DWORD nCount, _In_reads_opt_(nCount) CONST HANDLE *pHandles, _In_ BOOL fWaitAll, _In_ DWORD dwMilliseconds, _In_ DWORD dwWakeMask)
BOOL WINAPI PeekMessageA(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT, _In_ UINT)
BOOL WINAPI DestroyWindow(_In_ HWND)