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));
202 ok(mhdr.dwBytesRecorded == 0,
"Did some MIDI HW send %u bytes?\n", mhdr.dwBytesRecorded);
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));
752 ok(1234123123==mhdr.dwOffset ||
broken(0==mhdr.dwOffset),
"play 0 set MIDIHDR.dwOffset to %u\n", mhdr.dwOffset);
757 mhdr.dwOffset = 1234123123;
761 ok(!rc,
"midiStreamOut 1 event out of 2 rc=%s\n",
mmsys_error(rc));
766 ok(0==mhdr.dwOffset,
"MIDIHDR.dwOffset 1/2 changed to %u\n", mhdr.dwOffset);
768 mhdr.dwOffset = 1234123123;
772 ok(!rc,
"midiStreamOut 1 event out of 2 rc=%s\n",
mmsys_error(rc));
778 ok(
sizeof(
MIDISHORTEVENT)==mhdr.dwOffset,
"MIDIHDR.dwOffset 2/2 changed to %u\n", mhdr.dwOffset);
779 ok(mhdr.dwBytesRecorded == 2*
sizeof(
MIDISHORTEVENT),
"dwBytesRecorded changed to %u\n", mhdr.dwBytesRecorded);
783 mhdr.dwOffset = 1234123123;
785 ok(!rc,
"midiStreamOut 1 event out of 2 rc=%s\n",
mmsys_error(rc));
790 ok(1234123123==mhdr.dwOffset ||
broken(
sizeof(
MIDISHORTEVENT)==mhdr.dwOffset),
"MIDIHDR.dwOffset nocb changed to %u\n", mhdr.dwOffset);
792 mhdr.dwBytesRecorded = mhdr.dwBufferLength-1;
799 mhdr.dwBytesRecorded = mhdr.dwBufferLength+1;
806 ok(mhdr.dwUser==0x56FA552C,
"MIDIHDR.dwUser changed to %lx\n", mhdr.dwUser);
813 mhdr.dwBufferLength = 70000;
815 ok(mhdr.lpData!=
NULL,
"No %d bytes of memory!\n", mhdr.dwBufferLength);
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);
945 diff = records.time_stamp[1] - records.time_stamp[0];
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));
1004 ok(mhdr.lpData!=
NULL,
"No %d bytes of memory!\n", mhdr.dwBufferLength);
1007 char *
p = mhdr.lpData;
1015 e->dwDeltaTime = 96;
1025 e->dwDeltaTime = 240;
1033 mhdr.dwBytesRecorded = (
DWORD)(
p - mhdr.lpData);
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");
LONG WINAPI RegQueryValueExA(_In_ HKEY hkeyorg, _In_ LPCSTR name, _In_ LPDWORD reserved, _Out_opt_ LPDWORD type, _Out_opt_ LPBYTE data, _Inout_opt_ LPDWORD count)
#define trace_(file, line,...)
static void test_midi_infns(HWND hwnd)
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
static BOOL scan_subkeys(HKEY parent, const LPCSTR *sub_keys)
int WINAPI lstrcmpiA(LPCSTR lpString1, LPCSTR lpString2)
ACPI_SIZE strlen(const char *String)
static const char fluidsynth_prefix[]
UINT WINAPI midiOutGetVolume(HMIDIOUT hMidiOut, DWORD *lpdwVolume)
#define MIDIERR_STILLPLAYING
TW_UINT32 TW_UINT16 TW_UINT16 MSG
UINT WINAPI midiInUnprepareHeader(HMIDIIN hMidiIn, MIDIHDR *lpMidiInHdr, UINT uSize)
#define MIDICAPS_LRVOLUME
union mmtime_tag::@3019 u
MMRESULT WINAPI midiOutOpen(LPHMIDIOUT lphMidiOut, UINT uDeviceID, DWORD_PTR dwCallback, DWORD_PTR dwInstance, DWORD dwFlags)
MMRESULT WINAPI midiInOpen(HMIDIIN *lphMidiIn, UINT uDeviceID, DWORD_PTR dwCallback, DWORD_PTR dwInstance, DWORD dwFlags)
DWORD WINAPI GetTickCount(VOID)
UINT WINAPI midiOutSetVolume(HMIDIOUT hMidiOut, DWORD dwVolume)
LONG WINAPI RegOpenKeyExA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey, _In_ DWORD ulOptions, _In_ REGSAM samDesired, _Out_ PHKEY phkResult)
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
DWORD WINAPI GetLastError(VOID)
UINT WINAPI midiInClose(HMIDIIN hMidiIn)
static void test_notification_dbg(HWND hwnd, const char *command, UINT m1, DWORD_PTR p2, int line)
BOOL WINAPI PeekMessageA(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT, _In_ UINT)
MMRESULT WINAPI midiStreamPause(HMIDISTRM hMidiStrm)
UINT WINAPI midiOutGetID(HMIDIOUT hMidiOut, UINT *lpuDeviceID)
BOOL WINAPI DestroyWindow(_In_ HWND)
static void CALLBACK time_stamp_callback(HMIDIOUT hmo, UINT msg, DWORD_PTR instance, DWORD_PTR p1, DWORD_PTR p2)
CHAR szPname[MAXPNAMELEN]
static void test_midiStream(UINT udev, HWND hwnd)
_In_ DWORD _In_ DWORD dwOffset
UINT WINAPI midiOutShortMsg(HMIDIOUT hMidiOut, DWORD dwMsg)
static BYTE SysEx_volume_full[]
MMRESULT WINAPI midiStreamOut(HMIDISTRM hMidiStrm, LPMIDIHDR lpMidiHdr, UINT cbMidiHdr)
GLenum GLuint GLenum GLsizei const GLchar * buf
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
#define MIDIERR_UNPREPARED
#define MMSYSERR_NODRIVER
UINT WINAPI midiOutGetDevCapsA(UINT_PTR uDeviceID, LPMIDIOUTCAPSA lpCaps, UINT uSize)
MMRESULT WINAPI midiStreamStop(HMIDISTRM hMidiStrm)
VOID CALLBACK_FUNCTION(__in PVOID CallbackContext, __in_opt PVOID Argument1, __in_opt PVOID Argument2)
struct mmtime_tag::@3019::@3020 smpte
#define offsetof(TYPE, MEMBER)
MMRESULT WINAPI midiStreamPosition(HMIDISTRM hMidiStrm, LPMMTIME lpMMT, UINT cbmmt)
UINT WINAPI midiInAddBuffer(HMIDIIN hMidiIn, MIDIHDR *lpMidiInHdr, UINT uSize)
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventA(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCSTR lpName OPTIONAL)
static BOOL spurious_message(LPMSG msg)
DWORD WINAPI mciSendStringA(LPCSTR lpstrCommand, LPSTR lpstrRet, UINT uRetLen, HWND hwndCallback)
UINT WINAPI midiOutPrepareHeader(HMIDIOUT hMidiOut, MIDIHDR *lpMidiOutHdr, UINT uSize)
static MIDISHORTEVENT strmNopsWithDelta[]
UINT WINAPI midiOutReset(HMIDIOUT hMidiOut)
static BYTE SysEx_volume_off[]
MMRESULT WINAPI midiStreamClose(HMIDISTRM hMidiStrm)
MMRESULT WINAPI midiStreamRestart(HMIDISTRM hMidiStrm)
UINT WINAPI midiInPrepareHeader(HMIDIIN hMidiIn, MIDIHDR *lpMidiInHdr, UINT uSize)
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
UINT WINAPI midiOutClose(HMIDIOUT hMidiOut)
#define UlongToHandle(ul)
#define todo_wine_if(is_todo)
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
static void test_midiIn_device(UINT udev, HWND hwnd)
unsigned __int3264 UINT_PTR
#define MMSYSERR_NOTSUPPORTED
#define MMSYSERR_NOTENABLED
static void test_midiOut_device(UINT udev, HWND hwnd)
#define MIDIERR_INVALIDSETUP
DWORD WINAPI MsgWaitForMultipleObjects(_In_ DWORD nCount, _In_reads_opt_(nCount) CONST HANDLE *pHandles, _In_ BOOL fWaitAll, _In_ DWORD dwMilliseconds, _In_ DWORD dwWakeMask)
MMRESULT WINAPI midiStreamOpen(HMIDISTRM *lphMidiStrm, LPUINT lpuDeviceID, DWORD cMidi, DWORD_PTR dwCallback, DWORD_PTR dwInstance, DWORD fdwOpen)
struct mmtime_tag::@3019::@3021 midi
#define memcpy(s1, s2, n)
#define MMSYSERR_BADDEVICEID
UINT WINAPI midiOutUnprepareHeader(HMIDIOUT hMidiOut, MIDIHDR *lpMidiOutHdr, UINT uSize)
const char * mmsys_error(MMRESULT error)
static MMRESULT playStream(HMIDISTRM hm, LPMIDIHDR lpMidiHdr)
struct midishortevent_tag MIDISHORTEVENT
static void test_midi_mci(HWND hwnd)
static DWORD get_position(HMIDISTRM hm, UINT type)
CHAR szPname[MAXPNAMELEN]
static void CALLBACK callback_func(HWAVEOUT hwo, UINT uMsg, DWORD_PTR dwInstance, DWORD_PTR dwParam1, DWORD_PTR dwParam2)
int WINAPI lstrlenA(LPCSTR lpString)
#define MMSYSERR_INVALPARAM
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
UINT WINAPI midiInGetDevCapsA(UINT_PTR uDeviceID, LPMIDIINCAPSA lpCaps, UINT uSize)
static HINSTANCE instance
#define test_notification(hwnd, command, m1, p2)
static BOOL found_fluidsynth
static BOOL on_vmware(void)
int command(const char *fmt,...)
UINT WINAPI midiOutLongMsg(HMIDIOUT hMidiOut, MIDIHDR *lpMidiOutHdr, UINT uSize)
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
UINT WINAPI midiInGetNumDevs(void)
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)
static MIDISHORTEVENT strmNops[]
int strcmp(const char *String1, const char *String2)
#define MM_MOM_POSITIONCB
static void test_position(HMIDISTRM hm, UINT typein, UINT typeout)
static BYTE SysEx_reset[]
GLuint GLuint GLsizei GLenum type
UINT WINAPI midiInReset(HMIDIIN hMidiIn)
UINT WINAPI midiOutGetNumDevs(void)
#define HeapFree(x, y, z)
#define RegCloseKey(hKey)
static void test_midi_outfns(HWND hwnd)
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)
MMRESULT WINAPI midiStreamProperty(HMIDISTRM hMidiStrm, LPBYTE lpPropData, DWORD dwProperty)
#define HKEY_LOCAL_MACHINE
#define KEY_ENUMERATE_SUB_KEYS
GLuint const GLchar * name