2010-01-27 18:32:23 +01:00
|
|
|
/*
|
|
|
|
* Test winmm midi
|
|
|
|
*
|
|
|
|
* Copyright 2010 Jörg Höhle
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdio.h>
|
2018-05-21 14:36:09 +02:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
2010-02-17 00:36:56 +01:00
|
|
|
#include <stddef.h>
|
2010-01-27 18:32:23 +01:00
|
|
|
#include "windows.h"
|
|
|
|
#include "mmsystem.h"
|
2016-09-08 12:48:20 +02:00
|
|
|
#include "objbase.h"
|
2010-01-27 18:32:23 +01:00
|
|
|
#include "wine/test.h"
|
|
|
|
|
|
|
|
extern const char* mmsys_error(MMRESULT error); /* from wave.c */
|
|
|
|
|
|
|
|
/* Test in order of increasing probability to hang.
|
|
|
|
* On many UNIX systems, the Timidity softsynth provides
|
|
|
|
* MIDI sequencer services and it is not particularly robust.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define MYCBINST 0x4CAFE5A8 /* not used with window or thread callbacks */
|
|
|
|
#define WHATEVER 0xFEEDF00D
|
|
|
|
|
|
|
|
static BOOL spurious_message(LPMSG msg)
|
|
|
|
{
|
|
|
|
/* WM_DEVICECHANGE 0x0219 appears randomly */
|
|
|
|
if(msg->message == WM_DEVICECHANGE) {
|
|
|
|
trace("skipping spurious message %04x\n", msg->message);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static UINT cbmsg = 0;
|
|
|
|
static DWORD_PTR cbval1 = WHATEVER;
|
|
|
|
static DWORD_PTR cbval2 = 0;
|
|
|
|
static DWORD_PTR cbinst = MYCBINST;
|
|
|
|
|
|
|
|
static void CALLBACK callback_func(HWAVEOUT hwo, UINT uMsg,
|
|
|
|
DWORD_PTR dwInstance,
|
|
|
|
DWORD_PTR dwParam1, DWORD_PTR dwParam2)
|
|
|
|
{
|
|
|
|
if (winetest_debug>1)
|
|
|
|
trace("Callback! msg=%x %lx %lx\n", uMsg, dwParam1, dwParam2);
|
|
|
|
cbmsg = uMsg;
|
|
|
|
cbval1 = dwParam1; /* mhdr or 0 */
|
|
|
|
cbval2 = dwParam2; /* always 0 */
|
|
|
|
cbinst = dwInstance; /* MYCBINST, see midiOut/StreamOpen */
|
|
|
|
}
|
|
|
|
|
2010-03-29 10:15:16 +02:00
|
|
|
#define test_notification(hwnd, command, m1, p2) test_notification_dbg(hwnd, command, m1, p2, __LINE__)
|
|
|
|
static void test_notification_dbg(HWND hwnd, const char* command, UINT m1, DWORD_PTR p2, int line)
|
2010-01-27 18:32:23 +01:00
|
|
|
{ /* Use message type 0 as meaning no message */
|
|
|
|
MSG msg;
|
|
|
|
if (hwnd) {
|
|
|
|
/* msg.wParam is hmidiout, msg.lParam is the mhdr (or 0) */
|
|
|
|
BOOL seen;
|
|
|
|
do { seen = PeekMessageA(&msg, hwnd, 0, 0, PM_REMOVE); }
|
|
|
|
while(seen && spurious_message(&msg));
|
2010-02-23 19:19:12 +01:00
|
|
|
if (m1 && !seen) {
|
|
|
|
/* We observe transient delayed notification, mostly on native.
|
|
|
|
* Perhaps the OS preempts the player thread after setting MHDR_DONE
|
|
|
|
* or clearing MHDR_INQUEUE, before calling DriverCallback. */
|
|
|
|
DWORD rc;
|
2010-03-29 10:15:16 +02:00
|
|
|
trace_(__FILE__,line)("Waiting for delayed message %x from %s\n", m1, command);
|
2010-02-23 19:19:12 +01:00
|
|
|
SetLastError(0xDEADBEEF);
|
|
|
|
rc = MsgWaitForMultipleObjects(0, NULL, FALSE, 3000, QS_POSTMESSAGE);
|
2010-03-29 10:15:16 +02:00
|
|
|
ok_(__FILE__,line)(rc==WAIT_OBJECT_0, "Wait failed: %04x %d\n", rc, GetLastError());
|
2010-02-23 19:19:12 +01:00
|
|
|
seen = PeekMessageA(&msg, hwnd, 0, 0, PM_REMOVE);
|
|
|
|
}
|
2010-01-27 18:32:23 +01:00
|
|
|
if (seen) {
|
2010-03-29 10:15:16 +02:00
|
|
|
trace_(__FILE__,line)("Message %x, wParam=%lx, lParam=%lx from %s\n",
|
2010-01-27 18:32:23 +01:00
|
|
|
msg.message, msg.wParam, msg.lParam, command);
|
2010-03-29 10:15:16 +02:00
|
|
|
ok_(__FILE__,line)(msg.hwnd==hwnd, "Didn't get the handle to our test window\n");
|
|
|
|
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);
|
2010-01-27 18:32:23 +01:00
|
|
|
}
|
2010-03-29 10:15:16 +02:00
|
|
|
else ok_(__FILE__,line)(m1==0, "Expect message %x from %s\n", m1, command);
|
2010-01-27 18:32:23 +01:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* FIXME: MOM_POSITIONCB and MOM_DONE are so close that a queue is needed. */
|
|
|
|
if (cbmsg) {
|
2010-03-29 10:15:16 +02:00
|
|
|
ok_(__FILE__,line)(cbmsg==m1 && cbval1==p2 && cbval2==0, "bad callback %x/%lx/%lx from %s, expect %x/%lx\n", cbmsg, cbval1, cbval2, command, m1, p2);
|
2010-01-27 18:32:23 +01:00
|
|
|
cbmsg = 0; /* Mark as read */
|
|
|
|
cbval1 = cbval2 = WHATEVER;
|
2010-03-29 10:15:16 +02:00
|
|
|
ok_(__FILE__,line)(cbinst==MYCBINST, "callback dwInstance changed to %lx\n", cbinst);
|
2010-01-27 18:32:23 +01:00
|
|
|
}
|
2010-03-29 10:15:16 +02:00
|
|
|
else ok_(__FILE__,line)(m1==0, "Expect callback %x from %s\n", m1, command);
|
2010-01-27 18:32:23 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void test_midiIn_device(UINT udev, HWND hwnd)
|
|
|
|
{
|
|
|
|
HMIDIIN hm;
|
|
|
|
MMRESULT rc;
|
|
|
|
MIDIINCAPSA capsA;
|
|
|
|
MIDIHDR mhdr;
|
|
|
|
|
|
|
|
rc = midiInGetDevCapsA(udev, &capsA, sizeof(capsA));
|
|
|
|
ok((MIDIMAPPER==udev) ? (rc==MMSYSERR_BADDEVICEID || broken(rc==MMSYSERR_NODRIVER /*nt,w2k*/)) : rc==0,
|
|
|
|
"midiInGetDevCaps(dev=%d) rc=%s\n", udev, mmsys_error(rc));
|
|
|
|
if (!rc) {
|
|
|
|
/* MIDI IN capsA.dwSupport may contain garbage, absent in old MS-Windows */
|
|
|
|
trace("* %s: manufacturer=%d, product=%d, support=%X\n", capsA.szPname, capsA.wMid, capsA.wPid, capsA.dwSupport);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (hwnd)
|
|
|
|
rc = midiInOpen(&hm, udev, (DWORD_PTR)hwnd, (DWORD_PTR)MYCBINST, CALLBACK_WINDOW);
|
|
|
|
else
|
|
|
|
rc = midiInOpen(&hm, udev, (DWORD_PTR)callback_func, (DWORD_PTR)MYCBINST, CALLBACK_FUNCTION);
|
|
|
|
ok((MIDIMAPPER!=udev) ? rc==0 : (rc==MMSYSERR_BADDEVICEID || broken(rc==MMSYSERR_NODRIVER /*nt,w2k*/)),
|
|
|
|
"midiInOpen(dev=%d) rc=%s\n", udev, mmsys_error(rc));
|
|
|
|
if (rc) return;
|
|
|
|
|
|
|
|
test_notification(hwnd, "midiInOpen", MIM_OPEN, 0);
|
|
|
|
|
2010-10-01 15:39:18 +02:00
|
|
|
memset(&mhdr, 0, sizeof(mhdr));
|
2013-01-26 23:29:31 +01:00
|
|
|
mhdr.dwFlags = MHDR_DONE;
|
2010-01-27 18:32:23 +01:00
|
|
|
mhdr.dwUser = 0x56FA552C;
|
|
|
|
mhdr.dwBufferLength = 70000; /* > 64KB! */
|
2013-01-26 23:29:31 +01:00
|
|
|
mhdr.dwBytesRecorded = 5;
|
2010-01-27 18:32:23 +01:00
|
|
|
mhdr.lpData = HeapAlloc(GetProcessHeap(), 0 , mhdr.dwBufferLength);
|
|
|
|
ok(mhdr.lpData!=NULL, "No %d bytes of memory!\n", mhdr.dwBufferLength);
|
|
|
|
if (mhdr.lpData) {
|
2010-02-17 00:36:56 +01:00
|
|
|
rc = midiInPrepareHeader(hm, &mhdr, offsetof(MIDIHDR,dwOffset)-1);
|
|
|
|
ok(rc==MMSYSERR_INVALPARAM, "midiInPrepare tiny rc=%s\n", mmsys_error(rc));
|
2013-01-26 23:29:31 +01:00
|
|
|
ok(mhdr.dwFlags == MHDR_DONE, "dwFlags=%x\n", mhdr.dwFlags);
|
|
|
|
|
|
|
|
mhdr.dwFlags |= MHDR_INQUEUE;
|
2010-02-17 00:36:56 +01:00
|
|
|
rc = midiInPrepareHeader(hm, &mhdr, offsetof(MIDIHDR,dwOffset));
|
|
|
|
ok(!rc, "midiInPrepare old size rc=%s\n", mmsys_error(rc));
|
2013-01-26 23:29:31 +01:00
|
|
|
ok(mhdr.dwFlags == (MHDR_PREPARED|MHDR_INQUEUE|MHDR_DONE)/*w9x*/ ||
|
|
|
|
mhdr.dwFlags == MHDR_PREPARED, "dwFlags=%x\n", mhdr.dwFlags);
|
|
|
|
trace("MIDIHDR flags=%x when unsent\n", mhdr.dwFlags);
|
|
|
|
|
|
|
|
mhdr.dwFlags |= MHDR_INQUEUE|MHDR_DONE;
|
2010-01-27 18:32:23 +01:00
|
|
|
rc = midiInPrepareHeader(hm, &mhdr, sizeof(mhdr));
|
2010-01-31 21:19:39 +01:00
|
|
|
ok(!rc, "midiInPrepare rc=%s\n", mmsys_error(rc));
|
2013-01-26 23:29:31 +01:00
|
|
|
ok(mhdr.dwFlags == (MHDR_PREPARED|MHDR_INQUEUE|MHDR_DONE), "dwFlags=%x\n", mhdr.dwFlags);
|
|
|
|
|
|
|
|
mhdr.dwFlags &= ~MHDR_INQUEUE;
|
2010-01-27 18:32:23 +01:00
|
|
|
rc = midiInUnprepareHeader(hm, &mhdr, sizeof(mhdr));
|
|
|
|
ok(!rc, "midiInUnprepare rc=%s\n", mmsys_error(rc));
|
2013-01-26 23:29:31 +01:00
|
|
|
ok(mhdr.dwFlags == MHDR_DONE, "dwFlags=%x\n", mhdr.dwFlags);
|
2010-01-27 18:32:23 +01:00
|
|
|
|
2013-01-26 23:29:31 +01:00
|
|
|
mhdr.dwFlags &= ~MHDR_DONE;
|
|
|
|
rc = midiInUnprepareHeader(hm, &mhdr, sizeof(mhdr));
|
|
|
|
ok(!rc, "midiInUnprepare rc=%s\n", mmsys_error(rc));
|
|
|
|
ok(mhdr.dwFlags == 0, "dwFlags=%x\n", mhdr.dwFlags);
|
|
|
|
|
|
|
|
rc = midiInPrepareHeader(hm, &mhdr, offsetof(MIDIHDR,dwOffset));
|
|
|
|
ok(!rc, "midiInPrepare rc=%s\n", mmsys_error(rc));
|
|
|
|
ok(mhdr.dwFlags == MHDR_PREPARED, "dwFlags=%x\n", mhdr.dwFlags);
|
|
|
|
|
|
|
|
mhdr.dwFlags |= MHDR_DONE;
|
|
|
|
rc = midiInPrepareHeader(hm, &mhdr, offsetof(MIDIHDR,dwOffset));
|
|
|
|
ok(!rc, "midiInPrepare rc=%s\n", mmsys_error(rc));
|
|
|
|
ok(mhdr.dwBytesRecorded == 5, "BytesRec=%u\n", mhdr.dwBytesRecorded);
|
|
|
|
|
|
|
|
mhdr.dwFlags |= MHDR_DONE;
|
|
|
|
rc = midiInAddBuffer(hm, &mhdr, sizeof(mhdr));
|
|
|
|
ok(!rc, "midiAddBuffer rc=%s\n", mmsys_error(rc));
|
|
|
|
ok(mhdr.dwFlags == (MHDR_PREPARED|MHDR_INQUEUE), "dwFlags=%x\n", mhdr.dwFlags);
|
|
|
|
|
|
|
|
/* w95 does not set dwBytesRecorded=0 within midiInAddBuffer. Wine does. */
|
|
|
|
if (mhdr.dwBytesRecorded != 0)
|
|
|
|
trace("dwBytesRecorded %u\n", mhdr.dwBytesRecorded);
|
2010-01-27 18:32:23 +01:00
|
|
|
|
2013-01-26 23:29:31 +01:00
|
|
|
rc = midiInAddBuffer(hm, &mhdr, sizeof(mhdr));
|
|
|
|
ok(rc==MIDIERR_STILLPLAYING, "midiAddBuffer rc=%s\n", mmsys_error(rc));
|
|
|
|
|
|
|
|
rc = midiInPrepareHeader(hm, &mhdr, offsetof(MIDIHDR,dwOffset));
|
|
|
|
ok(!rc, "midiInPrepare rc=%s\n", mmsys_error(rc));
|
|
|
|
ok(mhdr.dwFlags == (MHDR_PREPARED|MHDR_INQUEUE), "dwFlags=%x\n", mhdr.dwFlags);
|
|
|
|
}
|
2010-01-27 18:32:23 +01:00
|
|
|
rc = midiInReset(hm); /* Return any pending buffer */
|
|
|
|
ok(!rc, "midiInReset rc=%s\n", mmsys_error(rc));
|
2013-01-26 23:29:31 +01:00
|
|
|
test_notification(hwnd, "midiInReset", MIM_LONGDATA, (DWORD_PTR)&mhdr);
|
|
|
|
|
|
|
|
ok(mhdr.dwFlags == (MHDR_PREPARED|MHDR_DONE), "dwFlags=%x\n", mhdr.dwFlags);
|
|
|
|
rc = midiInUnprepareHeader(hm, &mhdr, sizeof(mhdr));
|
|
|
|
ok(!rc, "midiInUnprepare rc=%s\n", mmsys_error(rc));
|
|
|
|
|
|
|
|
ok(mhdr.dwBytesRecorded == 0, "Did some MIDI HW send %u bytes?\n", mhdr.dwBytesRecorded);
|
2010-01-27 18:32:23 +01:00
|
|
|
|
|
|
|
rc = midiInClose(hm);
|
|
|
|
ok(!rc, "midiInClose rc=%s\n", mmsys_error(rc));
|
2013-01-26 23:29:31 +01:00
|
|
|
|
|
|
|
ok(mhdr.dwUser==0x56FA552C, "MIDIHDR.dwUser changed to %lx\n", mhdr.dwUser);
|
|
|
|
HeapFree(GetProcessHeap(), 0, mhdr.lpData);
|
2010-01-27 18:32:23 +01:00
|
|
|
test_notification(hwnd, "midiInClose", MIM_CLOSE, 0);
|
|
|
|
test_notification(hwnd, "midiIn over", 0, WHATEVER);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void test_midi_infns(HWND hwnd)
|
|
|
|
{
|
|
|
|
HMIDIIN hm;
|
|
|
|
MMRESULT rc;
|
|
|
|
UINT udev, ndevs = midiInGetNumDevs();
|
|
|
|
|
|
|
|
rc = midiInOpen(&hm, ndevs, 0, 0, CALLBACK_NULL);
|
|
|
|
ok(rc==MMSYSERR_BADDEVICEID, "midiInOpen udev>max rc=%s\n", mmsys_error(rc));
|
|
|
|
if (!rc) {
|
|
|
|
rc = midiInClose(hm);
|
|
|
|
ok(!rc, "midiInClose rc=%s\n", mmsys_error(rc));
|
|
|
|
}
|
|
|
|
if (!ndevs) {
|
|
|
|
trace("Found no MIDI IN device\n"); /* no skip for this common situation */
|
|
|
|
rc = midiInOpen(&hm, MIDIMAPPER, 0, 0, CALLBACK_NULL);
|
|
|
|
ok(rc==MMSYSERR_BADDEVICEID || broken(rc==MMSYSERR_NODRIVER /*nt,w2k*/), "midiInOpen MAPPER with no MIDI rc=%s\n", mmsys_error(rc));
|
|
|
|
if (!rc) {
|
|
|
|
rc = midiInClose(hm);
|
|
|
|
ok(!rc, "midiInClose rc=%s\n", mmsys_error(rc));
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
trace("Found %d MIDI IN devices\n", ndevs);
|
|
|
|
for (udev=0; udev < ndevs; udev++) {
|
|
|
|
trace("** Testing device %d\n", udev);
|
|
|
|
test_midiIn_device(udev, hwnd);
|
|
|
|
Sleep(50);
|
|
|
|
}
|
|
|
|
trace("** Testing MIDI mapper\n");
|
|
|
|
test_midiIn_device(MIDIMAPPER, hwnd);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void test_midi_mci(HWND hwnd)
|
|
|
|
{
|
|
|
|
MCIERROR err;
|
|
|
|
char buf[1024];
|
|
|
|
memset(buf, 0, sizeof(buf));
|
|
|
|
|
2013-10-15 22:12:43 +02:00
|
|
|
err = mciSendStringA("sysinfo sequencer quantity", buf, sizeof(buf), hwnd);
|
2010-01-27 18:32:23 +01:00
|
|
|
ok(!err, "mci sysinfo sequencer quantity returned %d\n", err);
|
|
|
|
if (!err) trace("Found %s MCI sequencer devices\n", buf);
|
2010-06-01 22:33:43 +02:00
|
|
|
|
|
|
|
if (!strcmp(buf, "0")) return;
|
|
|
|
|
2013-10-15 22:12:43 +02:00
|
|
|
err = mciSendStringA("capability sequencer can record", buf, sizeof(buf), hwnd);
|
2010-06-01 22:33:43 +02:00
|
|
|
ok(!err, "mci sysinfo sequencer quantity returned %d\n", err);
|
|
|
|
if(!err) ok(!strcmp(buf, "false"), "capability can record is %s\n", buf);
|
2010-01-27 18:32:23 +01:00
|
|
|
}
|
|
|
|
|
2018-04-04 17:40:42 +02:00
|
|
|
static BYTE SysEx_reset[] = {
|
|
|
|
0xF0, 0x7E, 0x7F, 0x09, 0x01, 0xF7 /* GM System ON */
|
|
|
|
};
|
|
|
|
static BYTE SysEx_volume_off[] = {
|
|
|
|
0xF0, 0x7F, 0x7F, 0x04, 0x01, 0x00, 0x00, 0xF7
|
|
|
|
};
|
|
|
|
static BYTE SysEx_volume_full[] = {
|
|
|
|
0xF0, 0x7F, 0x7F, 0x04, 0x01, 0x00, 0x7F, 0xF7
|
|
|
|
};
|
|
|
|
static BOOL found_fluidsynth;
|
|
|
|
const static char fluidsynth_prefix[] = "Synth input port ";
|
2010-01-27 18:32:23 +01:00
|
|
|
|
|
|
|
static void test_midiOut_device(UINT udev, HWND hwnd)
|
|
|
|
{
|
|
|
|
HMIDIOUT hm;
|
|
|
|
MMRESULT rc;
|
|
|
|
MIDIOUTCAPSA capsA;
|
|
|
|
DWORD ovolume;
|
2010-03-09 22:20:55 +01:00
|
|
|
UINT udevid;
|
2010-01-27 18:32:23 +01:00
|
|
|
MIDIHDR mhdr;
|
|
|
|
|
|
|
|
rc = midiOutGetDevCapsA(udev, &capsA, sizeof(capsA));
|
|
|
|
ok(!rc, "midiOutGetDevCaps(dev=%d) rc=%s\n", udev, mmsys_error(rc));
|
|
|
|
if (!rc) {
|
2010-03-09 22:20:55 +01:00
|
|
|
trace("* %s: manufacturer=%d, product=%d, tech=%d, support=%X: %d voices, %d notes\n",
|
|
|
|
capsA.szPname, capsA.wMid, capsA.wPid, capsA.wTechnology, capsA.dwSupport, capsA.wVoices, capsA.wNotes);
|
|
|
|
ok(!((MIDIMAPPER==udev) ^ (MOD_MAPPER==capsA.wTechnology)), "technology %d on device %d\n", capsA.wTechnology, udev);
|
|
|
|
if (MOD_MIDIPORT == capsA.wTechnology) {
|
|
|
|
ok(capsA.wVoices == 0 && capsA.wNotes == 0, "external device with notes or voices\n");
|
|
|
|
ok(capsA.wChannelMask == 0xFFFF, "external device channel mask %x\n", capsA.wChannelMask);
|
|
|
|
ok(!(capsA.dwSupport & (MIDICAPS_VOLUME|MIDICAPS_LRVOLUME|MIDICAPS_CACHE)), "external device support=%X\n", capsA.dwSupport);
|
|
|
|
}
|
2010-01-27 18:32:23 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (hwnd)
|
|
|
|
rc = midiOutOpen(&hm, udev, (DWORD_PTR)hwnd, (DWORD_PTR)MYCBINST, CALLBACK_WINDOW);
|
|
|
|
else
|
|
|
|
rc = midiOutOpen(&hm, udev, (DWORD_PTR)callback_func, (DWORD_PTR)MYCBINST, CALLBACK_FUNCTION);
|
2013-10-29 23:31:04 +01:00
|
|
|
if (rc == MMSYSERR_NOTSUPPORTED || rc == MMSYSERR_NODRIVER)
|
2010-09-29 12:19:34 +02:00
|
|
|
{
|
|
|
|
skip( "MIDI out not supported\n" );
|
|
|
|
return;
|
|
|
|
}
|
2010-01-27 18:32:23 +01:00
|
|
|
ok(!rc, "midiOutOpen(dev=%d) rc=%s\n", udev, mmsys_error(rc));
|
|
|
|
if (rc) return;
|
|
|
|
|
|
|
|
test_notification(hwnd, "midiOutOpen", MOM_OPEN, 0);
|
|
|
|
|
|
|
|
rc = midiOutGetVolume(hm, &ovolume);
|
2010-02-17 00:36:56 +01:00
|
|
|
ok((capsA.dwSupport & MIDICAPS_VOLUME) ? rc==MMSYSERR_NOERROR : rc==MMSYSERR_NOTSUPPORTED, "midiOutGetVolume rc=%s\n", mmsys_error(rc));
|
2010-01-27 18:32:23 +01:00
|
|
|
/* The native mapper responds with FFFFFFFF initially,
|
|
|
|
* real devices with the volume GUI SW-synth settings. */
|
|
|
|
if (!rc) trace("Current volume %x on device %d\n", ovolume, udev);
|
|
|
|
|
2010-02-20 12:54:48 +01:00
|
|
|
/* The W95 ESFM Synthesis device reports NOTENABLED although
|
|
|
|
* GetVolume by handle works and music plays. */
|
2010-04-12 15:39:32 +02:00
|
|
|
rc = midiOutGetVolume(UlongToHandle(udev), &ovolume);
|
2010-02-20 12:54:48 +01:00
|
|
|
ok((capsA.dwSupport & MIDICAPS_VOLUME) ? rc==MMSYSERR_NOERROR || broken(rc==MMSYSERR_NOTENABLED) : rc==MMSYSERR_NOTSUPPORTED, "midiOutGetVolume(dev=%d) rc=%s\n", udev, mmsys_error(rc));
|
|
|
|
|
2010-03-09 22:20:55 +01:00
|
|
|
rc = midiOutGetVolume(hm, NULL);
|
|
|
|
ok(rc==MMSYSERR_INVALPARAM, "midiOutGetVolume NULL rc=%s\n", mmsys_error(rc));
|
|
|
|
|
2010-01-27 18:32:23 +01:00
|
|
|
/* Tests with midiOutSetvolume show that the midi mapper forwards
|
|
|
|
* the value to the real device, but Get initially always reports
|
|
|
|
* FFFFFFFF. Therefore, a Get+SetVolume pair with the mapper is
|
|
|
|
* not adequate to restore the value prior to tests.
|
|
|
|
*/
|
|
|
|
if (winetest_interactive && (capsA.dwSupport & MIDICAPS_VOLUME)) {
|
|
|
|
DWORD volume2 = (ovolume < 0x80000000) ? 0xC000C000 : 0x40004000;
|
|
|
|
rc = midiOutSetVolume(hm, volume2);
|
|
|
|
ok(!rc, "midiOutSetVolume rc=%s\n", mmsys_error(rc));
|
|
|
|
if (!rc) {
|
|
|
|
DWORD volume3;
|
|
|
|
rc = midiOutGetVolume(hm, &volume3);
|
|
|
|
ok(!rc, "midiOutGetVolume new rc=%s\n", mmsys_error(rc));
|
|
|
|
if (!rc) trace("New volume %x on device %d\n", volume3, udev);
|
|
|
|
todo_wine ok(volume2==volume3, "volume Set %x = Get %x\n", volume2, volume3);
|
|
|
|
|
|
|
|
rc = midiOutSetVolume(hm, ovolume);
|
|
|
|
ok(!rc, "midiOutSetVolume restore rc=%s\n", mmsys_error(rc));
|
|
|
|
}
|
|
|
|
}
|
2010-02-16 15:50:21 +01:00
|
|
|
rc = midiOutGetDevCapsA((UINT_PTR)hm, &capsA, sizeof(capsA));
|
2010-01-27 18:32:23 +01:00
|
|
|
ok(!rc, "midiOutGetDevCaps(dev=%d) by handle rc=%s\n", udev, mmsys_error(rc));
|
2010-02-16 15:50:21 +01:00
|
|
|
rc = midiInGetDevCapsA((UINT_PTR)hm, (LPMIDIINCAPSA)&capsA, sizeof(DWORD));
|
2010-01-27 18:32:23 +01:00
|
|
|
ok(rc==MMSYSERR_BADDEVICEID, "midiInGetDevCaps(dev=%d) by out handle rc=%s\n", udev, mmsys_error(rc));
|
|
|
|
|
|
|
|
{ DWORD e = 0x006F4893; /* velocity, note (#69 would be 440Hz) channel */
|
|
|
|
trace("ShortMsg type %x\n", LOBYTE(LOWORD(e)));
|
|
|
|
rc = midiOutShortMsg(hm, e);
|
|
|
|
ok(!rc, "midiOutShortMsg rc=%s\n", mmsys_error(rc));
|
|
|
|
if (!rc) Sleep(400); /* Hear note */
|
|
|
|
}
|
|
|
|
|
2010-10-01 15:39:18 +02:00
|
|
|
memset(&mhdr, 0, sizeof(mhdr));
|
2013-01-26 23:29:31 +01:00
|
|
|
mhdr.dwFlags = MHDR_DONE;
|
2010-02-17 00:36:56 +01:00
|
|
|
mhdr.dwUser = 0x56FA552C;
|
|
|
|
mhdr.dwOffset = 0xDEADBEEF;
|
2010-01-27 18:32:23 +01:00
|
|
|
mhdr.dwBufferLength = 70000; /* > 64KB! */
|
|
|
|
mhdr.lpData = HeapAlloc(GetProcessHeap(), 0 , mhdr.dwBufferLength);
|
|
|
|
ok(mhdr.lpData!=NULL, "No %d bytes of memory!\n", mhdr.dwBufferLength);
|
|
|
|
if (mhdr.lpData) {
|
|
|
|
rc = midiOutLongMsg(hm, &mhdr, sizeof(mhdr));
|
|
|
|
ok(rc==MIDIERR_UNPREPARED, "midiOutLongMsg unprepared rc=%s\n", mmsys_error(rc));
|
2013-01-26 23:29:31 +01:00
|
|
|
ok(mhdr.dwFlags == MHDR_DONE, "dwFlags=%x\n", mhdr.dwFlags);
|
2010-01-27 18:32:23 +01:00
|
|
|
test_notification(hwnd, "midiOutLong unprepared", 0, WHATEVER);
|
|
|
|
|
2010-02-17 00:36:56 +01:00
|
|
|
rc = midiOutPrepareHeader(hm, &mhdr, offsetof(MIDIHDR,dwOffset)-1);
|
|
|
|
ok(rc==MMSYSERR_INVALPARAM, "midiOutPrepare tiny rc=%s\n", mmsys_error(rc));
|
2013-01-26 23:29:31 +01:00
|
|
|
ok(mhdr.dwFlags == MHDR_DONE, "dwFlags=%x\n", mhdr.dwFlags);
|
|
|
|
|
|
|
|
/* Since at least w2k, midiOutPrepare clears the DONE and INQUEUE flags. w95 didn't. */
|
|
|
|
/* mhdr.dwFlags |= MHDR_INQUEUE; would cause w95 to return STILLPLAYING from Unprepare */
|
2010-02-17 00:36:56 +01:00
|
|
|
rc = midiOutPrepareHeader(hm, &mhdr, offsetof(MIDIHDR,dwOffset));
|
|
|
|
ok(!rc, "midiOutPrepare old size rc=%s\n", mmsys_error(rc));
|
2013-01-26 23:29:31 +01:00
|
|
|
ok(mhdr.dwFlags == (MHDR_PREPARED|MHDR_DONE)/*w9x*/ ||
|
|
|
|
mhdr.dwFlags == MHDR_PREPARED, "dwFlags=%x\n", mhdr.dwFlags);
|
|
|
|
trace("MIDIHDR flags=%x when unsent\n", mhdr.dwFlags);
|
|
|
|
|
|
|
|
/* No flag is cleared when already prepared. */
|
|
|
|
mhdr.dwFlags |= MHDR_DONE|MHDR_INQUEUE;
|
2010-01-27 18:32:23 +01:00
|
|
|
rc = midiOutPrepareHeader(hm, &mhdr, sizeof(mhdr));
|
2010-01-31 21:19:39 +01:00
|
|
|
ok(!rc, "midiOutPrepare rc=%s\n", mmsys_error(rc));
|
2013-01-26 23:29:31 +01:00
|
|
|
ok(mhdr.dwFlags == (MHDR_PREPARED|MHDR_DONE|MHDR_INQUEUE), "dwFlags=%x\n", mhdr.dwFlags);
|
|
|
|
|
|
|
|
mhdr.dwFlags |= MHDR_INQUEUE;
|
|
|
|
rc = midiOutUnprepareHeader(hm, &mhdr, sizeof(mhdr));
|
|
|
|
ok(rc==MIDIERR_STILLPLAYING, "midiOutUnprepare rc=%s\n", mmsys_error(rc));
|
|
|
|
ok(mhdr.dwFlags == (MHDR_PREPARED|MHDR_DONE|MHDR_INQUEUE), "dwFlags=%x\n", mhdr.dwFlags);
|
|
|
|
|
|
|
|
mhdr.dwFlags &= ~MHDR_INQUEUE;
|
2010-01-27 18:32:23 +01:00
|
|
|
rc = midiOutUnprepareHeader(hm, &mhdr, sizeof(mhdr));
|
|
|
|
ok(!rc, "midiOutUnprepare rc=%s\n", mmsys_error(rc));
|
2013-01-26 23:29:31 +01:00
|
|
|
ok(mhdr.dwFlags == MHDR_DONE, "dwFlags=%x\n", mhdr.dwFlags);
|
|
|
|
|
|
|
|
mhdr.dwFlags |= MHDR_INQUEUE;
|
|
|
|
rc = midiOutUnprepareHeader(hm, &mhdr, sizeof(mhdr));
|
|
|
|
ok(!rc, "midiOutUnprepare rc=%s\n", mmsys_error(rc));
|
|
|
|
ok(mhdr.dwFlags == (MHDR_INQUEUE|MHDR_DONE), "dwFlags=%x\n", mhdr.dwFlags);
|
2010-01-27 18:32:23 +01:00
|
|
|
|
|
|
|
HeapFree(GetProcessHeap(), 0, mhdr.lpData);
|
|
|
|
}
|
|
|
|
ok(mhdr.dwUser==0x56FA552C, "MIDIHDR.dwUser changed to %lx\n", mhdr.dwUser);
|
2010-02-17 00:36:56 +01:00
|
|
|
ok(mhdr.dwOffset==0xDEADBEEF, "MIDIHDR.dwOffset changed to %x\n", mhdr.dwOffset);
|
2010-01-27 18:32:23 +01:00
|
|
|
|
2010-03-09 22:20:55 +01:00
|
|
|
rc = midiOutGetID(hm, &udevid);
|
|
|
|
ok(!rc, "midiOutGetID rc=%s\n", mmsys_error(rc));
|
|
|
|
if(!rc) ok(udevid==udev, "midiOutGetID gives %d, expect %d\n", udevid, udev);
|
|
|
|
|
2010-01-27 18:32:23 +01:00
|
|
|
rc = midiOutReset(hm); /* Quiet everything */
|
|
|
|
ok(!rc, "midiOutReset rc=%s\n", mmsys_error(rc));
|
|
|
|
|
|
|
|
rc = midiOutClose(hm);
|
|
|
|
ok(!rc, "midiOutClose rc=%s\n", mmsys_error(rc));
|
|
|
|
test_notification(hwnd, "midiOutClose", MOM_CLOSE, 0);
|
2011-04-11 14:57:30 +02:00
|
|
|
|
|
|
|
rc = midiOutOpen(&hm, udev, 0, (DWORD_PTR)MYCBINST, CALLBACK_WINDOW);
|
2013-01-26 23:29:31 +01:00
|
|
|
/* w95 broken(rc==MMSYSERR_INVALPARAM) see WINMM_CheckCallback */
|
2011-04-11 14:57:30 +02:00
|
|
|
ok(!rc, "midiOutOpen(dev=%d) 0 CALLBACK_WINDOW rc=%s\n", udev, mmsys_error(rc));
|
|
|
|
/* PostMessage(hwnd=0) redirects to PostThreadMessage(GetCurrentThreadId())
|
|
|
|
* which PeekMessage((HWND)-1) queries. */
|
|
|
|
test_notification((HWND)-1, "midiOutOpen WINDOW->THREAD", 0, WHATEVER);
|
|
|
|
test_notification(hwnd, "midiOutOpen WINDOW", 0, WHATEVER);
|
|
|
|
if (!rc) {
|
|
|
|
rc = midiOutClose(hm);
|
|
|
|
ok(!rc, "midiOutClose rc=%s\n", mmsys_error(rc));
|
|
|
|
test_notification((HWND)-1, "midiOutClose WINDOW->THREAD", 0, WHATEVER);
|
|
|
|
test_notification(hwnd, "midiOutClose", 0, WHATEVER);
|
|
|
|
}
|
2010-01-27 18:32:23 +01:00
|
|
|
test_notification(hwnd, "midiOut over", 0, WHATEVER);
|
2018-04-04 17:40:42 +02:00
|
|
|
if (!strncmp(capsA.szPname, fluidsynth_prefix, strlen(fluidsynth_prefix)) ||
|
|
|
|
(udev == MIDIMAPPER && found_fluidsynth)) {
|
|
|
|
found_fluidsynth = TRUE;
|
|
|
|
skip("FluidSynth (at least 1.1.6) doesn't support desired System Exclusive message.\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2018-05-14 14:24:08 +02:00
|
|
|
if (hwnd)
|
|
|
|
rc = midiOutOpen(&hm, udev, (DWORD_PTR)hwnd, (DWORD_PTR)MYCBINST, CALLBACK_WINDOW);
|
|
|
|
else
|
|
|
|
rc = midiOutOpen(&hm, udev, (DWORD_PTR)callback_func, (DWORD_PTR)MYCBINST, CALLBACK_FUNCTION);
|
2018-04-04 17:40:42 +02:00
|
|
|
ok(!rc, "midiOutOpen(dev=%d) rc=%s\n", udev, mmsys_error(rc));
|
2018-05-14 14:24:08 +02:00
|
|
|
test_notification(hwnd, "midiOutOpen", MOM_OPEN, 0);
|
2018-04-04 17:40:42 +02:00
|
|
|
|
|
|
|
memset(&mhdr, 0, sizeof(mhdr));
|
|
|
|
mhdr.lpData = (LPSTR)SysEx_reset;
|
|
|
|
mhdr.dwBufferLength = sizeof(SysEx_reset);
|
|
|
|
rc = midiOutPrepareHeader(hm, &mhdr, sizeof(mhdr));
|
|
|
|
ok(!rc, "midiOutPrepareHeader rc=%s\n", mmsys_error(rc));
|
|
|
|
rc = midiOutLongMsg(hm, &mhdr, sizeof(mhdr));
|
|
|
|
ok(!rc, "midiOutLongMsg rc=%s\n", mmsys_error(rc));
|
|
|
|
rc = midiOutUnprepareHeader(hm, &mhdr, sizeof(mhdr));
|
|
|
|
ok(!rc, "midiOutUnprepare rc=%s\n", mmsys_error(rc));
|
2018-05-14 14:24:08 +02:00
|
|
|
test_notification(hwnd, "midiOutLongMsg", MOM_DONE, (DWORD_PTR)&mhdr);
|
2018-04-04 17:40:42 +02:00
|
|
|
Sleep(60);
|
|
|
|
|
|
|
|
mhdr.lpData = (LPSTR)SysEx_volume_off;
|
|
|
|
mhdr.dwBufferLength = sizeof(SysEx_volume_off);
|
|
|
|
rc = midiOutPrepareHeader(hm, &mhdr, sizeof(mhdr));
|
|
|
|
ok(!rc, "midiOutPrepareHeader rc=%s\n", mmsys_error(rc));
|
|
|
|
rc = midiOutLongMsg(hm, &mhdr, sizeof(mhdr));
|
|
|
|
ok(!rc, "midiOutLongMsg rc=%s\n", mmsys_error(rc));
|
|
|
|
rc = midiOutUnprepareHeader(hm, &mhdr, sizeof(mhdr));
|
|
|
|
ok(!rc, "midiOutUnprepare rc=%s\n", mmsys_error(rc));
|
2018-05-14 14:24:08 +02:00
|
|
|
test_notification(hwnd, "midiOutLongMsg", MOM_DONE, (DWORD_PTR)&mhdr);
|
2018-04-04 17:40:42 +02:00
|
|
|
|
|
|
|
{
|
|
|
|
DWORD e = 0x006F4593; /* velocity 111, note #69, channel 4 */
|
|
|
|
trace("ShortMsg type %x (muted)\n", LOBYTE(LOWORD(e)));
|
|
|
|
rc = midiOutShortMsg(hm, e);
|
|
|
|
ok(!rc, "midiOutShortMsg rc=%s\n", mmsys_error(rc));
|
2018-04-04 17:40:44 +02:00
|
|
|
/* We can't hear this voice due to volume settings */
|
2018-04-04 17:40:42 +02:00
|
|
|
if (!rc) Sleep(200);
|
|
|
|
|
|
|
|
rc = midiOutShortMsg(hm, 0x00004593); /* velocity 0 */
|
|
|
|
ok(!rc, "midiOutShortMsg rc=%s\n", mmsys_error(rc));
|
|
|
|
}
|
|
|
|
|
|
|
|
mhdr.lpData = (LPSTR)SysEx_volume_full;
|
|
|
|
mhdr.dwBufferLength = sizeof(SysEx_volume_full);
|
|
|
|
rc = midiOutPrepareHeader(hm, &mhdr, sizeof(mhdr));
|
|
|
|
ok(!rc, "midiOutPrepareHeader rc=%s\n", mmsys_error(rc));
|
|
|
|
rc = midiOutLongMsg(hm, &mhdr, sizeof(mhdr));
|
|
|
|
ok(!rc, "midiOutLongMsg rc=%s\n", mmsys_error(rc));
|
|
|
|
rc = midiOutUnprepareHeader(hm, &mhdr, sizeof(mhdr));
|
|
|
|
ok(!rc, "midiOutUnprepare rc=%s\n", mmsys_error(rc));
|
2018-05-14 14:24:08 +02:00
|
|
|
test_notification(hwnd, "midiOutLongMsg", MOM_DONE, (DWORD_PTR)&mhdr);
|
2018-04-04 17:40:42 +02:00
|
|
|
|
|
|
|
rc = midiOutClose(hm);
|
|
|
|
ok(!rc, "midiOutClose rc=%s\n", mmsys_error(rc));
|
2018-05-14 14:24:08 +02:00
|
|
|
test_notification(hwnd, "midiOuClose", MOM_CLOSE, 0);
|
2010-01-27 18:32:23 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void test_position(HMIDISTRM hm, UINT typein, UINT typeout)
|
|
|
|
{
|
|
|
|
MMRESULT rc;
|
|
|
|
MMTIME mmtime;
|
|
|
|
mmtime.wType = typein;
|
|
|
|
rc = midiStreamPosition(hm, &mmtime, sizeof(MMTIME));
|
|
|
|
/* Ugly, but a single ok() herein enables using the todo_wine prefix */
|
|
|
|
ok(!rc && (mmtime.wType == typeout), "midiStreamPosition type %x converted to %x rc=%s\n", typein, mmtime.wType, mmsys_error(rc));
|
|
|
|
if (!rc) switch(mmtime.wType) {
|
|
|
|
case TIME_MS:
|
|
|
|
trace("Stream position %ums\n", mmtime.u.ms);
|
|
|
|
break;
|
|
|
|
case TIME_TICKS:
|
|
|
|
trace("Stream position %u ticks\n", mmtime.u.ticks);
|
|
|
|
break;
|
|
|
|
case TIME_MIDI:
|
|
|
|
trace("Stream position song pointer %u\n", mmtime.u.midi.songptrpos);
|
|
|
|
break;
|
2018-07-11 15:33:21 +02:00
|
|
|
case TIME_SMPTE:
|
|
|
|
trace("Stream position %02u:%02u:%02u.%02u/%02u\n",
|
|
|
|
mmtime.u.smpte.hour, mmtime.u.smpte.min, mmtime.u.smpte.sec,
|
|
|
|
mmtime.u.smpte.frame, mmtime.u.smpte.fps);
|
|
|
|
break;
|
2010-01-27 18:32:23 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-03-09 22:20:55 +01:00
|
|
|
typedef struct midishortevent_tag { /* ideal size for MEVT_F_SHORT event type */
|
|
|
|
DWORD dwDeltaTime;
|
|
|
|
DWORD dwStreamID;
|
|
|
|
DWORD dwEvent;
|
|
|
|
} MIDISHORTEVENT;
|
|
|
|
|
2010-02-17 00:36:56 +01:00
|
|
|
/* Native crashes on a second run with the const qualifier set on this data! */
|
2010-01-27 18:32:23 +01:00
|
|
|
static BYTE strmEvents[] = { /* A set of variable-sized MIDIEVENT structs */
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, /* dwDeltaTime and dwStreamID */
|
|
|
|
0, 0, 0, MEVT_NOP | 0x40, /* with MEVT_F_CALLBACK */
|
2010-03-09 22:20:55 +01:00
|
|
|
0, 0, 0, 0, 0, 0, 0, 0,
|
|
|
|
0xE0, 0x93, 0x04, MEVT_TEMPO, /* 0493E0 == 300000 */
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0,
|
2010-01-27 18:32:23 +01:00
|
|
|
0x93, 0x48, 0x6F, MEVT_SHORTMSG,
|
|
|
|
};
|
|
|
|
|
2010-03-09 22:20:55 +01:00
|
|
|
static MIDISHORTEVENT strmNops[] = { /* Test callback + dwOffset */
|
|
|
|
{ 0, 0, (MEVT_NOP <<24)| MEVT_F_CALLBACK },
|
|
|
|
{ 0, 0, (MEVT_NOP <<24)| MEVT_F_CALLBACK },
|
2010-02-17 00:36:56 +01:00
|
|
|
};
|
|
|
|
|
2018-05-21 14:36:09 +02:00
|
|
|
static MIDISHORTEVENT strmNopsWithDelta[] = {
|
|
|
|
{ 0, 0, (MEVT_NOP <<24)| MEVT_F_CALLBACK },
|
|
|
|
{ 12, 0, (MEVT_NOP <<24)| MEVT_F_CALLBACK },
|
|
|
|
};
|
|
|
|
|
|
|
|
struct time_stamp_records {
|
|
|
|
UINT count;
|
|
|
|
DWORD time_stamp[2];
|
|
|
|
HANDLE done;
|
|
|
|
};
|
|
|
|
|
|
|
|
static void CALLBACK time_stamp_callback(HMIDIOUT hmo, UINT msg, DWORD_PTR instance, DWORD_PTR p1, DWORD_PTR p2)
|
|
|
|
{
|
|
|
|
struct time_stamp_records *records = (struct time_stamp_records *)instance;
|
|
|
|
switch (msg) {
|
|
|
|
case MM_MOM_POSITIONCB:
|
2018-06-13 20:30:27 +02:00
|
|
|
if (records->count < ARRAY_SIZE(records->time_stamp))
|
2020-08-25 09:54:00 +02:00
|
|
|
records->time_stamp[records->count] = timeGetTime();
|
2018-05-21 14:36:09 +02:00
|
|
|
records->count++;
|
|
|
|
break;
|
|
|
|
case MM_MOM_DONE:
|
|
|
|
SetEvent(records->done);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static DWORD get_position(HMIDISTRM hm, UINT type)
|
|
|
|
{
|
|
|
|
MMRESULT rc;
|
|
|
|
MMTIME mmtime;
|
|
|
|
mmtime.wType = type;
|
|
|
|
rc = midiStreamPosition(hm, &mmtime, sizeof(mmtime));
|
|
|
|
if (rc != MMSYSERR_NOERROR || mmtime.wType != type)
|
|
|
|
return MAXDWORD;
|
|
|
|
|
|
|
|
switch (mmtime.wType) {
|
|
|
|
case TIME_MS:
|
|
|
|
return mmtime.u.ms;
|
|
|
|
case TIME_TICKS:
|
|
|
|
return mmtime.u.ticks;
|
2018-07-11 15:33:21 +02:00
|
|
|
case TIME_MIDI:
|
|
|
|
return mmtime.u.midi.songptrpos;
|
2018-05-21 14:36:09 +02:00
|
|
|
default:
|
|
|
|
return MAXDWORD;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-02-17 00:36:56 +01:00
|
|
|
static MMRESULT playStream(HMIDISTRM hm, LPMIDIHDR lpMidiHdr)
|
|
|
|
{
|
|
|
|
MMRESULT rc = midiStreamOut(hm, lpMidiHdr, sizeof(MIDIHDR));
|
|
|
|
/* virtual machines may return MIDIERR_STILLPLAYING from the next request
|
|
|
|
* even after MHDR_DONE is set. It's still too early, so add MHDR_INQUEUE. */
|
|
|
|
if (!rc) while (!(lpMidiHdr->dwFlags & MHDR_DONE) || (lpMidiHdr->dwFlags & MHDR_INQUEUE)) { Sleep(100); }
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
2010-01-27 18:32:23 +01:00
|
|
|
static void test_midiStream(UINT udev, HWND hwnd)
|
|
|
|
{
|
|
|
|
HMIDISTRM hm;
|
|
|
|
MMRESULT rc, rc2;
|
|
|
|
MIDIHDR mhdr;
|
2010-02-17 00:36:56 +01:00
|
|
|
union {
|
|
|
|
MIDIPROPTEMPO tempo;
|
|
|
|
MIDIPROPTIMEDIV tdiv;
|
|
|
|
} midiprop;
|
2018-05-21 14:36:09 +02:00
|
|
|
DWORD diff, expected, ret;
|
|
|
|
const DWORD MARGIN = 50;
|
|
|
|
struct time_stamp_records records;
|
2018-04-04 17:41:31 +02:00
|
|
|
MIDIOUTCAPSA capsA;
|
2010-01-27 18:32:23 +01:00
|
|
|
|
|
|
|
if (hwnd)
|
|
|
|
rc = midiStreamOpen(&hm, &udev, 1, (DWORD_PTR)hwnd, (DWORD_PTR)MYCBINST, CALLBACK_WINDOW);
|
|
|
|
else
|
|
|
|
rc = midiStreamOpen(&hm, &udev, 1, (DWORD_PTR)callback_func, (DWORD_PTR)MYCBINST, CALLBACK_FUNCTION);
|
2013-10-29 23:31:04 +01:00
|
|
|
if (rc == MMSYSERR_NOTSUPPORTED || rc == MMSYSERR_NODRIVER)
|
2010-09-29 12:19:34 +02:00
|
|
|
{
|
|
|
|
skip( "MIDI stream not supported\n" );
|
|
|
|
return;
|
|
|
|
}
|
2010-01-27 18:32:23 +01:00
|
|
|
ok(!rc, "midiStreamOpen(dev=%d) rc=%s\n", udev, mmsys_error(rc));
|
|
|
|
if (rc) return;
|
|
|
|
|
|
|
|
test_notification(hwnd, "midiStreamOpen", MOM_OPEN, 0);
|
|
|
|
|
2010-02-17 00:36:56 +01:00
|
|
|
midiprop.tempo.cbStruct = sizeof(midiprop.tempo);
|
|
|
|
rc = midiStreamProperty(hm, (void*)&midiprop, MIDIPROP_GET|MIDIPROP_TEMPO);
|
|
|
|
ok(!rc, "midiStreamProperty TEMPO rc=%s\n", mmsys_error(rc));
|
2010-02-24 00:07:42 +01:00
|
|
|
ok(midiprop.tempo.dwTempo==500000, "default stream tempo %u microsec per quarter note\n", midiprop.tempo.dwTempo);
|
2010-02-17 00:36:56 +01:00
|
|
|
|
|
|
|
midiprop.tdiv.cbStruct = sizeof(midiprop.tdiv);
|
|
|
|
rc = midiStreamProperty(hm, (void*)&midiprop, MIDIPROP_GET|MIDIPROP_TIMEDIV);
|
|
|
|
ok(!rc, "midiStreamProperty TIMEDIV rc=%s\n", mmsys_error(rc));
|
2018-05-08 15:02:10 +02:00
|
|
|
ok(24==LOWORD(midiprop.tdiv.dwTimeDiv), "default stream time division %u\n", midiprop.tdiv.dwTimeDiv);
|
2010-02-17 00:36:56 +01:00
|
|
|
|
2010-10-01 15:39:18 +02:00
|
|
|
memset(&mhdr, 0, sizeof(mhdr));
|
2010-02-17 00:36:56 +01:00
|
|
|
mhdr.dwUser = 0x56FA552C;
|
|
|
|
mhdr.dwOffset = 1234567890;
|
2010-03-09 22:20:55 +01:00
|
|
|
mhdr.dwBufferLength = sizeof(strmEvents);
|
2010-02-17 00:36:56 +01:00
|
|
|
mhdr.dwBytesRecorded = mhdr.dwBufferLength;
|
2010-01-27 18:32:23 +01:00
|
|
|
mhdr.lpData = (LPSTR)&strmEvents[0];
|
|
|
|
if (mhdr.lpData) {
|
|
|
|
rc = midiOutLongMsg((HMIDIOUT)hm, &mhdr, sizeof(mhdr));
|
|
|
|
ok(rc==MIDIERR_UNPREPARED, "midiOutLongMsg unprepared rc=%s\n", mmsys_error(rc));
|
|
|
|
test_notification(hwnd, "midiOutLong unprepared", 0, WHATEVER);
|
|
|
|
|
2010-02-17 00:36:56 +01:00
|
|
|
rc = midiOutPrepareHeader((HMIDIOUT)hm, &mhdr, offsetof(MIDIHDR,dwOffset)-1);
|
|
|
|
ok(rc==MMSYSERR_INVALPARAM, "midiOutPrepare tiny rc=%s\n", mmsys_error(rc));
|
2016-09-07 12:12:58 +02:00
|
|
|
rc = midiOutPrepareHeader((HMIDIOUT)hm, &mhdr, sizeof(mhdr));
|
|
|
|
ok(!rc, "midiOutPrepare size rc=%s\n", mmsys_error(rc));
|
2010-01-27 18:32:23 +01:00
|
|
|
ok(mhdr.dwFlags & MHDR_PREPARED, "MHDR.dwFlags when prepared %x\n", mhdr.dwFlags);
|
|
|
|
|
|
|
|
/* The device is still in paused mode and should queue the message. */
|
2010-02-17 00:36:56 +01:00
|
|
|
rc = midiStreamOut(hm, &mhdr, offsetof(MIDIHDR,dwOffset));
|
|
|
|
ok(!rc, "midiStreamOut old size rc=%s\n", mmsys_error(rc));
|
2010-01-27 18:32:23 +01:00
|
|
|
rc2 = rc;
|
|
|
|
trace("MIDIHDR flags=%x when submitted\n", mhdr.dwFlags);
|
|
|
|
/* w9X/me does not set MHDR_ISSTRM when StreamOut exits,
|
|
|
|
* but it will be set on all systems after the job is finished. */
|
|
|
|
|
|
|
|
Sleep(90);
|
2010-02-10 20:54:10 +01:00
|
|
|
/* Wine <1.1.39 started playing immediately */
|
|
|
|
test_notification(hwnd, "midiStream still paused", 0, WHATEVER);
|
2010-01-27 18:32:23 +01:00
|
|
|
|
|
|
|
/* MSDN asks to use midiStreamRestart prior to midiStreamOut()
|
|
|
|
* because the starting state is 'pause', but some apps seem to
|
2010-03-09 22:20:55 +01:00
|
|
|
* work with the inverse order: queue everything, then play.
|
2010-01-27 18:32:23 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
rc = midiStreamRestart(hm);
|
|
|
|
ok(!rc, "midiStreamRestart rc=%s\n", mmsys_error(rc));
|
|
|
|
|
|
|
|
if (!rc2) while(mhdr.dwFlags & MHDR_INQUEUE) {
|
|
|
|
trace("async MIDI still queued\n");
|
|
|
|
Sleep(100);
|
|
|
|
} /* Checking INQUEUE is not the recommended way to wait for the end of a job, but we're testing. */
|
|
|
|
/* MHDR_ISSTRM is not necessarily set when midiStreamOut returns
|
|
|
|
* rather than when the queue is eventually processed. */
|
|
|
|
ok(mhdr.dwFlags & MHDR_ISSTRM, "MHDR.dwFlags %x no ISSTRM when out of queue\n", mhdr.dwFlags);
|
|
|
|
if (!rc2) while(!(mhdr.dwFlags & MHDR_DONE)) {
|
|
|
|
/* Never to be seen except perhaps on multicore */
|
|
|
|
trace("async MIDI still not done\n");
|
|
|
|
Sleep(100);
|
|
|
|
}
|
|
|
|
ok(mhdr.dwFlags & MHDR_DONE, "MHDR.dwFlags %x not DONE when out of queue\n", mhdr.dwFlags);
|
2010-02-16 15:50:21 +01:00
|
|
|
test_notification(hwnd, "midiStream callback", MOM_POSITIONCB, (DWORD_PTR)&mhdr);
|
|
|
|
test_notification(hwnd, "midiStreamOut", MOM_DONE, (DWORD_PTR)&mhdr);
|
2010-01-27 18:32:23 +01:00
|
|
|
|
2010-02-17 00:36:56 +01:00
|
|
|
/* Native fills dwOffset regardless of the cbMidiHdr size argument to midiStreamOut */
|
|
|
|
ok(1234567890!=mhdr.dwOffset, "play left MIDIHDR.dwOffset at %u\n", mhdr.dwOffset);
|
|
|
|
|
2016-09-07 12:12:58 +02:00
|
|
|
rc = midiOutUnprepareHeader((HMIDIOUT)hm, &mhdr, sizeof(mhdr));
|
2010-01-27 18:32:23 +01:00
|
|
|
ok(!rc, "midiOutUnprepare rc=%s\n", mmsys_error(rc));
|
2016-09-07 12:12:58 +02:00
|
|
|
rc = midiOutUnprepareHeader((HMIDIOUT)hm, &mhdr, sizeof(mhdr));
|
2010-01-27 18:32:23 +01:00
|
|
|
ok(!rc, "midiOutUnprepare #2 rc=%s\n", mmsys_error(rc));
|
|
|
|
|
|
|
|
trace("MIDIHDR stream flags=%x when finished\n", mhdr.dwFlags);
|
|
|
|
ok(mhdr.dwFlags & MHDR_DONE, "MHDR.dwFlags when done %x\n", mhdr.dwFlags);
|
|
|
|
|
|
|
|
test_position(hm, TIME_MS, TIME_MS);
|
|
|
|
test_position(hm, TIME_TICKS, TIME_TICKS);
|
2018-07-11 15:33:25 +02:00
|
|
|
test_position(hm, TIME_MIDI, TIME_MIDI);
|
2010-01-27 18:32:23 +01:00
|
|
|
test_position(hm, TIME_SMPTE, TIME_MS);
|
|
|
|
test_position(hm, TIME_SAMPLES, TIME_MS);
|
|
|
|
test_position(hm, TIME_BYTES, TIME_MS);
|
|
|
|
|
|
|
|
Sleep(400); /* Hear note */
|
|
|
|
|
2010-03-09 22:20:55 +01:00
|
|
|
midiprop.tempo.cbStruct = sizeof(midiprop.tempo);
|
|
|
|
rc = midiStreamProperty(hm, (void*)&midiprop, MIDIPROP_GET|MIDIPROP_TEMPO);
|
|
|
|
ok(!rc, "midiStreamProperty TEMPO rc=%s\n", mmsys_error(rc));
|
|
|
|
ok(0x0493E0==midiprop.tempo.dwTempo, "stream set tempo %u\n", midiprop.tdiv.dwTimeDiv);
|
|
|
|
|
2010-01-27 18:32:23 +01:00
|
|
|
rc = midiStreamRestart(hm);
|
|
|
|
ok(!rc, "midiStreamRestart #2 rc=%s\n", mmsys_error(rc));
|
|
|
|
|
2010-03-09 22:20:55 +01:00
|
|
|
mhdr.dwFlags |= MHDR_ISSTRM;
|
2010-01-27 18:32:23 +01:00
|
|
|
/* Preset flags (e.g. MHDR_ISSTRM) do not disturb. */
|
2016-09-07 12:12:58 +02:00
|
|
|
rc = midiOutPrepareHeader((HMIDIOUT)hm, &mhdr, sizeof(mhdr));
|
2010-01-27 18:32:23 +01:00
|
|
|
ok(!rc, "midiOutPrepare used flags %x rc=%s\n", mhdr.dwFlags, mmsys_error(rc));
|
2016-09-07 12:12:58 +02:00
|
|
|
rc = midiOutUnprepareHeader((HMIDIOUT)hm, &mhdr, sizeof(mhdr));
|
2010-01-27 18:32:23 +01:00
|
|
|
ok(!rc, "midiOutUnprepare used flags %x rc=%s\n", mhdr.dwFlags, mmsys_error(rc));
|
|
|
|
|
|
|
|
rc = midiStreamRestart(hm);
|
|
|
|
ok(!rc, "midiStreamRestart #3 rc=%s\n", mmsys_error(rc));
|
|
|
|
}
|
|
|
|
ok(mhdr.dwUser==0x56FA552C, "MIDIHDR.dwUser changed to %lx\n", mhdr.dwUser);
|
2010-03-09 22:20:55 +01:00
|
|
|
ok(0==((MIDISHORTEVENT*)&strmEvents)[0].dwStreamID, "dwStreamID set to %x\n", ((LPMIDIEVENT)&strmEvents[0])->dwStreamID);
|
2010-02-17 00:36:56 +01:00
|
|
|
|
|
|
|
/* dwBytesRecorded controls how much is played, not dwBufferLength
|
|
|
|
* allowing to immediately forward packets from midiIn to midiOut */
|
|
|
|
mhdr.dwOffset = 1234123123;
|
2010-03-09 22:20:55 +01:00
|
|
|
mhdr.dwBufferLength = sizeof(strmNops);
|
|
|
|
trace("buffer: %u\n", mhdr.dwBufferLength);
|
2010-02-17 00:36:56 +01:00
|
|
|
mhdr.dwBytesRecorded = 0;
|
|
|
|
mhdr.lpData = (LPSTR)&strmNops[0];
|
2010-03-09 22:20:55 +01:00
|
|
|
strmNops[0].dwEvent |= MEVT_F_CALLBACK;
|
|
|
|
strmNops[1].dwEvent |= MEVT_F_CALLBACK;
|
2010-02-17 00:36:56 +01:00
|
|
|
|
|
|
|
rc = midiOutPrepareHeader((HMIDIOUT)hm, &mhdr, sizeof(mhdr));
|
|
|
|
ok(!rc, "midiOutPrepare rc=%s\n", mmsys_error(rc));
|
|
|
|
|
|
|
|
rc = playStream(hm, &mhdr);
|
|
|
|
ok(!rc, "midiStreamOut 0 bytes recorded rc=%s\n", mmsys_error(rc));
|
|
|
|
|
|
|
|
test_notification(hwnd, "midiStreamOut", MOM_DONE, (DWORD_PTR)&mhdr);
|
|
|
|
test_notification(hwnd, "0 bytes recorded", 0, WHATEVER);
|
|
|
|
|
|
|
|
/* FIXME: check dwOffset within callback
|
|
|
|
* instead of the unspecified value afterwards */
|
|
|
|
ok(1234123123==mhdr.dwOffset || broken(0==mhdr.dwOffset), "play 0 set MIDIHDR.dwOffset to %u\n", mhdr.dwOffset);
|
|
|
|
/* w2k and later only set dwOffset when processing MEVT_T_CALLBACK,
|
|
|
|
* while w9X/me/nt always sets it. Have Wine behave like w2k because the
|
|
|
|
* dwOffset slot does not exist in the small size MIDIHDR. */
|
|
|
|
|
|
|
|
mhdr.dwOffset = 1234123123;
|
2010-03-09 22:20:55 +01:00
|
|
|
mhdr.dwBytesRecorded = 1*sizeof(MIDISHORTEVENT);
|
2010-02-17 00:36:56 +01:00
|
|
|
|
|
|
|
rc = playStream(hm, &mhdr);
|
|
|
|
ok(!rc, "midiStreamOut 1 event out of 2 rc=%s\n", mmsys_error(rc));
|
|
|
|
|
|
|
|
test_notification(hwnd, "1 of 2 events", MOM_POSITIONCB, (DWORD_PTR)&mhdr);
|
|
|
|
test_notification(hwnd, "1 of 2 events", MOM_DONE, (DWORD_PTR)&mhdr);
|
|
|
|
test_notification(hwnd, "1 of 2 events", 0, WHATEVER);
|
|
|
|
ok(0==mhdr.dwOffset, "MIDIHDR.dwOffset 1/2 changed to %u\n", mhdr.dwOffset);
|
|
|
|
|
|
|
|
mhdr.dwOffset = 1234123123;
|
2010-03-09 22:20:55 +01:00
|
|
|
mhdr.dwBytesRecorded = 2*sizeof(MIDISHORTEVENT);
|
2010-02-17 00:36:56 +01:00
|
|
|
|
|
|
|
rc = playStream(hm, &mhdr);
|
|
|
|
ok(!rc, "midiStreamOut 1 event out of 2 rc=%s\n", mmsys_error(rc));
|
|
|
|
|
|
|
|
test_notification(hwnd, "2 of 2 events", MOM_POSITIONCB, (DWORD_PTR)&mhdr);
|
|
|
|
test_notification(hwnd, "2 of 2 events", MOM_POSITIONCB, (DWORD_PTR)&mhdr);
|
|
|
|
test_notification(hwnd, "2 of 2 events", MOM_DONE, (DWORD_PTR)&mhdr);
|
|
|
|
test_notification(hwnd, "2 of 2 events", 0, WHATEVER);
|
2010-03-09 22:20:55 +01:00
|
|
|
ok(sizeof(MIDISHORTEVENT)==mhdr.dwOffset, "MIDIHDR.dwOffset 2/2 changed to %u\n", mhdr.dwOffset);
|
|
|
|
ok(mhdr.dwBytesRecorded == 2*sizeof(MIDISHORTEVENT), "dwBytesRecorded changed to %u\n", mhdr.dwBytesRecorded);
|
2010-02-17 00:36:56 +01:00
|
|
|
|
2010-03-09 22:20:55 +01:00
|
|
|
strmNops[0].dwEvent &= ~MEVT_F_CALLBACK;
|
|
|
|
strmNops[1].dwEvent &= ~MEVT_F_CALLBACK;
|
2010-02-17 00:36:56 +01:00
|
|
|
mhdr.dwOffset = 1234123123;
|
|
|
|
rc = playStream(hm, &mhdr);
|
|
|
|
ok(!rc, "midiStreamOut 1 event out of 2 rc=%s\n", mmsys_error(rc));
|
|
|
|
|
|
|
|
test_notification(hwnd, "0 CB in 2 events", MOM_DONE, (DWORD_PTR)&mhdr);
|
|
|
|
test_notification(hwnd, "0 CB in 2 events", 0, WHATEVER);
|
|
|
|
/* w9X/me/nt set dwOffset to the position played last */
|
2010-03-09 22:20:55 +01:00
|
|
|
ok(1234123123==mhdr.dwOffset || broken(sizeof(MIDISHORTEVENT)==mhdr.dwOffset), "MIDIHDR.dwOffset nocb changed to %u\n", mhdr.dwOffset);
|
2010-02-17 00:36:56 +01:00
|
|
|
|
|
|
|
mhdr.dwBytesRecorded = mhdr.dwBufferLength-1;
|
|
|
|
rc = playStream(hm, &mhdr);
|
2010-03-09 22:20:55 +01:00
|
|
|
ok(rc==MMSYSERR_INVALPARAM,"midiStreamOut dwBytesRecorded modulo MIDIEVENT rc=%s\n", mmsys_error(rc));
|
2010-02-17 00:36:56 +01:00
|
|
|
if (!rc) {
|
|
|
|
test_notification(hwnd, "2 of 2 events", MOM_DONE, (DWORD_PTR)&mhdr);
|
|
|
|
}
|
|
|
|
|
|
|
|
mhdr.dwBytesRecorded = mhdr.dwBufferLength+1;
|
|
|
|
rc = playStream(hm, &mhdr);
|
|
|
|
ok(rc==MMSYSERR_INVALPARAM,"midiStreamOut dwBufferLength<dwBytesRecorded rc=%s\n", mmsys_error(rc));
|
|
|
|
test_notification(hwnd, "past MIDIHDR tests", 0, WHATEVER);
|
2010-01-27 18:32:23 +01:00
|
|
|
|
|
|
|
rc = midiStreamStop(hm);
|
|
|
|
ok(!rc, "midiStreamStop rc=%s\n", mmsys_error(rc));
|
2010-02-17 00:36:56 +01:00
|
|
|
ok(mhdr.dwUser==0x56FA552C, "MIDIHDR.dwUser changed to %lx\n", mhdr.dwUser);
|
|
|
|
|
|
|
|
rc = midiOutUnprepareHeader((HMIDIOUT)hm, &mhdr, sizeof(mhdr));
|
|
|
|
ok(!rc, "midiOutUnprepare rc=%s\n", mmsys_error(rc));
|
2010-03-09 22:20:55 +01:00
|
|
|
ok(0==strmNops[0].dwStreamID, "dwStreamID[0] set to %x\n", strmNops[0].dwStreamID);
|
|
|
|
ok(0==strmNops[1].dwStreamID, "dwStreamID[1] set to %x\n", strmNops[1].dwStreamID);
|
2010-01-27 18:32:23 +01:00
|
|
|
|
|
|
|
mhdr.dwBufferLength = 70000; /* > 64KB! */
|
|
|
|
mhdr.lpData = HeapAlloc(GetProcessHeap(), 0 , mhdr.dwBufferLength);
|
|
|
|
ok(mhdr.lpData!=NULL, "No %d bytes of memory!\n", mhdr.dwBufferLength);
|
|
|
|
if (mhdr.lpData) {
|
|
|
|
mhdr.dwFlags = 0;
|
|
|
|
/* PrepareHeader detects the too large buffer is for a stream. */
|
|
|
|
rc = midiOutPrepareHeader((HMIDIOUT)hm, &mhdr, sizeof(mhdr));
|
2010-01-31 21:19:39 +01:00
|
|
|
todo_wine ok(rc==MMSYSERR_INVALPARAM, "midiOutPrepare stream too large rc=%s\n", mmsys_error(rc));
|
2010-01-27 18:32:23 +01:00
|
|
|
|
|
|
|
rc = midiOutUnprepareHeader((HMIDIOUT)hm, &mhdr, sizeof(mhdr));
|
|
|
|
ok(!rc, "midiOutUnprepare rc=%s\n", mmsys_error(rc));
|
|
|
|
|
|
|
|
HeapFree(GetProcessHeap(), 0, mhdr.lpData);
|
|
|
|
}
|
|
|
|
|
|
|
|
rc = midiStreamClose(hm);
|
|
|
|
ok(!rc, "midiStreamClose rc=%s\n", mmsys_error(rc));
|
|
|
|
test_notification(hwnd, "midiStreamClose", MOM_CLOSE, 0);
|
|
|
|
test_notification(hwnd, "midiStream over", 0, WHATEVER);
|
2010-03-09 22:20:55 +01:00
|
|
|
|
|
|
|
rc = midiStreamOpen(&hm, &udev, 1, 0, (DWORD_PTR)MYCBINST, CALLBACK_FUNCTION);
|
|
|
|
ok(!rc /*w2k*/|| rc==MMSYSERR_INVALPARAM/*w98*/, "midiStreamOpen NULL function rc=%s\n", mmsys_error(rc));
|
|
|
|
if (!rc) {
|
|
|
|
trace("Device %d accepts NULL CALLBACK_FUNCTION\n", udev);
|
|
|
|
rc = midiStreamClose(hm);
|
|
|
|
ok(!rc, "midiStreamClose rc=%s\n", mmsys_error(rc));
|
|
|
|
}
|
|
|
|
|
|
|
|
rc = midiStreamOpen(&hm, &udev, 1, (DWORD_PTR)0xDEADBEEF, (DWORD_PTR)MYCBINST, CALLBACK_WINDOW);
|
|
|
|
ok(rc==MMSYSERR_INVALPARAM, "midiStreamOpen bad window rc=%s\n", mmsys_error(rc));
|
|
|
|
if (!rc) {
|
|
|
|
rc = midiStreamClose(hm);
|
|
|
|
ok(!rc, "midiStreamClose rc=%s\n", mmsys_error(rc));
|
|
|
|
}
|
2018-04-04 17:41:31 +02:00
|
|
|
|
2018-05-21 14:36:09 +02:00
|
|
|
/* Test the player time clock and positions */
|
|
|
|
memset(&records, 0, sizeof(records));
|
|
|
|
records.done = CreateEventA(NULL, FALSE, FALSE, NULL);
|
|
|
|
ok(records.done != NULL, "CreateEvent failed (dev=%d)\n", udev);
|
|
|
|
|
|
|
|
rc = midiStreamOpen(&hm, &udev, 1, (DWORD_PTR)time_stamp_callback, (DWORD_PTR)&records, CALLBACK_FUNCTION);
|
|
|
|
ok(!rc, "midiStreamOpen(dev=%d) rc=%s\n", udev, mmsys_error(rc));
|
|
|
|
|
|
|
|
expected = 0;
|
|
|
|
ret = get_position(hm, TIME_MS);
|
|
|
|
ok(ret == expected, "expected %u, got %u\n", expected, ret);
|
|
|
|
|
|
|
|
memset(&mhdr, 0, sizeof(mhdr));
|
|
|
|
mhdr.lpData = (LPSTR)strmNopsWithDelta;
|
|
|
|
mhdr.dwBytesRecorded = mhdr.dwBufferLength = sizeof(strmNopsWithDelta);
|
|
|
|
rc = midiOutPrepareHeader((HMIDIOUT)hm, &mhdr, sizeof(mhdr));
|
|
|
|
ok(!rc, "midiOutPrepareHeader(dev=%d) rc=%s\n", udev, mmsys_error(rc));
|
|
|
|
|
|
|
|
rc = midiStreamOut(hm, &mhdr, sizeof(mhdr));
|
|
|
|
ok(!rc, "midiStreamOut(dev=%d) rc=%s\n", udev, mmsys_error(rc));
|
|
|
|
|
|
|
|
ret = get_position(hm, TIME_MS);
|
|
|
|
ok(ret == expected, "expected %u, got %u\n", expected, ret);
|
|
|
|
|
|
|
|
rc = midiStreamRestart(hm);
|
|
|
|
ok(!rc, "midiStreamRestart(dev=%d) rc=%s\n", udev, mmsys_error(rc));
|
|
|
|
Sleep(50);
|
|
|
|
|
|
|
|
rc = midiStreamPause(hm);
|
|
|
|
ok(!rc, "midiStreamPause(dev=%d) rc=%s\n", udev, mmsys_error(rc));
|
|
|
|
|
|
|
|
expected = 50;
|
|
|
|
ret = get_position(hm, TIME_MS);
|
2018-05-29 15:18:36 +02:00
|
|
|
ok(ret >= expected && ret < expected + MARGIN, "expected %ums or greater, got %ums\n", expected, ret);
|
2018-05-21 14:36:09 +02:00
|
|
|
expected = ret;
|
|
|
|
|
|
|
|
Sleep(100);
|
|
|
|
|
|
|
|
ret = get_position(hm, TIME_MS);
|
|
|
|
ok(ret == expected, "expected %ums, got %ums\n", expected, ret);
|
|
|
|
|
|
|
|
rc = midiStreamRestart(hm);
|
|
|
|
ok(!rc, "midiStreamRestart(dev=%d) rc=%s\n", udev, mmsys_error(rc));
|
|
|
|
|
|
|
|
Sleep(1);
|
|
|
|
ret = get_position(hm, TIME_MS);
|
2018-05-29 15:18:36 +02:00
|
|
|
ok(ret > expected && ret < expected + MARGIN, "expected greater than %ums, got %ums\n", expected, ret);
|
2018-05-21 14:36:09 +02:00
|
|
|
expected = ret;
|
|
|
|
|
2018-07-11 15:33:21 +02:00
|
|
|
ret = get_position(hm, TIME_TICKS);
|
2018-07-11 15:33:23 +02:00
|
|
|
ok(ret > strmNopsWithDelta[0].dwDeltaTime && ret < strmNopsWithDelta[1].dwDeltaTime,
|
2018-07-11 15:33:21 +02:00
|
|
|
"TIME_TICKS position is continuous, got %u\n", ret);
|
|
|
|
|
2018-06-26 15:10:45 +02:00
|
|
|
/* shouldn't set time division property while playing */
|
|
|
|
midiprop.tdiv.cbStruct = sizeof(midiprop.tdiv);
|
|
|
|
midiprop.tdiv.dwTimeDiv = 24;
|
|
|
|
rc = midiStreamProperty(hm, (void*)&midiprop, MIDIPROP_SET | MIDIPROP_TIMEDIV);
|
|
|
|
ok(rc == MMSYSERR_INVALPARAM, "midiStreamProperty(SET|TIMEDIV, dev=%d) rc=%s\n", udev, mmsys_error(rc));
|
|
|
|
|
2018-05-21 14:36:09 +02:00
|
|
|
ret = WaitForSingleObject(records.done, INFINITE);
|
|
|
|
ok(ret == WAIT_OBJECT_0, "WaitForSingleObject failed, got %d\n", ret);
|
|
|
|
|
|
|
|
rc = midiStreamPause(hm);
|
|
|
|
ok(!rc, "midiStreamPause(dev=%d) rc=%s\n", udev, mmsys_error(rc));
|
|
|
|
|
|
|
|
expected = 250; /* = 12 ticks in 120 BPM */
|
|
|
|
ret = get_position(hm, TIME_MS);
|
2018-05-29 15:19:08 +02:00
|
|
|
ok(ret >= expected - MARGIN && ret <= expected + MARGIN,
|
2018-05-21 14:36:09 +02:00
|
|
|
"expected greater than %ums, got %ums\n", expected, ret);
|
|
|
|
trace("after playing, got %ums\n", ret);
|
|
|
|
|
|
|
|
/* set tempo to 240 BPM */
|
|
|
|
midiprop.tempo.cbStruct = sizeof(midiprop.tempo);
|
|
|
|
midiprop.tempo.dwTempo = 250000;
|
|
|
|
rc = midiStreamProperty(hm, (void*)&midiprop, MIDIPROP_SET | MIDIPROP_TEMPO);
|
|
|
|
ok(!rc, "midiStreamProperty(SET|TEMPO, dev=%d) rc=%s\n", udev, mmsys_error(rc));
|
|
|
|
|
|
|
|
/* a tempo change doesn't affect elapsed ticks */
|
|
|
|
ret = get_position(hm, TIME_TICKS);
|
|
|
|
ok(ret >= strmNopsWithDelta[1].dwDeltaTime && ret < strmNopsWithDelta[1].dwDeltaTime + 3,
|
|
|
|
"expected %u ticks, got %u\n", strmNopsWithDelta[1].dwDeltaTime, ret);
|
|
|
|
|
2018-07-11 15:33:21 +02:00
|
|
|
midiprop.tdiv.cbStruct = sizeof(midiprop.tdiv);
|
|
|
|
rc = midiStreamProperty(hm, (void*)&midiprop, MIDIPROP_GET | MIDIPROP_TIMEDIV);
|
|
|
|
ok(!rc, "midiStreamProperty(GET|TIMEDIV, dev=%d) rc=%s\n", udev, mmsys_error(rc));
|
|
|
|
ok(midiprop.tdiv.dwTimeDiv == 24, "expected 24, got %u\n", midiprop.tdiv.dwTimeDiv);
|
|
|
|
|
|
|
|
/* TIME_MIDI value is a quarter of TIME_TICKS, rounded */
|
|
|
|
expected = (ret + midiprop.tdiv.dwTimeDiv/8) / (midiprop.tdiv.dwTimeDiv/4);
|
|
|
|
ret = get_position(hm, TIME_MIDI);
|
2018-07-11 15:33:25 +02:00
|
|
|
ok(ret == expected, "expected song pointer %u, got %u\n", expected, ret);
|
2018-07-11 15:33:21 +02:00
|
|
|
|
2018-05-21 14:36:09 +02:00
|
|
|
ok(records.count == 2, "expected 2 MM_MOM_DONE messages, got %d\n", records.count);
|
|
|
|
|
|
|
|
/* Time between midiStreamPause and midiStreamRestart isn't counted.
|
|
|
|
So, the second event happens at dwDeltaTime(250ms) + 100ms after the first event. */
|
|
|
|
expected = 250 + 100;
|
|
|
|
diff = records.time_stamp[1] - records.time_stamp[0];
|
2018-05-29 15:19:08 +02:00
|
|
|
ok(diff >= expected - MARGIN && diff <= expected + MARGIN,
|
2018-05-21 14:36:09 +02:00
|
|
|
"expected %u ~ %ums, got %ums (dev=%d)\n", expected - MARGIN, expected + MARGIN, diff, udev);
|
|
|
|
|
|
|
|
rc = midiOutUnprepareHeader((HMIDIOUT)hm, &mhdr, sizeof(mhdr));
|
|
|
|
ok(!rc, "midiOutUnprepareHeader(dev=%d) rc=%s\n", udev, mmsys_error(rc));
|
|
|
|
|
|
|
|
rc = midiStreamStop(hm);
|
|
|
|
ok(!rc, "midiStreamStop(dev=%d) rc=%s\n", udev, mmsys_error(rc));
|
|
|
|
|
|
|
|
ret = get_position(hm, TIME_MS);
|
2018-05-29 15:18:36 +02:00
|
|
|
ok(ret == 0, "expected 0ms, got %ums\n", ret);
|
2018-05-21 14:36:09 +02:00
|
|
|
|
2018-07-11 15:33:21 +02:00
|
|
|
midiprop.tdiv.cbStruct = sizeof(midiprop.tdiv);
|
|
|
|
midiprop.tdiv.dwTimeDiv = 0xe204; /* 30 fps, 4 ticks/frame */
|
|
|
|
rc = midiStreamProperty(hm, (void*)&midiprop, MIDIPROP_SET | MIDIPROP_TIMEDIV);
|
|
|
|
ok(!rc, "midiStreamProperty(SET|TIMEDIV, dev=%d) rc=%s\n", udev, mmsys_error(rc));
|
|
|
|
|
|
|
|
test_position(hm, TIME_MS, TIME_MS);
|
|
|
|
test_position(hm, TIME_TICKS, TIME_TICKS);
|
|
|
|
test_position(hm, TIME_MIDI, TIME_MS);
|
|
|
|
todo_wine test_position(hm, TIME_SMPTE, TIME_SMPTE);
|
|
|
|
test_position(hm, TIME_SAMPLES, TIME_MS);
|
|
|
|
test_position(hm, TIME_BYTES, TIME_MS);
|
|
|
|
|
2018-05-21 14:36:09 +02:00
|
|
|
rc = midiStreamClose(hm);
|
|
|
|
ok(!rc, "midiStreamClose(dev=%d) rc=%s\n", udev, mmsys_error(rc));
|
|
|
|
CloseHandle(records.done);
|
|
|
|
|
2018-04-04 17:41:31 +02:00
|
|
|
rc = midiOutGetDevCapsA((UINT_PTR)udev, &capsA, sizeof(capsA));
|
|
|
|
ok(!rc, "midiOutGetDevCaps(dev=%d) rc=%s\n", udev, mmsys_error(rc));
|
|
|
|
if (!strncmp(capsA.szPname, fluidsynth_prefix, strlen(fluidsynth_prefix)) ||
|
|
|
|
(udev == MIDIMAPPER && found_fluidsynth)) {
|
|
|
|
found_fluidsynth = TRUE;
|
|
|
|
skip("FluidSynth (at least 1.1.6) doesn't support desired System Exclusive message.\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
#define ROUNDUP4(n) (((n) + 3) & ~3)
|
|
|
|
hm = NULL;
|
2018-05-14 14:24:08 +02:00
|
|
|
if (hwnd)
|
|
|
|
rc = midiStreamOpen(&hm, &udev, 1, (DWORD_PTR)hwnd, (DWORD_PTR)MYCBINST, CALLBACK_WINDOW);
|
|
|
|
else
|
|
|
|
rc = midiStreamOpen(&hm, &udev, 1, (DWORD_PTR)callback_func, (DWORD_PTR)MYCBINST, CALLBACK_FUNCTION);
|
2018-04-04 17:41:31 +02:00
|
|
|
ok(!rc, "midiOutOpen(dev=%d) rc=%s\n", udev, mmsys_error(rc));
|
2018-05-14 14:24:08 +02:00
|
|
|
test_notification(hwnd, "midiStreamOpen", MOM_OPEN, 0);
|
2018-04-04 17:41:31 +02:00
|
|
|
|
|
|
|
midiprop.tdiv.cbStruct = sizeof(midiprop.tdiv);
|
|
|
|
midiprop.tdiv.dwTimeDiv = 480;
|
|
|
|
rc = midiStreamProperty(hm, (LPBYTE)&midiprop, MIDIPROP_TIMEDIV | MIDIPROP_SET);
|
|
|
|
ok(!rc, "midiStreamProperty(TimeDiv) rc=%s\n", mmsys_error(rc));
|
|
|
|
|
|
|
|
rc = midiStreamRestart(hm);
|
|
|
|
ok(!rc, "midiStreamRestart rc=%s\n", mmsys_error(rc));
|
|
|
|
|
|
|
|
memset(&mhdr, 0, sizeof(mhdr));
|
|
|
|
mhdr.dwBufferLength = sizeof(MIDISHORTEVENT) * 5 + ROUNDUP4(sizeof(SysEx_reset)) +
|
|
|
|
ROUNDUP4(sizeof(SysEx_volume_off)) + ROUNDUP4(sizeof(SysEx_volume_full));
|
|
|
|
mhdr.lpData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, mhdr.dwBufferLength);
|
|
|
|
ok(mhdr.lpData!=NULL, "No %d bytes of memory!\n", mhdr.dwBufferLength);
|
|
|
|
if (mhdr.lpData) {
|
|
|
|
MIDIEVENT *e;
|
|
|
|
char *p = mhdr.lpData;
|
|
|
|
/* GM System ON */
|
|
|
|
e = (MIDIEVENT *)p;
|
|
|
|
e->dwEvent = MEVT_F_LONG | sizeof(SysEx_reset);
|
|
|
|
memcpy(&e->dwParms[0], SysEx_reset, sizeof(SysEx_reset));
|
|
|
|
p += sizeof(MIDISHORTEVENT) + ROUNDUP4(sizeof(SysEx_reset));
|
|
|
|
/* Master volume: off */
|
|
|
|
e = (MIDIEVENT *)p;
|
|
|
|
e->dwDeltaTime = 96;
|
|
|
|
e->dwEvent = MEVT_F_LONG | sizeof(SysEx_volume_off);
|
|
|
|
memcpy(&e->dwParms[0], SysEx_volume_off, sizeof(SysEx_volume_off));
|
|
|
|
p += sizeof(MIDISHORTEVENT) + ROUNDUP4(sizeof(SysEx_volume_off));
|
2018-04-04 17:41:24 +02:00
|
|
|
/* Note On (We can't hear this voice due to volume settings) */
|
2018-04-04 17:41:31 +02:00
|
|
|
e = (MIDIEVENT *)p;
|
|
|
|
e->dwEvent = MEVT_F_SHORT | 0x6F4593; /* note #69 */
|
|
|
|
p += sizeof(MIDISHORTEVENT);
|
|
|
|
/* Note Off */
|
|
|
|
e = (MIDIEVENT *)p;
|
|
|
|
e->dwDeltaTime = 240;
|
|
|
|
e->dwEvent = MEVT_F_SHORT | 0x004593; /* velocity 0 */
|
|
|
|
p += sizeof(MIDISHORTEVENT);
|
|
|
|
/* Master volume: full */
|
|
|
|
e = (MIDIEVENT *)p;
|
|
|
|
e->dwEvent = MEVT_F_LONG | sizeof(SysEx_volume_full);
|
|
|
|
memcpy(&e->dwParms[0], SysEx_volume_full, sizeof(SysEx_volume_full));
|
|
|
|
p += sizeof(MIDISHORTEVENT) + ROUNDUP4(sizeof(SysEx_volume_full));
|
|
|
|
mhdr.dwBytesRecorded = (DWORD)(p - mhdr.lpData);
|
|
|
|
#undef ROUNDUP4
|
|
|
|
|
|
|
|
rc = midiOutPrepareHeader((HMIDIOUT)hm, &mhdr, sizeof(mhdr));
|
|
|
|
ok(!rc, "midiOutPrepareHeader rc=%s\n", mmsys_error(rc));
|
|
|
|
|
|
|
|
rc = playStream(hm, &mhdr);
|
|
|
|
ok(!rc, "midiStreamOut rc=%s\n", mmsys_error(rc));
|
2018-05-14 14:24:08 +02:00
|
|
|
test_notification(hwnd, "midiStreamOut", MOM_DONE, (DWORD_PTR)&mhdr);
|
2018-04-04 17:41:31 +02:00
|
|
|
|
|
|
|
rc = midiOutUnprepareHeader((HMIDIOUT)hm, &mhdr, sizeof(mhdr));
|
|
|
|
ok(!rc, "midiOutUnprepare rc=%s\n", mmsys_error(rc));
|
|
|
|
|
|
|
|
HeapFree(GetProcessHeap(), 0, mhdr.lpData);
|
|
|
|
}
|
|
|
|
rc = midiStreamClose(hm);
|
|
|
|
ok(!rc, "midiOutClose rc=%s\n", mmsys_error(rc));
|
2018-05-14 14:24:08 +02:00
|
|
|
test_notification(hwnd, "midiStreamClose", MOM_CLOSE, 0);
|
2010-01-27 18:32:23 +01:00
|
|
|
}
|
|
|
|
|
2011-01-28 13:30:21 +01:00
|
|
|
static BOOL scan_subkeys(HKEY parent, const LPCSTR *sub_keys)
|
|
|
|
{
|
|
|
|
char name[64];
|
|
|
|
DWORD index = 0;
|
|
|
|
DWORD name_len = sizeof(name);
|
|
|
|
BOOL found_vmware = FALSE;
|
|
|
|
|
|
|
|
if (sub_keys[0] == NULL)
|
|
|
|
{
|
|
|
|
/* We're at the deepest level, check "Identifier" value now */
|
|
|
|
char *test;
|
|
|
|
if (RegQueryValueExA(parent, "Identifier", NULL, NULL, (LPBYTE) name, &name_len) != ERROR_SUCCESS)
|
|
|
|
return FALSE;
|
|
|
|
for (test = name; test < name + lstrlenA(name) - 6 && ! found_vmware; test++)
|
|
|
|
{
|
|
|
|
char c = test[6];
|
|
|
|
test[6] = '\0';
|
|
|
|
found_vmware = (lstrcmpiA(test, "VMware") == 0);
|
|
|
|
test[6] = c;
|
|
|
|
}
|
|
|
|
return found_vmware;
|
|
|
|
}
|
|
|
|
|
|
|
|
while (RegEnumKeyExA(parent, index, name, &name_len, NULL, NULL, NULL, NULL) == ERROR_SUCCESS &&
|
|
|
|
! found_vmware) {
|
|
|
|
char c = name[lstrlenA(sub_keys[0])];
|
|
|
|
name[lstrlenA(sub_keys[0])] = '\0';
|
|
|
|
if (lstrcmpiA(name, sub_keys[0]) == 0) {
|
|
|
|
HKEY sub_key;
|
|
|
|
name[lstrlenA(sub_keys[0])] = c;
|
|
|
|
if (RegOpenKeyExA(parent, name, 0, KEY_ENUMERATE_SUB_KEYS | KEY_QUERY_VALUE, &sub_key) == ERROR_SUCCESS) {
|
|
|
|
found_vmware = scan_subkeys(sub_key, sub_keys + 1);
|
|
|
|
RegCloseKey(sub_key);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
name_len = sizeof(name);
|
|
|
|
index++;
|
|
|
|
}
|
|
|
|
|
|
|
|
return found_vmware;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Usual method to detect whether running inside a VMware virtual machine involves direct port I/O requiring
|
|
|
|
* some assembly and an exception handler. Can't do that in Wine tests. Alternative method of querying WMI
|
|
|
|
* is not available on NT4. So instead we look at the device map and check the Identifier value in the
|
|
|
|
* registry keys HKLM\HARDWARE\DEVICEMAP\SCSI\Scsi Port x\Scsi Bus x\Target Id x\Logical Unit Id x (where
|
|
|
|
* x is some number). If the Identifier value contains the string "VMware" we assume running in a VMware VM.
|
|
|
|
*/
|
|
|
|
static BOOL on_vmware(void)
|
|
|
|
{
|
|
|
|
static const LPCSTR sub_keys[] = { "Scsi Port ", "Scsi Bus ", "Target Id ", "Logical Unit Id ", NULL };
|
|
|
|
HKEY scsi;
|
|
|
|
BOOL found_vmware = FALSE;
|
|
|
|
|
|
|
|
if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, "HARDWARE\\DEVICEMAP\\Scsi", 0, KEY_ENUMERATE_SUB_KEYS, &scsi) != ERROR_SUCCESS)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
found_vmware = scan_subkeys(scsi, sub_keys);
|
|
|
|
|
|
|
|
RegCloseKey(scsi);
|
|
|
|
|
|
|
|
return found_vmware;
|
|
|
|
}
|
|
|
|
|
2010-01-27 18:32:23 +01:00
|
|
|
static void test_midi_outfns(HWND hwnd)
|
|
|
|
{
|
|
|
|
HMIDIOUT hm;
|
|
|
|
MMRESULT rc;
|
|
|
|
UINT udev, ndevs = midiOutGetNumDevs();
|
|
|
|
|
|
|
|
rc = midiOutOpen(&hm, ndevs, 0, 0, CALLBACK_NULL);
|
|
|
|
ok(rc==MMSYSERR_BADDEVICEID, "midiOutOpen udev>max rc=%s\n", mmsys_error(rc));
|
|
|
|
if (!rc) {
|
|
|
|
rc = midiOutClose(hm);
|
|
|
|
ok(!rc, "midiOutClose rc=%s\n", mmsys_error(rc));
|
|
|
|
}
|
|
|
|
if (!ndevs) {
|
2010-02-18 17:37:25 +01:00
|
|
|
MIDIOUTCAPSA capsA;
|
2010-01-27 18:32:23 +01:00
|
|
|
skip("Found no MIDI out device\n");
|
2010-02-18 17:37:25 +01:00
|
|
|
|
|
|
|
rc = midiOutGetDevCapsA(MIDIMAPPER, &capsA, sizeof(capsA));
|
|
|
|
/* GetDevCaps and Open must return compatible results */
|
|
|
|
ok(rc==MMSYSERR_BADDEVICEID || broken(rc==MMSYSERR_NODRIVER /*nt,w2k*/), "midiOutGetDevCaps MAPPER with no MIDI rc=%s\n", mmsys_error(rc));
|
|
|
|
|
2010-01-27 18:32:23 +01:00
|
|
|
rc = midiOutOpen(&hm, MIDIMAPPER, 0, 0, CALLBACK_NULL);
|
2016-02-19 23:12:21 +01:00
|
|
|
todo_wine_if (rc == MIDIERR_INVALIDSETUP) /* Wine without snd-seq */
|
|
|
|
ok(rc == MMSYSERR_BADDEVICEID || broken(rc == MMSYSERR_NODRIVER /*w2k sound disabled*/),
|
|
|
|
"midiOutOpen MAPPER with no MIDI rc=%s\n", mmsys_error(rc));
|
2010-01-27 18:32:23 +01:00
|
|
|
if (!rc) {
|
|
|
|
rc = midiOutClose(hm);
|
|
|
|
ok(!rc, "midiOutClose rc=%s\n", mmsys_error(rc));
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
trace("Found %d MIDI OUT devices\n", ndevs);
|
|
|
|
|
|
|
|
test_midi_mci(hwnd);
|
|
|
|
|
|
|
|
for (udev=0; udev < ndevs; udev++) {
|
2011-01-28 13:30:21 +01:00
|
|
|
MIDIOUTCAPSA capsA;
|
|
|
|
rc = midiOutGetDevCapsA(udev, &capsA, sizeof(capsA));
|
|
|
|
if (rc || strcmp(capsA.szPname, "Creative Sound Blaster MPU-401") != 0 || ! on_vmware()) {
|
|
|
|
trace("** Testing device %d\n", udev);
|
|
|
|
test_midiOut_device(udev, hwnd);
|
|
|
|
Sleep(800); /* Let the synth rest */
|
|
|
|
test_midiStream(udev, hwnd);
|
|
|
|
Sleep(800);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
win_skip("Skipping this device on VMware, driver problem\n");
|
2010-01-27 18:32:23 +01:00
|
|
|
}
|
|
|
|
trace("** Testing MIDI mapper\n");
|
|
|
|
test_midiOut_device(MIDIMAPPER, hwnd);
|
|
|
|
Sleep(800);
|
|
|
|
test_midiStream(MIDIMAPPER, hwnd);
|
|
|
|
}
|
|
|
|
|
|
|
|
START_TEST(midi)
|
|
|
|
{
|
2010-03-09 22:20:55 +01:00
|
|
|
HWND hwnd = 0;
|
2016-09-08 12:48:20 +02:00
|
|
|
|
|
|
|
CoInitialize(NULL); /* Needed for Win 10 */
|
|
|
|
|
2010-01-27 18:32:23 +01:00
|
|
|
if (1) /* select 1 for CALLBACK_WINDOW or 0 for CALLBACK_FUNCTION */
|
|
|
|
hwnd = CreateWindowExA(0, "static", "winmm midi test", WS_POPUP, 0,0,100,100,
|
|
|
|
0, 0, 0, NULL);
|
|
|
|
test_midi_infns(hwnd);
|
|
|
|
test_midi_outfns(hwnd);
|
|
|
|
if (hwnd) DestroyWindow(hwnd);
|
2016-09-08 12:48:20 +02:00
|
|
|
|
|
|
|
CoUninitialize();
|
2010-01-27 18:32:23 +01:00
|
|
|
}
|