Added support for MCI AVI driver
Added some fixes mixer functions Fixed MCI string comparison (thanks to Lionel ULMER) No longer using 16 bit USER functions (use their 32 bit counter part) Reindenting. Added function sndPlaySound32W
This commit is contained in:
parent
6ccda0d582
commit
c11b167f62
166
include/debug.h
166
include/debug.h
|
@ -73,88 +73,90 @@
|
||||||
#define dbch_local 65
|
#define dbch_local 65
|
||||||
#define dbch_mci 66
|
#define dbch_mci 66
|
||||||
#define dbch_mcianim 67
|
#define dbch_mcianim 67
|
||||||
#define dbch_mcimidi 68
|
#define dbch_mciavi 68
|
||||||
#define dbch_mciwave 69
|
#define dbch_mcimidi 69
|
||||||
#define dbch_mdi 70
|
#define dbch_mciwave 70
|
||||||
#define dbch_menu 71
|
#define dbch_mdi 71
|
||||||
#define dbch_message 72
|
#define dbch_menu 72
|
||||||
#define dbch_metafile 73
|
#define dbch_message 73
|
||||||
#define dbch_midi 74
|
#define dbch_metafile 74
|
||||||
#define dbch_mmaux 75
|
#define dbch_midi 75
|
||||||
#define dbch_mmio 76
|
#define dbch_mmaux 76
|
||||||
#define dbch_mmsys 77
|
#define dbch_mmio 77
|
||||||
#define dbch_mmtime 78
|
#define dbch_mmsys 78
|
||||||
#define dbch_module 79
|
#define dbch_mmtime 79
|
||||||
#define dbch_monthcal 80
|
#define dbch_module 80
|
||||||
#define dbch_mpr 81
|
#define dbch_monthcal 81
|
||||||
#define dbch_msacm 82
|
#define dbch_mpr 82
|
||||||
#define dbch_msg 83
|
#define dbch_msacm 83
|
||||||
#define dbch_msvideo 84
|
#define dbch_msg 84
|
||||||
#define dbch_nativefont 85
|
#define dbch_msvideo 85
|
||||||
#define dbch_nonclient 86
|
#define dbch_nativefont 86
|
||||||
#define dbch_ntdll 87
|
#define dbch_nonclient 87
|
||||||
#define dbch_ole 88
|
#define dbch_ntdll 88
|
||||||
#define dbch_pager 89
|
#define dbch_ole 89
|
||||||
#define dbch_palette 90
|
#define dbch_pager 90
|
||||||
#define dbch_pidl 91
|
#define dbch_palette 91
|
||||||
#define dbch_print 92
|
#define dbch_pidl 92
|
||||||
#define dbch_process 93
|
#define dbch_print 93
|
||||||
#define dbch_profile 94
|
#define dbch_process 94
|
||||||
#define dbch_progress 95
|
#define dbch_profile 95
|
||||||
#define dbch_prop 96
|
#define dbch_progress 96
|
||||||
#define dbch_propsheet 97
|
#define dbch_prop 97
|
||||||
#define dbch_psapi 98
|
#define dbch_propsheet 98
|
||||||
#define dbch_psdrv 99
|
#define dbch_psapi 99
|
||||||
#define dbch_ras 100
|
#define dbch_psdrv 100
|
||||||
#define dbch_rebar 101
|
#define dbch_ras 101
|
||||||
#define dbch_reg 102
|
#define dbch_rebar 102
|
||||||
#define dbch_region 103
|
#define dbch_reg 103
|
||||||
#define dbch_relay 104
|
#define dbch_region 104
|
||||||
#define dbch_resource 105
|
#define dbch_relay 105
|
||||||
#define dbch_scroll 106
|
#define dbch_resource 106
|
||||||
#define dbch_security 107
|
#define dbch_scroll 107
|
||||||
#define dbch_segment 108
|
#define dbch_security 108
|
||||||
#define dbch_selector 109
|
#define dbch_segment 109
|
||||||
#define dbch_sem 110
|
#define dbch_selector 110
|
||||||
#define dbch_sendmsg 111
|
#define dbch_sem 111
|
||||||
#define dbch_server 112
|
#define dbch_sendmsg 112
|
||||||
#define dbch_shell 113
|
#define dbch_server 113
|
||||||
#define dbch_shm 114
|
#define dbch_shell 114
|
||||||
#define dbch_snoop 115
|
#define dbch_shm 115
|
||||||
#define dbch_sound 116
|
#define dbch_snoop 116
|
||||||
#define dbch_static 117
|
#define dbch_sound 117
|
||||||
#define dbch_statusbar 118
|
#define dbch_static 118
|
||||||
#define dbch_stress 119
|
#define dbch_statusbar 119
|
||||||
#define dbch_string 120
|
#define dbch_stress 120
|
||||||
#define dbch_syscolor 121
|
#define dbch_string 121
|
||||||
#define dbch_system 122
|
#define dbch_syscolor 122
|
||||||
#define dbch_tab 123
|
#define dbch_system 123
|
||||||
#define dbch_task 124
|
#define dbch_tab 124
|
||||||
#define dbch_text 125
|
#define dbch_task 125
|
||||||
#define dbch_thread 126
|
#define dbch_text 126
|
||||||
#define dbch_thunk 127
|
#define dbch_thread 127
|
||||||
#define dbch_timer 128
|
#define dbch_thunk 128
|
||||||
#define dbch_toolbar 129
|
#define dbch_timer 129
|
||||||
#define dbch_toolhelp 130
|
#define dbch_toolbar 130
|
||||||
#define dbch_tooltips 131
|
#define dbch_toolhelp 131
|
||||||
#define dbch_trackbar 132
|
#define dbch_tooltips 132
|
||||||
#define dbch_treeview 133
|
#define dbch_trackbar 133
|
||||||
#define dbch_ttydrv 134
|
#define dbch_treeview 134
|
||||||
#define dbch_tweak 135
|
#define dbch_ttydrv 135
|
||||||
#define dbch_uitools 136
|
#define dbch_tweak 136
|
||||||
#define dbch_updown 137
|
#define dbch_uitools 137
|
||||||
#define dbch_ver 138
|
#define dbch_unknown 138
|
||||||
#define dbch_virtual 139
|
#define dbch_updown 139
|
||||||
#define dbch_vxd 140
|
#define dbch_ver 140
|
||||||
#define dbch_wave 141
|
#define dbch_virtual 141
|
||||||
#define dbch_win 142
|
#define dbch_vxd 142
|
||||||
#define dbch_win16drv 143
|
#define dbch_wave 143
|
||||||
#define dbch_win32 144
|
#define dbch_win 144
|
||||||
#define dbch_wing 145
|
#define dbch_win16drv 145
|
||||||
#define dbch_winsock 146
|
#define dbch_win32 146
|
||||||
#define dbch_wnet 147
|
#define dbch_wing 147
|
||||||
#define dbch_x11 148
|
#define dbch_winsock 148
|
||||||
#define dbch_x11drv 149
|
#define dbch_wnet 149
|
||||||
|
#define dbch_x11 150
|
||||||
|
#define dbch_x11drv 151
|
||||||
/* Definitions for classes identifiers */
|
/* Definitions for classes identifiers */
|
||||||
#define dbcl_fixme 0
|
#define dbcl_fixme 0
|
||||||
#define dbcl_err 1
|
#define dbcl_err 1
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#include "debugtools.h"
|
#include "debugtools.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define DEBUG_CHANNEL_COUNT 150
|
#define DEBUG_CHANNEL_COUNT 152
|
||||||
#ifdef DEBUG_RUNTIME
|
#ifdef DEBUG_RUNTIME
|
||||||
short debug_msg_enabled[][DEBUG_CLASS_COUNT] = {
|
short debug_msg_enabled[][DEBUG_CLASS_COUNT] = {
|
||||||
{1, 1, 0, 0},
|
{1, 1, 0, 0},
|
||||||
|
@ -157,6 +157,8 @@ short debug_msg_enabled[][DEBUG_CLASS_COUNT] = {
|
||||||
{1, 1, 0, 0},
|
{1, 1, 0, 0},
|
||||||
{1, 1, 0, 0},
|
{1, 1, 0, 0},
|
||||||
{1, 1, 0, 0},
|
{1, 1, 0, 0},
|
||||||
|
{1, 1, 0, 0},
|
||||||
|
{1, 1, 0, 0},
|
||||||
};
|
};
|
||||||
const char* debug_ch_name[] = {
|
const char* debug_ch_name[] = {
|
||||||
"accel",
|
"accel",
|
||||||
|
@ -227,6 +229,7 @@ const char* debug_ch_name[] = {
|
||||||
"local",
|
"local",
|
||||||
"mci",
|
"mci",
|
||||||
"mcianim",
|
"mcianim",
|
||||||
|
"mciavi",
|
||||||
"mcimidi",
|
"mcimidi",
|
||||||
"mciwave",
|
"mciwave",
|
||||||
"mdi",
|
"mdi",
|
||||||
|
@ -296,6 +299,7 @@ const char* debug_ch_name[] = {
|
||||||
"ttydrv",
|
"ttydrv",
|
||||||
"tweak",
|
"tweak",
|
||||||
"uitools",
|
"uitools",
|
||||||
|
"unknown",
|
||||||
"updown",
|
"updown",
|
||||||
"ver",
|
"ver",
|
||||||
"virtual",
|
"virtual",
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
* a good way to do so.
|
* a good way to do so.
|
||||||
*/
|
*/
|
||||||
#define MAX_MIDIOUTDRV (16)
|
#define MAX_MIDIOUTDRV (16)
|
||||||
#define MAX_MCIMIDIDRV (1)
|
|
||||||
|
|
||||||
#if defined(HAVE_SYS_SOUNDCARD_H)
|
#if defined(HAVE_SYS_SOUNDCARD_H)
|
||||||
# include <sys/soundcard.h>
|
# include <sys/soundcard.h>
|
||||||
|
@ -81,5 +80,7 @@ LONG MCICDAUDIO_DriverProc32(DWORD dwDevID, HDRVR16 hDriv, DWORD wMsg,
|
||||||
DWORD dwParam1, DWORD dwParam2);
|
DWORD dwParam1, DWORD dwParam2);
|
||||||
LONG MCIANIM_DriverProc32(DWORD dwDevID, HDRVR16 hDriv, DWORD wMsg,
|
LONG MCIANIM_DriverProc32(DWORD dwDevID, HDRVR16 hDriv, DWORD wMsg,
|
||||||
DWORD dwParam1, DWORD dwParam2);
|
DWORD dwParam1, DWORD dwParam2);
|
||||||
|
LONG MCIAVI_DriverProc32(DWORD dwDevID, HDRVR16 hDriv, DWORD wMsg,
|
||||||
|
DWORD dwParam1, DWORD dwParam2);
|
||||||
|
|
||||||
#endif /* __WINE_MULTIMEDIA_H */
|
#endif /* __WINE_MULTIMEDIA_H */
|
||||||
|
|
|
@ -12,6 +12,7 @@ C_SRCS = \
|
||||||
init.c \
|
init.c \
|
||||||
joystick.c \
|
joystick.c \
|
||||||
mcianim.c \
|
mcianim.c \
|
||||||
|
mciavi.c \
|
||||||
mcicda.c \
|
mcicda.c \
|
||||||
mcimidi.c \
|
mcimidi.c \
|
||||||
mcistring.c \
|
mcistring.c \
|
||||||
|
|
|
@ -597,7 +597,7 @@ LONG MCIANIM_DriverProc32(DWORD dwDevID, HDRVR16 hDriv, DWORD wMsg,
|
||||||
case DRV_ENABLE: return 1;
|
case DRV_ENABLE: return 1;
|
||||||
case DRV_DISABLE: return 1;
|
case DRV_DISABLE: return 1;
|
||||||
case DRV_QUERYCONFIGURE: return 1;
|
case DRV_QUERYCONFIGURE: return 1;
|
||||||
case DRV_CONFIGURE: MessageBox16(0, "Sample MultiMedia Linux Driver !", "MMLinux Driver", MB_OK); return 1;
|
case DRV_CONFIGURE: MessageBox32A(0, "Sample MultiMedia Linux Driver !", "MMLinux Driver", MB_OK); return 1;
|
||||||
case DRV_INSTALL: return DRVCNF_RESTART;
|
case DRV_INSTALL: return DRVCNF_RESTART;
|
||||||
case DRV_REMOVE: return DRVCNF_RESTART;
|
case DRV_REMOVE: return DRVCNF_RESTART;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,316 @@
|
||||||
|
/*
|
||||||
|
* Digital video MCI Wine Driver
|
||||||
|
*
|
||||||
|
* Copyright 1999 Eric POUECH
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "wine/winuser16.h"
|
||||||
|
#include "multimedia.h"
|
||||||
|
#include "user.h"
|
||||||
|
#include "driver.h"
|
||||||
|
#include "xmalloc.h"
|
||||||
|
#include "debug.h"
|
||||||
|
#include "callback.h"
|
||||||
|
#include "options.h"
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int nUseCount; /* Incremented for each shared open */
|
||||||
|
BOOL16 fShareable; /* TRUE if first open was shareable */
|
||||||
|
WORD wNotifyDeviceID; /* MCI device ID with a pending notification */
|
||||||
|
HANDLE16 hCallback; /* Callback handle for pending notification */
|
||||||
|
HMMIO32 hFile; /* mmio file handle open as Element */
|
||||||
|
MCI_OPEN_PARMS32A openParms;
|
||||||
|
DWORD dwTimeFormat;
|
||||||
|
} WINE_MCIAVI;
|
||||||
|
|
||||||
|
#define MAX_MCIAVIDRV (1)
|
||||||
|
static WINE_MCIAVI MCIAviDev[MAX_MCIAVIDRV];
|
||||||
|
|
||||||
|
/*======================================================================*
|
||||||
|
* MCI AVI implemantation *
|
||||||
|
*======================================================================*/
|
||||||
|
|
||||||
|
/**************************************************************************
|
||||||
|
* AVI_mciGetOpenDev [internal]
|
||||||
|
*/
|
||||||
|
static WINE_MCIAVI* AVI_mciGetOpenDev(UINT16 wDevID)
|
||||||
|
{
|
||||||
|
if (wDevID >= MAX_MCIAVIDRV || MCIAviDev[wDevID].nUseCount == 0) {
|
||||||
|
WARN(mciavi, "Invalid wDevID=%u\n", wDevID);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return &MCIAviDev[wDevID];
|
||||||
|
}
|
||||||
|
|
||||||
|
static DWORD AVI_mciStop(UINT16 wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms);
|
||||||
|
|
||||||
|
static DWORD AVI_mciOpen(UINT16 wDevID, DWORD dwFlags, LPMCI_OPEN_PARMS32A lpParms)
|
||||||
|
{
|
||||||
|
WINE_MCIAVI* wma;
|
||||||
|
|
||||||
|
TRACE(mciavi, "(%04x, %08lX, %p) : semi-stub\n", wDevID, dwFlags, lpParms);
|
||||||
|
|
||||||
|
if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
|
||||||
|
if (wDevID > MAX_MCIAVIDRV) return MCIERR_INVALID_DEVICE_ID;
|
||||||
|
|
||||||
|
wma = &MCIAviDev[wDevID];
|
||||||
|
|
||||||
|
if (wma->nUseCount > 0) {
|
||||||
|
/* The driver is already open on this channel */
|
||||||
|
/* If the driver was opened shareable before and this open specifies */
|
||||||
|
/* shareable then increment the use count */
|
||||||
|
if (wma->fShareable && (dwFlags & MCI_OPEN_SHAREABLE))
|
||||||
|
++wma->nUseCount;
|
||||||
|
else
|
||||||
|
return MCIERR_MUST_USE_SHAREABLE;
|
||||||
|
} else {
|
||||||
|
wma->nUseCount = 1;
|
||||||
|
wma->fShareable = dwFlags & MCI_OPEN_SHAREABLE;
|
||||||
|
}
|
||||||
|
if (dwFlags & MCI_OPEN_ELEMENT) {
|
||||||
|
TRACE(cdaudio,"MCI_OPEN_ELEMENT !\n");
|
||||||
|
/* return MCIERR_NO_ELEMENT_ALLOWED; */
|
||||||
|
}
|
||||||
|
|
||||||
|
wma->openParms.dwCallback = lpParms->dwCallback;
|
||||||
|
wma->openParms.wDeviceID = (WORD)lpParms->wDeviceID;
|
||||||
|
wma->openParms.lpstrDeviceType = lpParms->lpstrDeviceType;
|
||||||
|
wma->openParms.lpstrElementName = lpParms->lpstrElementName;
|
||||||
|
wma->openParms.lpstrAlias = lpParms->lpstrAlias;
|
||||||
|
|
||||||
|
wma->wNotifyDeviceID = lpParms->wDeviceID;
|
||||||
|
/* FIXME: do real open */
|
||||||
|
/* wmcda->mciMode = MCI_MODE_STOP; */
|
||||||
|
wma->dwTimeFormat = MCI_FORMAT_TMSF;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static DWORD AVI_mciClose(UINT16 wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
|
||||||
|
{
|
||||||
|
WINE_MCIAVI* wma = AVI_mciGetOpenDev(wDevID);
|
||||||
|
|
||||||
|
TRACE(mciavi, "(%04x, %08lX, %p) : semi-stub\n", wDevID, dwFlags, lpParms);
|
||||||
|
|
||||||
|
if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
|
||||||
|
|
||||||
|
if (wma->nUseCount == 1) {
|
||||||
|
AVI_mciStop(wDevID, 0, NULL);
|
||||||
|
/* FIXME: do real closing */
|
||||||
|
}
|
||||||
|
wma->nUseCount--;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static DWORD AVI_mciPlay(UINT16 wDevID, DWORD dwFlags, LPMCI_PLAY_PARMS lpParms)
|
||||||
|
{
|
||||||
|
TRACE(mciavi, "(%04x, %08lX, %p) : stub\n", wDevID, dwFlags, lpParms);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static DWORD AVI_mciRecord(UINT16 wDevID, DWORD dwFlags, LPMCI_RECORD_PARMS lpParms)
|
||||||
|
{
|
||||||
|
TRACE(mciavi, "(%04x, %08lX, %p) : stub\n", wDevID, dwFlags, lpParms);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static DWORD AVI_mciStop(UINT16 wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
|
||||||
|
{
|
||||||
|
TRACE(mciavi, "(%04x, %08lX, %p) : stub\n", wDevID, dwFlags, lpParms);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static DWORD AVI_mciSet(UINT16 wDevID, DWORD dwFlags, LPMCI_SET_PARMS lpParms)
|
||||||
|
{
|
||||||
|
TRACE(mciavi, "(%04x, %08lX, %p) : stub\n", wDevID, dwFlags, lpParms);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static DWORD AVI_mciPause(UINT16 wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
|
||||||
|
{
|
||||||
|
TRACE(mciavi, "(%04x, %08lX, %p) : stub\n", wDevID, dwFlags, lpParms);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static DWORD AVI_mciResume(UINT16 wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
|
||||||
|
{
|
||||||
|
TRACE(mciavi, "(%04x, %08lX, %p) : stub\n", wDevID, dwFlags, lpParms);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static DWORD AVI_mciStatus(UINT16 wDevID, DWORD dwFlags, LPMCI_STATUS_PARMS lpParms)
|
||||||
|
{
|
||||||
|
TRACE(mciavi, "(%04x, %08lX, %p) : stub\n", wDevID, dwFlags, lpParms);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static DWORD AVI_mciGetDevCaps(UINT16 wDevID, DWORD dwFlags, LPMCI_GETDEVCAPS_PARMS lpParms)
|
||||||
|
{
|
||||||
|
WINE_MCIAVI* wmm = AVI_mciGetOpenDev(wDevID);
|
||||||
|
|
||||||
|
TRACE(mciavi, "(%04x, %08lX, %p) : stub\n", wDevID, dwFlags, lpParms);
|
||||||
|
|
||||||
|
if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
|
||||||
|
if (wmm == NULL) return MCIERR_INVALID_DEVICE_ID;
|
||||||
|
|
||||||
|
if (dwFlags & MCI_GETDEVCAPS_ITEM) {
|
||||||
|
switch (lpParms->dwItem) {
|
||||||
|
case MCI_GETDEVCAPS_DEVICE_TYPE:
|
||||||
|
TRACE(mciavi, "MCI_GETDEVCAPS_DEVICE_TYPE !\n");
|
||||||
|
lpParms->dwReturn = MCI_DEVTYPE_DIGITAL_VIDEO;
|
||||||
|
break;
|
||||||
|
case MCI_GETDEVCAPS_HAS_AUDIO:
|
||||||
|
TRACE(mciavi, "MCI_GETDEVCAPS_HAS_AUDIO !\n");
|
||||||
|
lpParms->dwReturn = TRUE;
|
||||||
|
break;
|
||||||
|
case MCI_GETDEVCAPS_HAS_VIDEO:
|
||||||
|
TRACE(mciavi, "MCI_GETDEVCAPS_HAS_VIDEO !\n");
|
||||||
|
lpParms->dwReturn = TRUE;
|
||||||
|
break;
|
||||||
|
case MCI_GETDEVCAPS_USES_FILES:
|
||||||
|
TRACE(mciavi, "MCI_GETDEVCAPS_USES_FILES !\n");
|
||||||
|
lpParms->dwReturn = TRUE;
|
||||||
|
break;
|
||||||
|
case MCI_GETDEVCAPS_COMPOUND_DEVICE:
|
||||||
|
TRACE(mciavi, "MCI_GETDEVCAPS_COMPOUND_DEVICE !\n");
|
||||||
|
lpParms->dwReturn = TRUE;
|
||||||
|
break;
|
||||||
|
case MCI_GETDEVCAPS_CAN_EJECT:
|
||||||
|
TRACE(mciavi, "MCI_GETDEVCAPS_CAN_EJECT !\n");
|
||||||
|
lpParms->dwReturn = FALSE;
|
||||||
|
break;
|
||||||
|
case MCI_GETDEVCAPS_CAN_PLAY:
|
||||||
|
TRACE(mciavi, "MCI_GETDEVCAPS_CAN_PLAY !\n");
|
||||||
|
lpParms->dwReturn = TRUE;
|
||||||
|
break;
|
||||||
|
case MCI_GETDEVCAPS_CAN_RECORD:
|
||||||
|
TRACE(mciavi, "MCI_GETDEVCAPS_CAN_RECORD !\n");
|
||||||
|
lpParms->dwReturn = FALSE;
|
||||||
|
break;
|
||||||
|
case MCI_GETDEVCAPS_CAN_SAVE:
|
||||||
|
TRACE(mciavi, "MCI_GETDEVCAPS_CAN_SAVE !\n");
|
||||||
|
lpParms->dwReturn = FALSE;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
TRACE(mciavi, "Unknown capability (%08lx) !\n", lpParms->dwItem);
|
||||||
|
return MCIERR_UNRECOGNIZED_COMMAND;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
TRACE(mciavi, "No GetDevCaps-Item !\n");
|
||||||
|
return MCIERR_UNRECOGNIZED_COMMAND;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static DWORD AVI_mciInfo(UINT16 wDevID, DWORD dwFlags, LPMCI_INFO_PARMS32A lpParms)
|
||||||
|
{
|
||||||
|
DWORD ret = 0;
|
||||||
|
LPSTR str = 0;
|
||||||
|
WINE_MCIAVI* wma = AVI_mciGetOpenDev(wDevID);
|
||||||
|
|
||||||
|
TRACE(mciavi, "(%04X, %08lX, %p) : stub;\n", wDevID, dwFlags, lpParms);
|
||||||
|
|
||||||
|
if (lpParms == NULL || lpParms->lpstrReturn == NULL) {
|
||||||
|
ret = MCIERR_NULL_PARAMETER_BLOCK;
|
||||||
|
} else if (wma == NULL) {
|
||||||
|
ret = MCIERR_INVALID_DEVICE_ID;
|
||||||
|
} else {
|
||||||
|
TRACE(mciavi, "buf=%p, len=%lu\n", lpParms->lpstrReturn, lpParms->dwRetSize);
|
||||||
|
|
||||||
|
switch (dwFlags) {
|
||||||
|
case MCI_INFO_PRODUCT:
|
||||||
|
str = "Wine's AVI player";
|
||||||
|
break;
|
||||||
|
case MCI_INFO_FILE:
|
||||||
|
str = "";
|
||||||
|
break;
|
||||||
|
#if 0
|
||||||
|
/* FIXME: the following manifest constants are not defined in <WINE>/include/mmsystem.h */
|
||||||
|
case MCI_INFO_COPYRIGHT:
|
||||||
|
break;
|
||||||
|
case MCI_INFO_NAME:
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
default:
|
||||||
|
WARN(mciavi, "Don't know this info command (%lu)\n", dwFlags);
|
||||||
|
ret = MCIERR_UNRECOGNIZED_COMMAND;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (str) {
|
||||||
|
ret = MCI_WriteString(lpParms->lpstrReturn, lpParms->dwRetSize, str);
|
||||||
|
} else {
|
||||||
|
lpParms->lpstrReturn[0] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static DWORD AVI_mciSeek(UINT16 wDevID, DWORD dwFlags, LPMCI_SEEK_PARMS lpParms)
|
||||||
|
{
|
||||||
|
TRACE(mciavi, "(%04x, %08lX, %p) : stub\n", wDevID, dwFlags, lpParms);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*======================================================================*
|
||||||
|
* MCI AVI entry points *
|
||||||
|
*======================================================================*/
|
||||||
|
|
||||||
|
/**************************************************************************
|
||||||
|
* MCIAVI_DriverProc32 [sample driver]
|
||||||
|
*/
|
||||||
|
LONG WINAPI MCIAVI_DriverProc32(DWORD dwDevID, HDRVR16 hDriv, DWORD wMsg,
|
||||||
|
DWORD dwParam1, DWORD dwParam2)
|
||||||
|
{
|
||||||
|
switch (wMsg) {
|
||||||
|
case DRV_LOAD: return 1;
|
||||||
|
case DRV_FREE: return 1;
|
||||||
|
case DRV_OPEN: return 1;
|
||||||
|
case DRV_CLOSE: return 1;
|
||||||
|
case DRV_ENABLE: return 1;
|
||||||
|
case DRV_DISABLE: return 1;
|
||||||
|
case DRV_QUERYCONFIGURE: return 1;
|
||||||
|
case DRV_CONFIGURE: MessageBox32A(0, "Sample AVI Wine Driver !", "MM-Wine Driver", MB_OK); return 1;
|
||||||
|
case DRV_INSTALL: return DRVCNF_RESTART;
|
||||||
|
case DRV_REMOVE: return DRVCNF_RESTART;
|
||||||
|
case MCI_OPEN_DRIVER: return AVI_mciOpen (dwDevID, dwParam1, (LPMCI_OPEN_PARMS32A) dwParam2);
|
||||||
|
case MCI_CLOSE_DRIVER: return AVI_mciClose (dwDevID, dwParam1, (LPMCI_GENERIC_PARMS) dwParam2);
|
||||||
|
case MCI_PLAY: return AVI_mciPlay (dwDevID, dwParam1, (LPMCI_PLAY_PARMS) dwParam2);
|
||||||
|
case MCI_RECORD: return AVI_mciRecord (dwDevID, dwParam1, (LPMCI_RECORD_PARMS) dwParam2);
|
||||||
|
case MCI_STOP: return AVI_mciStop (dwDevID, dwParam1, (LPMCI_GENERIC_PARMS) dwParam2);
|
||||||
|
case MCI_SET: return AVI_mciSet (dwDevID, dwParam1, (LPMCI_SET_PARMS) dwParam2);
|
||||||
|
case MCI_PAUSE: return AVI_mciPause (dwDevID, dwParam1, (LPMCI_GENERIC_PARMS) dwParam2);
|
||||||
|
case MCI_RESUME: return AVI_mciResume (dwDevID, dwParam1, (LPMCI_GENERIC_PARMS) dwParam2);
|
||||||
|
case MCI_STATUS: return AVI_mciStatus (dwDevID, dwParam1, (LPMCI_STATUS_PARMS) dwParam2);
|
||||||
|
case MCI_GETDEVCAPS: return AVI_mciGetDevCaps(dwDevID, dwParam1, (LPMCI_GETDEVCAPS_PARMS)dwParam2);
|
||||||
|
case MCI_INFO: return AVI_mciInfo (dwDevID, dwParam1, (LPMCI_INFO_PARMS32A) dwParam2);
|
||||||
|
case MCI_SEEK: return AVI_mciSeek (dwDevID, dwParam1, (LPMCI_SEEK_PARMS) dwParam2);
|
||||||
|
case MCI_LOAD:
|
||||||
|
case MCI_SAVE:
|
||||||
|
case MCI_FREEZE:
|
||||||
|
case MCI_PUT:
|
||||||
|
case MCI_REALIZE:
|
||||||
|
case MCI_UNFREEZE:
|
||||||
|
case MCI_UPDATE:
|
||||||
|
case MCI_WHERE:
|
||||||
|
case MCI_WINDOW:
|
||||||
|
case MCI_STEP:
|
||||||
|
case MCI_SPIN:
|
||||||
|
case MCI_ESCAPE:
|
||||||
|
case MCI_COPY:
|
||||||
|
case MCI_CUT:
|
||||||
|
case MCI_DELETE:
|
||||||
|
case MCI_PASTE:
|
||||||
|
WARN(mciavi, "Unsupported command=%s\n", MCI_CommandToString(wMsg));
|
||||||
|
break;
|
||||||
|
case MCI_OPEN:
|
||||||
|
case MCI_CLOSE:
|
||||||
|
FIXME(mciavi, "Shouldn't receive a MCI_OPEN or CLOSE message\n");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
TRACE(mciavi, "Sending msg=%s to default driver proc\n", MCI_CommandToString(wMsg));
|
||||||
|
return DefDriverProc32(dwDevID, hDriv, wMsg, dwParam1, dwParam2);
|
||||||
|
}
|
||||||
|
return MCIERR_UNRECOGNIZED_COMMAND;
|
||||||
|
}
|
|
@ -65,6 +65,7 @@ typedef struct {
|
||||||
DWORD dwStartTicks;
|
DWORD dwStartTicks;
|
||||||
} WINE_MCIMIDI;
|
} WINE_MCIMIDI;
|
||||||
|
|
||||||
|
#define MAX_MCIMIDIDRV (1)
|
||||||
static WINE_MCIMIDI MCIMidiDev[MAX_MCIMIDIDRV];
|
static WINE_MCIMIDI MCIMidiDev[MAX_MCIMIDIDRV];
|
||||||
|
|
||||||
/*======================================================================*
|
/*======================================================================*
|
||||||
|
@ -90,13 +91,13 @@ static WINE_MCIMIDI* MIDI_mciGetOpenDev(UINT16 wDevID)
|
||||||
static DWORD MIDI_mciReadByte(WINE_MCIMIDI* wmm, BYTE *lpbyt)
|
static DWORD MIDI_mciReadByte(WINE_MCIMIDI* wmm, BYTE *lpbyt)
|
||||||
{
|
{
|
||||||
DWORD ret = 0;
|
DWORD ret = 0;
|
||||||
|
|
||||||
if (lpbyt == NULL ||
|
if (lpbyt == NULL ||
|
||||||
mmioRead32(wmm->hFile, (HPSTR)lpbyt, (long)sizeof(BYTE)) != (long)sizeof(BYTE)) {
|
mmioRead32(wmm->hFile, (HPSTR)lpbyt, (long)sizeof(BYTE)) != (long)sizeof(BYTE)) {
|
||||||
WARN(mcimidi, "Error reading wmm=%p\n", wmm);
|
WARN(mcimidi, "Error reading wmm=%p\n", wmm);
|
||||||
ret = MCIERR_INTERNAL;
|
ret = MCIERR_INTERNAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,7 +108,7 @@ static DWORD MIDI_mciReadWord(WINE_MCIMIDI* wmm, LPWORD lpw)
|
||||||
{
|
{
|
||||||
BYTE hibyte, lobyte;
|
BYTE hibyte, lobyte;
|
||||||
DWORD ret = MCIERR_INTERNAL;
|
DWORD ret = MCIERR_INTERNAL;
|
||||||
|
|
||||||
if (lpw != NULL &&
|
if (lpw != NULL &&
|
||||||
MIDI_mciReadByte(wmm, &hibyte) == 0 &&
|
MIDI_mciReadByte(wmm, &hibyte) == 0 &&
|
||||||
MIDI_mciReadByte(wmm, &lobyte) == 0) {
|
MIDI_mciReadByte(wmm, &lobyte) == 0) {
|
||||||
|
@ -124,7 +125,7 @@ static DWORD MIDI_mciReadLong(WINE_MCIMIDI* wmm, LPDWORD lpdw)
|
||||||
{
|
{
|
||||||
WORD hiword, loword;
|
WORD hiword, loword;
|
||||||
DWORD ret = MCIERR_INTERNAL;
|
DWORD ret = MCIERR_INTERNAL;
|
||||||
|
|
||||||
if (lpdw != NULL &&
|
if (lpdw != NULL &&
|
||||||
MIDI_mciReadWord(wmm, &hiword) == 0 &&
|
MIDI_mciReadWord(wmm, &hiword) == 0 &&
|
||||||
MIDI_mciReadWord(wmm, &loword) == 0) {
|
MIDI_mciReadWord(wmm, &loword) == 0) {
|
||||||
|
@ -142,7 +143,7 @@ static WORD MIDI_mciReadVaryLen(WINE_MCIMIDI* wmm, LPDWORD lpdw)
|
||||||
BYTE byte;
|
BYTE byte;
|
||||||
DWORD value = 0;
|
DWORD value = 0;
|
||||||
WORD ret = 0;
|
WORD ret = 0;
|
||||||
|
|
||||||
if (lpdw == NULL) {
|
if (lpdw == NULL) {
|
||||||
ret = MCIERR_INTERNAL;
|
ret = MCIERR_INTERNAL;
|
||||||
} else {
|
} else {
|
||||||
|
@ -171,7 +172,7 @@ static DWORD MIDI_mciReadNextEvent(WINE_MCIMIDI* wmm, MCI_MIDITRACK* mmt)
|
||||||
DWORD evtPulse;
|
DWORD evtPulse;
|
||||||
DWORD evtLength;
|
DWORD evtLength;
|
||||||
DWORD tmp;
|
DWORD tmp;
|
||||||
|
|
||||||
if (mmioSeek32(wmm->hFile, mmt->dwIndex, SEEK_SET) != mmt->dwIndex) {
|
if (mmioSeek32(wmm->hFile, mmt->dwIndex, SEEK_SET) != mmt->dwIndex) {
|
||||||
WARN(mcimidi, "Can't seek at %08lX \n", mmt->dwIndex);
|
WARN(mcimidi, "Can't seek at %08lX \n", mmt->dwIndex);
|
||||||
return MCIERR_INTERNAL;
|
return MCIERR_INTERNAL;
|
||||||
|
@ -219,15 +220,15 @@ static DWORD MIDI_mciReadNextEvent(WINE_MCIMIDI* wmm, MCI_MIDITRACK* mmt)
|
||||||
}
|
}
|
||||||
if (mmt->dwIndex + evtLength > mmt->dwLast)
|
if (mmt->dwIndex + evtLength > mmt->dwLast)
|
||||||
return MCIERR_INTERNAL;
|
return MCIERR_INTERNAL;
|
||||||
|
|
||||||
mmt->dwEventPulse += evtPulse;
|
mmt->dwEventPulse += evtPulse;
|
||||||
mmt->dwEventData = (hw << 16) + (b2 << 8) + b1;
|
mmt->dwEventData = (hw << 16) + (b2 << 8) + b1;
|
||||||
mmt->wEventLength = evtLength;
|
mmt->wEventLength = evtLength;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
TRACE(mcimidi, "[%u] => pulse=%08lx(%08lx), data=%08lx, length=%u\n",
|
TRACE(mcimidi, "[%u] => pulse=%08lx(%08lx), data=%08lx, length=%u\n",
|
||||||
mmt->wTrackNr, mmt->dwEventPulse, evtPulse,
|
mmt->wTrackNr, mmt->dwEventPulse, evtPulse,
|
||||||
mmt->dwEventData, mmt->wEventLength);
|
mmt->dwEventData, mmt->wEventLength);
|
||||||
*/
|
*/
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -239,47 +240,47 @@ static DWORD MIDI_mciReadMTrk(WINE_MCIMIDI* wmm, MCI_MIDITRACK* mmt)
|
||||||
{
|
{
|
||||||
DWORD toberead;
|
DWORD toberead;
|
||||||
FOURCC fourcc;
|
FOURCC fourcc;
|
||||||
|
|
||||||
if (mmioRead32(wmm->hFile, (HPSTR)&fourcc, (long)sizeof(FOURCC)) !=
|
if (mmioRead32(wmm->hFile, (HPSTR)&fourcc, (long)sizeof(FOURCC)) !=
|
||||||
(long)sizeof(FOURCC)) {
|
(long)sizeof(FOURCC)) {
|
||||||
return MCIERR_INTERNAL;
|
return MCIERR_INTERNAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fourcc != mmioFOURCC('M', 'T', 'r', 'k')) {
|
if (fourcc != mmioFOURCC('M', 'T', 'r', 'k')) {
|
||||||
WARN(mcimidi, "Can't synchronize on 'MTrk' !\n");
|
WARN(mcimidi, "Can't synchronize on 'MTrk' !\n");
|
||||||
return MCIERR_INTERNAL;
|
return MCIERR_INTERNAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (MIDI_mciReadLong(wmm, &toberead) != 0) {
|
if (MIDI_mciReadLong(wmm, &toberead) != 0) {
|
||||||
return MCIERR_INTERNAL;
|
return MCIERR_INTERNAL;
|
||||||
}
|
}
|
||||||
mmt->dwFirst = mmioSeek32(wmm->hFile, 0, SEEK_CUR); /* >= 0 */
|
mmt->dwFirst = mmioSeek32(wmm->hFile, 0, SEEK_CUR); /* >= 0 */
|
||||||
mmt->dwLast = mmt->dwFirst + toberead;
|
mmt->dwLast = mmt->dwFirst + toberead;
|
||||||
|
|
||||||
/* compute # of pulses in this track */
|
/* compute # of pulses in this track */
|
||||||
mmt->dwIndex = mmt->dwFirst;
|
mmt->dwIndex = mmt->dwFirst;
|
||||||
mmt->dwEventPulse = 0;
|
mmt->dwEventPulse = 0;
|
||||||
|
|
||||||
while (MIDI_mciReadNextEvent(wmm, mmt) == 0 &&
|
while (MIDI_mciReadNextEvent(wmm, mmt) == 0 &&
|
||||||
LOWORD(mmt->dwEventData) != 0x2FFF) {
|
LOWORD(mmt->dwEventData) != 0x2FFF) {
|
||||||
mmt->dwIndex += mmt->wEventLength;
|
mmt->dwIndex += mmt->wEventLength;
|
||||||
}
|
}
|
||||||
mmt->dwLength = mmt->dwEventPulse;
|
mmt->dwLength = mmt->dwEventPulse;
|
||||||
|
|
||||||
TRACE(mcimidi, "Track %u has %lu bytes and %lu pulses\n", mmt->wTrackNr, toberead, mmt->dwLength);
|
TRACE(mcimidi, "Track %u has %lu bytes and %lu pulses\n", mmt->wTrackNr, toberead, mmt->dwLength);
|
||||||
|
|
||||||
/* reset track data */
|
/* reset track data */
|
||||||
mmt->wStatus = 1; /* ok, playing */
|
mmt->wStatus = 1; /* ok, playing */
|
||||||
mmt->dwIndex = mmt->dwFirst;
|
mmt->dwIndex = mmt->dwFirst;
|
||||||
mmt->dwEventPulse = 0;
|
mmt->dwEventPulse = 0;
|
||||||
|
|
||||||
if (mmioSeek32(wmm->hFile, 0, SEEK_CUR) != mmt->dwLast) {
|
if (mmioSeek32(wmm->hFile, 0, SEEK_CUR) != mmt->dwLast) {
|
||||||
WARN(mcimidi, "Ouch, out of sync seek=%lu track=%lu\n",
|
WARN(mcimidi, "Ouch, out of sync seek=%lu track=%lu\n",
|
||||||
mmioSeek32(wmm->hFile, 0, SEEK_CUR), mmt->dwLast);
|
mmioSeek32(wmm->hFile, 0, SEEK_CUR), mmt->dwLast);
|
||||||
/* position at end of this track, to be ready to read next track */
|
/* position at end of this track, to be ready to read next track */
|
||||||
mmioSeek32(wmm->hFile, mmt->dwLast, SEEK_SET);
|
mmioSeek32(wmm->hFile, mmt->dwLast, SEEK_SET);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -291,9 +292,9 @@ static DWORD MIDI_mciReadMThd(WINE_MCIMIDI* wmm, DWORD dwOffset)
|
||||||
DWORD toberead;
|
DWORD toberead;
|
||||||
FOURCC fourcc;
|
FOURCC fourcc;
|
||||||
WORD nt;
|
WORD nt;
|
||||||
|
|
||||||
TRACE(mcimidi, "(%p, %08lX);\n", wmm, dwOffset);
|
TRACE(mcimidi, "(%p, %08lX);\n", wmm, dwOffset);
|
||||||
|
|
||||||
if (mmioSeek32(wmm->hFile, dwOffset, SEEK_SET) != dwOffset) {
|
if (mmioSeek32(wmm->hFile, dwOffset, SEEK_SET) != dwOffset) {
|
||||||
WARN(mcimidi, "Can't seek at %08lX begin of 'MThd' \n", dwOffset);
|
WARN(mcimidi, "Can't seek at %08lX begin of 'MThd' \n", dwOffset);
|
||||||
return MCIERR_INTERNAL;
|
return MCIERR_INTERNAL;
|
||||||
|
@ -301,24 +302,24 @@ static DWORD MIDI_mciReadMThd(WINE_MCIMIDI* wmm, DWORD dwOffset)
|
||||||
if (mmioRead32(wmm->hFile, (HPSTR)&fourcc,
|
if (mmioRead32(wmm->hFile, (HPSTR)&fourcc,
|
||||||
(long) sizeof(FOURCC)) != (long) sizeof(FOURCC))
|
(long) sizeof(FOURCC)) != (long) sizeof(FOURCC))
|
||||||
return MCIERR_INTERNAL;
|
return MCIERR_INTERNAL;
|
||||||
|
|
||||||
if (fourcc != mmioFOURCC('M', 'T', 'h', 'd')) {
|
if (fourcc != mmioFOURCC('M', 'T', 'h', 'd')) {
|
||||||
WARN(mcimidi, "Can't synchronize on 'MThd' !\n");
|
WARN(mcimidi, "Can't synchronize on 'MThd' !\n");
|
||||||
return MCIERR_INTERNAL;
|
return MCIERR_INTERNAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (MIDI_mciReadLong(wmm, &toberead) != 0 || toberead < 3 * sizeof(WORD))
|
if (MIDI_mciReadLong(wmm, &toberead) != 0 || toberead < 3 * sizeof(WORD))
|
||||||
return MCIERR_INTERNAL;
|
return MCIERR_INTERNAL;
|
||||||
|
|
||||||
if (MIDI_mciReadWord(wmm, &wmm->wFormat) != 0 ||
|
if (MIDI_mciReadWord(wmm, &wmm->wFormat) != 0 ||
|
||||||
MIDI_mciReadWord(wmm, &wmm->nTracks) != 0 ||
|
MIDI_mciReadWord(wmm, &wmm->nTracks) != 0 ||
|
||||||
MIDI_mciReadWord(wmm, &wmm->nDivision) != 0) {
|
MIDI_mciReadWord(wmm, &wmm->nDivision) != 0) {
|
||||||
return MCIERR_INTERNAL;
|
return MCIERR_INTERNAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACE(mcimidi, "toberead=0x%08lX, wFormat=0x%04X nTracks=0x%04X nDivision=0x%04X\n",
|
TRACE(mcimidi, "toberead=0x%08lX, wFormat=0x%04X nTracks=0x%04X nDivision=0x%04X\n",
|
||||||
toberead, wmm->wFormat, wmm->nTracks, wmm->nDivision);
|
toberead, wmm->wFormat, wmm->nTracks, wmm->nDivision);
|
||||||
|
|
||||||
/* MS doc says that the MIDI MCI time format must be put by default to the format
|
/* MS doc says that the MIDI MCI time format must be put by default to the format
|
||||||
* stored in the MIDI file...
|
* stored in the MIDI file...
|
||||||
*/
|
*/
|
||||||
|
@ -330,8 +331,8 @@ static DWORD MIDI_mciReadMThd(WINE_MCIMIDI* wmm, DWORD dwOffset)
|
||||||
* these files, I'd like to know about.
|
* these files, I'd like to know about.
|
||||||
*/
|
*/
|
||||||
FIXME(mcimidi, "Handling SMPTE time in MIDI files has not been tested\n"
|
FIXME(mcimidi, "Handling SMPTE time in MIDI files has not been tested\n"
|
||||||
"Please report to comp.emulators.ms-windows.wine with MIDI file !\n");
|
"Please report to comp.emulators.ms-windows.wine with MIDI file !\n");
|
||||||
|
|
||||||
switch (HIBYTE(wmm->nDivision)) {
|
switch (HIBYTE(wmm->nDivision)) {
|
||||||
case 0xE8: wmm->dwMciTimeFormat = MCI_FORMAT_SMPTE_24; break; /* -24 */
|
case 0xE8: wmm->dwMciTimeFormat = MCI_FORMAT_SMPTE_24; break; /* -24 */
|
||||||
case 0xE7: wmm->dwMciTimeFormat = MCI_FORMAT_SMPTE_25; break; /* -25 */
|
case 0xE7: wmm->dwMciTimeFormat = MCI_FORMAT_SMPTE_25; break; /* -25 */
|
||||||
|
@ -358,7 +359,7 @@ static DWORD MIDI_mciReadMThd(WINE_MCIMIDI* wmm, DWORD dwOffset)
|
||||||
} else {
|
} else {
|
||||||
wmm->dwMciTimeFormat = MCI_FORMAT_MILLISECONDS;
|
wmm->dwMciTimeFormat = MCI_FORMAT_MILLISECONDS;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (wmm->wFormat) {
|
switch (wmm->wFormat) {
|
||||||
case 0:
|
case 0:
|
||||||
if (wmm->nTracks != 1) {
|
if (wmm->nTracks != 1) {
|
||||||
|
@ -371,24 +372,24 @@ static DWORD MIDI_mciReadMThd(WINE_MCIMIDI* wmm, DWORD dwOffset)
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
WARN(mcimidi, "Handling MIDI files which format = %d is not (yet) supported\n"
|
WARN(mcimidi, "Handling MIDI files which format = %d is not (yet) supported\n"
|
||||||
"Please report with MIDI file !\n", wmm->wFormat);
|
"Please report with MIDI file !\n", wmm->wFormat);
|
||||||
return MCIERR_INTERNAL;
|
return MCIERR_INTERNAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wmm->nTracks & 0x8000) {
|
if (wmm->nTracks & 0x8000) {
|
||||||
/* this shouldn't be a problem... */
|
/* this shouldn't be a problem... */
|
||||||
WARN(mcimidi, "Ouch !! Implementation limitation to 32k tracks per MIDI file is overflowed\n");
|
WARN(mcimidi, "Ouch !! Implementation limitation to 32k tracks per MIDI file is overflowed\n");
|
||||||
wmm->nTracks = 0x7FFF;
|
wmm->nTracks = 0x7FFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
wmm->tracks = xmalloc(sizeof(MCI_MIDITRACK) * wmm->nTracks);
|
wmm->tracks = xmalloc(sizeof(MCI_MIDITRACK) * wmm->nTracks);
|
||||||
|
|
||||||
toberead -= 3 * sizeof(WORD);
|
toberead -= 3 * sizeof(WORD);
|
||||||
if (toberead > 0) {
|
if (toberead > 0) {
|
||||||
TRACE(mcimidi, "Size of MThd > 6, skipping %ld extra bytes\n", toberead);
|
TRACE(mcimidi, "Size of MThd > 6, skipping %ld extra bytes\n", toberead);
|
||||||
mmioSeek32(wmm->hFile, toberead, SEEK_CUR);
|
mmioSeek32(wmm->hFile, toberead, SEEK_CUR);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (nt = 0; nt < wmm->nTracks; nt++) {
|
for (nt = 0; nt < wmm->nTracks; nt++) {
|
||||||
wmm->tracks[nt].wTrackNr = nt;
|
wmm->tracks[nt].wTrackNr = nt;
|
||||||
if (MIDI_mciReadMTrk(wmm, &wmm->tracks[nt]) != 0) {
|
if (MIDI_mciReadMTrk(wmm, &wmm->tracks[nt]) != 0) {
|
||||||
|
@ -396,9 +397,9 @@ static DWORD MIDI_mciReadMThd(WINE_MCIMIDI* wmm, DWORD dwOffset)
|
||||||
return MCIERR_INTERNAL;
|
return MCIERR_INTERNAL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wmm->dwTempo = 500000;
|
wmm->dwTempo = 500000;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -408,7 +409,7 @@ static DWORD MIDI_mciReadMThd(WINE_MCIMIDI* wmm, DWORD dwOffset)
|
||||||
static DWORD MIDI_ConvertPulseToMS(WINE_MCIMIDI* wmm, DWORD pulse)
|
static DWORD MIDI_ConvertPulseToMS(WINE_MCIMIDI* wmm, DWORD pulse)
|
||||||
{
|
{
|
||||||
DWORD ret = 0;
|
DWORD ret = 0;
|
||||||
|
|
||||||
/* FIXME: this function may return false values since the tempo (wmm->dwTempo)
|
/* FIXME: this function may return false values since the tempo (wmm->dwTempo)
|
||||||
* may change during file playing
|
* may change during file playing
|
||||||
*/
|
*/
|
||||||
|
@ -422,12 +423,12 @@ static DWORD MIDI_ConvertPulseToMS(WINE_MCIMIDI* wmm, DWORD pulse)
|
||||||
ret = (DWORD)((double)pulse * ((double)wmm->dwTempo / 1000) /
|
ret = (DWORD)((double)pulse * ((double)wmm->dwTempo / 1000) /
|
||||||
(double)wmm->nDivision);
|
(double)wmm->nDivision);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
TRACE(mcimidi, "pulse=%lu tempo=%lu division=%u=0x%04x => ms=%lu\n",
|
TRACE(mcimidi, "pulse=%lu tempo=%lu division=%u=0x%04x => ms=%lu\n",
|
||||||
pulse, wmm->dwTempo, wmm->nDivision, wmm->nDivision, ret);
|
pulse, wmm->dwTempo, wmm->nDivision, wmm->nDivision, ret);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -441,7 +442,7 @@ static DWORD MIDI_ConvertPulseToMS(WINE_MCIMIDI* wmm, DWORD pulse)
|
||||||
static DWORD MIDI_ConvertTimeFormatToMS(WINE_MCIMIDI* wmm, DWORD val)
|
static DWORD MIDI_ConvertTimeFormatToMS(WINE_MCIMIDI* wmm, DWORD val)
|
||||||
{
|
{
|
||||||
DWORD ret = 0;
|
DWORD ret = 0;
|
||||||
|
|
||||||
switch (wmm->dwMciTimeFormat) {
|
switch (wmm->dwMciTimeFormat) {
|
||||||
case MCI_FORMAT_MILLISECONDS:
|
case MCI_FORMAT_MILLISECONDS:
|
||||||
ret = val;
|
ret = val;
|
||||||
|
@ -477,7 +478,7 @@ static DWORD MIDI_ConvertMSToTimeFormat(WINE_MCIMIDI* wmm, DWORD _val)
|
||||||
{
|
{
|
||||||
DWORD ret = 0, val = _val;
|
DWORD ret = 0, val = _val;
|
||||||
DWORD h, m, s, f;
|
DWORD h, m, s, f;
|
||||||
|
|
||||||
switch (wmm->dwMciTimeFormat) {
|
switch (wmm->dwMciTimeFormat) {
|
||||||
case MCI_FORMAT_MILLISECONDS:
|
case MCI_FORMAT_MILLISECONDS:
|
||||||
ret = val;
|
ret = val;
|
||||||
|
@ -546,16 +547,16 @@ static DWORD MIDI_mciOpen(UINT16 wDevID, DWORD dwFlags, LPMCI_OPEN_PARMS32A lpPa
|
||||||
DWORD dwRet = 0;
|
DWORD dwRet = 0;
|
||||||
DWORD dwDeviceID;
|
DWORD dwDeviceID;
|
||||||
WINE_MCIMIDI* wmm;
|
WINE_MCIMIDI* wmm;
|
||||||
|
|
||||||
TRACE(mcimidi, "(%04x, %08lX, %p)\n", wDevID, dwFlags, lpParms);
|
TRACE(mcimidi, "(%04x, %08lX, %p)\n", wDevID, dwFlags, lpParms);
|
||||||
|
|
||||||
if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
|
if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
|
||||||
if (wDevID >= MAX_MCIMIDIDRV) {
|
if (wDevID >= MAX_MCIMIDIDRV) {
|
||||||
WARN(mcimidi, "Invalid wDevID=%u\n", wDevID);
|
WARN(mcimidi, "Invalid wDevID=%u\n", wDevID);
|
||||||
return MCIERR_INVALID_DEVICE_ID;
|
return MCIERR_INVALID_DEVICE_ID;
|
||||||
}
|
}
|
||||||
wmm = &MCIMidiDev[wDevID];
|
wmm = &MCIMidiDev[wDevID];
|
||||||
|
|
||||||
if (wmm->nUseCount > 0) {
|
if (wmm->nUseCount > 0) {
|
||||||
/* The driver is already opened on this channel
|
/* The driver is already opened on this channel
|
||||||
* MIDI sequencer cannot be shared
|
* MIDI sequencer cannot be shared
|
||||||
|
@ -569,12 +570,12 @@ static DWORD MIDI_mciOpen(UINT16 wDevID, DWORD dwFlags, LPMCI_OPEN_PARMS32A lpPa
|
||||||
|
|
||||||
TRACE(mcimidi, "wDevID=%04X (lpParams->wDeviceID=%08lX)\n", wDevID, dwDeviceID);
|
TRACE(mcimidi, "wDevID=%04X (lpParams->wDeviceID=%08lX)\n", wDevID, dwDeviceID);
|
||||||
/* lpParms->wDeviceID = wDevID;*/
|
/* lpParms->wDeviceID = wDevID;*/
|
||||||
|
|
||||||
if (dwFlags & MCI_OPEN_ELEMENT) {
|
if (dwFlags & MCI_OPEN_ELEMENT) {
|
||||||
LPSTR lpstrElementName;
|
LPSTR lpstrElementName;
|
||||||
|
|
||||||
lpstrElementName = lpParms->lpstrElementName;
|
lpstrElementName = lpParms->lpstrElementName;
|
||||||
|
|
||||||
TRACE(mcimidi, "MCI_OPEN_ELEMENT '%s' !\n", lpstrElementName);
|
TRACE(mcimidi, "MCI_OPEN_ELEMENT '%s' !\n", lpstrElementName);
|
||||||
if (lpstrElementName && strlen(lpstrElementName) > 0) {
|
if (lpstrElementName && strlen(lpstrElementName) > 0) {
|
||||||
wmm->hFile = mmioOpen32A(lpstrElementName, NULL,
|
wmm->hFile = mmioOpen32A(lpstrElementName, NULL,
|
||||||
|
@ -589,40 +590,40 @@ static DWORD MIDI_mciOpen(UINT16 wDevID, DWORD dwFlags, LPMCI_OPEN_PARMS32A lpPa
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TRACE(mcimidi, "hFile=%u\n", wmm->hFile);
|
TRACE(mcimidi, "hFile=%u\n", wmm->hFile);
|
||||||
|
|
||||||
memcpy(&wmm->openParms, lpParms, sizeof(MCI_OPEN_PARMS32A));
|
memcpy(&wmm->openParms, lpParms, sizeof(MCI_OPEN_PARMS32A));
|
||||||
|
|
||||||
wmm->wNotifyDeviceID = dwDeviceID;
|
wmm->wNotifyDeviceID = dwDeviceID;
|
||||||
wmm->dwStatus = MCI_MODE_NOT_READY; /* while loading file contents */
|
wmm->dwStatus = MCI_MODE_NOT_READY; /* while loading file contents */
|
||||||
/* spec says it should be the default format from the MIDI file... */
|
/* spec says it should be the default format from the MIDI file... */
|
||||||
wmm->dwMciTimeFormat = MCI_FORMAT_MILLISECONDS;
|
wmm->dwMciTimeFormat = MCI_FORMAT_MILLISECONDS;
|
||||||
|
|
||||||
midiOpenDesc.hMidi = 0;
|
midiOpenDesc.hMidi = 0;
|
||||||
|
|
||||||
if (wmm->hFile != 0) {
|
if (wmm->hFile != 0) {
|
||||||
MMCKINFO ckMainRIFF;
|
MMCKINFO ckMainRIFF;
|
||||||
MMCKINFO mmckInfo;
|
MMCKINFO mmckInfo;
|
||||||
DWORD dwOffset = 0;
|
DWORD dwOffset = 0;
|
||||||
|
|
||||||
if (mmioDescend(wmm->hFile, &ckMainRIFF, NULL, 0) != 0) {
|
if (mmioDescend(wmm->hFile, &ckMainRIFF, NULL, 0) != 0) {
|
||||||
dwRet = MCIERR_INVALID_FILE;
|
dwRet = MCIERR_INVALID_FILE;
|
||||||
} else {
|
} else {
|
||||||
TRACE(mcimidi,"ParentChunk ckid=%.4s fccType=%.4s cksize=%08lX \n",
|
TRACE(mcimidi,"ParentChunk ckid=%.4s fccType=%.4s cksize=%08lX \n",
|
||||||
(LPSTR)&ckMainRIFF.ckid, (LPSTR)&ckMainRIFF.fccType, ckMainRIFF.cksize);
|
(LPSTR)&ckMainRIFF.ckid, (LPSTR)&ckMainRIFF.fccType, ckMainRIFF.cksize);
|
||||||
|
|
||||||
if (ckMainRIFF.ckid == FOURCC_RIFF && ckMainRIFF.fccType == mmioFOURCC('R', 'M', 'I', 'D')) {
|
if (ckMainRIFF.ckid == FOURCC_RIFF && ckMainRIFF.fccType == mmioFOURCC('R', 'M', 'I', 'D')) {
|
||||||
mmckInfo.ckid = mmioFOURCC('d', 'a', 't', 'a');
|
mmckInfo.ckid = mmioFOURCC('d', 'a', 't', 'a');
|
||||||
if (mmioDescend(wmm->hFile, &mmckInfo, &ckMainRIFF, MMIO_FINDCHUNK) == 0) {
|
if (mmioDescend(wmm->hFile, &mmckInfo, &ckMainRIFF, MMIO_FINDCHUNK) == 0) {
|
||||||
TRACE(mcimidi, "... is a 'RMID' file \n");
|
TRACE(mcimidi, "... is a 'RMID' file \n");
|
||||||
dwOffset = mmckInfo.dwDataOffset;
|
dwOffset = mmckInfo.dwDataOffset;
|
||||||
} else {
|
} else {
|
||||||
dwRet = MCIERR_INVALID_FILE;
|
dwRet = MCIERR_INVALID_FILE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (dwRet == 0 && MIDI_mciReadMThd(wmm, dwOffset) != 0) {
|
if (dwRet == 0 && MIDI_mciReadMThd(wmm, dwOffset) != 0) {
|
||||||
WARN(mcimidi, "Can't read 'MThd' header \n");
|
WARN(mcimidi, "Can't read 'MThd' header \n");
|
||||||
dwRet = MCIERR_INVALID_FILE;
|
dwRet = MCIERR_INVALID_FILE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
TRACE(mcimidi, "hFile==0, setting #tracks to 0; is this correct ?\n");
|
TRACE(mcimidi, "hFile==0, setting #tracks to 0; is this correct ?\n");
|
||||||
|
@ -636,12 +637,12 @@ static DWORD MIDI_mciOpen(UINT16 wDevID, DWORD dwFlags, LPMCI_OPEN_PARMS32A lpPa
|
||||||
mmioClose32(wmm->hFile, 0);
|
mmioClose32(wmm->hFile, 0);
|
||||||
wmm->hFile = 0;
|
wmm->hFile = 0;
|
||||||
} else {
|
} else {
|
||||||
wmm->dwPositionMS = 0;
|
wmm->dwPositionMS = 0;
|
||||||
wmm->dwStatus = MCI_MODE_STOP;
|
wmm->dwStatus = MCI_MODE_STOP;
|
||||||
wmm->hMidiHdr = USER_HEAP_ALLOC(sizeof(MIDIHDR));
|
wmm->hMidiHdr = USER_HEAP_ALLOC(sizeof(MIDIHDR));
|
||||||
|
|
||||||
dwRet = modMessage(wDevID, MODM_OPEN, 0, (DWORD)&midiOpenDesc, CALLBACK_NULL);
|
dwRet = modMessage(wDevID, MODM_OPEN, 0, (DWORD)&midiOpenDesc, CALLBACK_NULL);
|
||||||
/* dwRet = midMessage(wDevID, MIDM_OPEN, 0, (DWORD)&midiOpenDesc, CALLBACK_NULL);*/
|
/* dwRet = midMessage(wDevID, MIDM_OPEN, 0, (DWORD)&midiOpenDesc, CALLBACK_NULL);*/
|
||||||
}
|
}
|
||||||
return dwRet;
|
return dwRet;
|
||||||
}
|
}
|
||||||
|
@ -652,14 +653,14 @@ static DWORD MIDI_mciOpen(UINT16 wDevID, DWORD dwFlags, LPMCI_OPEN_PARMS32A lpPa
|
||||||
static DWORD MIDI_mciStop(UINT16 wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
|
static DWORD MIDI_mciStop(UINT16 wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
|
||||||
{
|
{
|
||||||
WINE_MCIMIDI* wmm = MIDI_mciGetOpenDev(wDevID);
|
WINE_MCIMIDI* wmm = MIDI_mciGetOpenDev(wDevID);
|
||||||
|
|
||||||
TRACE(mcimidi, "(%04X, %08lX, %p);\n", wDevID, dwFlags, lpParms);
|
TRACE(mcimidi, "(%04X, %08lX, %p);\n", wDevID, dwFlags, lpParms);
|
||||||
|
|
||||||
if (wmm == NULL) return MCIERR_INVALID_DEVICE_ID;
|
if (wmm == NULL) return MCIERR_INVALID_DEVICE_ID;
|
||||||
|
|
||||||
wmm->dwStatus = MCI_MODE_STOP;
|
wmm->dwStatus = MCI_MODE_STOP;
|
||||||
TRACE(mcimidi, "wmm->dwStatus=%d\n", wmm->dwStatus);
|
TRACE(mcimidi, "wmm->dwStatus=%d\n", wmm->dwStatus);
|
||||||
|
|
||||||
if (lpParms && (dwFlags & MCI_NOTIFY)) {
|
if (lpParms && (dwFlags & MCI_NOTIFY)) {
|
||||||
TRACE(mcimidi, "MCI_NOTIFY_SUCCESSFUL %08lX !\n", lpParms->dwCallback);
|
TRACE(mcimidi, "MCI_NOTIFY_SUCCESSFUL %08lX !\n", lpParms->dwCallback);
|
||||||
mciDriverNotify16((HWND16)LOWORD(lpParms->dwCallback),
|
mciDriverNotify16((HWND16)LOWORD(lpParms->dwCallback),
|
||||||
|
@ -675,15 +676,15 @@ static DWORD MIDI_mciClose(UINT16 wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpP
|
||||||
{
|
{
|
||||||
DWORD dwRet;
|
DWORD dwRet;
|
||||||
WINE_MCIMIDI* wmm = MIDI_mciGetOpenDev(wDevID);
|
WINE_MCIMIDI* wmm = MIDI_mciGetOpenDev(wDevID);
|
||||||
|
|
||||||
TRACE(mcimidi, "(%04X, %08lX, %p);\n", wDevID, dwFlags, lpParms);
|
TRACE(mcimidi, "(%04X, %08lX, %p);\n", wDevID, dwFlags, lpParms);
|
||||||
|
|
||||||
if (wmm == NULL) return MCIERR_INVALID_DEVICE_ID;
|
if (wmm == NULL) return MCIERR_INVALID_DEVICE_ID;
|
||||||
|
|
||||||
if (wmm->dwStatus != MCI_MODE_STOP) {
|
if (wmm->dwStatus != MCI_MODE_STOP) {
|
||||||
MIDI_mciStop(wDevID, MCI_WAIT, lpParms);
|
MIDI_mciStop(wDevID, MCI_WAIT, lpParms);
|
||||||
}
|
}
|
||||||
|
|
||||||
wmm->dwStatus = MCI_MODE_STOP;
|
wmm->dwStatus = MCI_MODE_STOP;
|
||||||
wmm->nUseCount--;
|
wmm->nUseCount--;
|
||||||
if (wmm->nUseCount == 0) {
|
if (wmm->nUseCount == 0) {
|
||||||
|
@ -704,11 +705,11 @@ static DWORD MIDI_mciClose(UINT16 wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpP
|
||||||
TRACE(mcimidi, "Shouldn't happen... nUseCount=%d\n", wmm->nUseCount);
|
TRACE(mcimidi, "Shouldn't happen... nUseCount=%d\n", wmm->nUseCount);
|
||||||
return MCIERR_INTERNAL;
|
return MCIERR_INTERNAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lpParms && (dwFlags & MCI_NOTIFY)) {
|
if (lpParms && (dwFlags & MCI_NOTIFY)) {
|
||||||
TRACE(mcimidi, "MCI_NOTIFY_SUCCESSFUL %08lX !\n", lpParms->dwCallback);
|
TRACE(mcimidi, "MCI_NOTIFY_SUCCESSFUL %08lX !\n", lpParms->dwCallback);
|
||||||
mciDriverNotify16((HWND16)LOWORD(lpParms->dwCallback),
|
mciDriverNotify16((HWND16)LOWORD(lpParms->dwCallback),
|
||||||
wmm->wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
|
wmm->wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -720,12 +721,12 @@ static MCI_MIDITRACK* MIDI_mciFindNextEvent(WINE_MCIMIDI* wmm, LPDWORD hiPulse)
|
||||||
{
|
{
|
||||||
WORD cnt, nt;
|
WORD cnt, nt;
|
||||||
MCI_MIDITRACK* mmt;
|
MCI_MIDITRACK* mmt;
|
||||||
|
|
||||||
*hiPulse = 0xFFFFFFFFul;
|
*hiPulse = 0xFFFFFFFFul;
|
||||||
cnt = 0xFFFFu;
|
cnt = 0xFFFFu;
|
||||||
for (nt = 0; nt < wmm->nTracks; nt++) {
|
for (nt = 0; nt < wmm->nTracks; nt++) {
|
||||||
mmt = &wmm->tracks[nt];
|
mmt = &wmm->tracks[nt];
|
||||||
|
|
||||||
if (mmt->wStatus == 0)
|
if (mmt->wStatus == 0)
|
||||||
continue;
|
continue;
|
||||||
if (mmt->dwEventPulse < *hiPulse) {
|
if (mmt->dwEventPulse < *hiPulse) {
|
||||||
|
@ -747,44 +748,44 @@ static DWORD MIDI_mciPlay(UINT16 wDevID, DWORD dwFlags, LPMCI_PLAY_PARMS lpParms
|
||||||
MCI_MIDITRACK* mmt;
|
MCI_MIDITRACK* mmt;
|
||||||
DWORD hiPulse;
|
DWORD hiPulse;
|
||||||
WINE_MCIMIDI* wmm = MIDI_mciGetOpenDev(wDevID);
|
WINE_MCIMIDI* wmm = MIDI_mciGetOpenDev(wDevID);
|
||||||
|
|
||||||
TRACE(mcimidi, "(%04X, %08lX, %p);\n", wDevID, dwFlags, lpParms);
|
TRACE(mcimidi, "(%04X, %08lX, %p);\n", wDevID, dwFlags, lpParms);
|
||||||
|
|
||||||
if (wmm == NULL) return MCIERR_INVALID_DEVICE_ID;
|
if (wmm == NULL) return MCIERR_INVALID_DEVICE_ID;
|
||||||
|
|
||||||
if (wmm->hFile == 0) {
|
if (wmm->hFile == 0) {
|
||||||
WARN(mcimidi, "Can't play: no file '%s' !\n", wmm->openParms.lpstrElementName);
|
WARN(mcimidi, "Can't play: no file '%s' !\n", wmm->openParms.lpstrElementName);
|
||||||
return MCIERR_FILE_NOT_FOUND;
|
return MCIERR_FILE_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wmm->dwStatus != MCI_MODE_STOP) {
|
if (wmm->dwStatus != MCI_MODE_STOP) {
|
||||||
WARN(mcimidi, "Can't play: device is not stopped !\n");
|
WARN(mcimidi, "Can't play: device is not stopped !\n");
|
||||||
return MCIERR_INTERNAL;
|
return MCIERR_INTERNAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(dwFlags & MCI_WAIT)) {
|
if (!(dwFlags & MCI_WAIT)) {
|
||||||
/** FIXME: I'm not 100% sure that wNotifyDeviceID is the right value in all cases ??? */
|
/** FIXME: I'm not 100% sure that wNotifyDeviceID is the right value in all cases ??? */
|
||||||
return MCI_SendCommandAsync32(wmm->wNotifyDeviceID, MCI_PLAY, dwFlags, (DWORD)lpParms);
|
return MCI_SendCommandAsync32(wmm->wNotifyDeviceID, MCI_PLAY, dwFlags, (DWORD)lpParms);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lpParms && (dwFlags & MCI_FROM)) {
|
if (lpParms && (dwFlags & MCI_FROM)) {
|
||||||
dwStartMS = MIDI_ConvertTimeFormatToMS(wmm, lpParms->dwFrom);
|
dwStartMS = MIDI_ConvertTimeFormatToMS(wmm, lpParms->dwFrom);
|
||||||
} else {
|
} else {
|
||||||
dwStartMS = wmm->dwPositionMS;
|
dwStartMS = wmm->dwPositionMS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lpParms && (dwFlags & MCI_TO)) {
|
if (lpParms && (dwFlags & MCI_TO)) {
|
||||||
dwEndMS = MIDI_ConvertTimeFormatToMS(wmm, lpParms->dwTo);
|
dwEndMS = MIDI_ConvertTimeFormatToMS(wmm, lpParms->dwTo);
|
||||||
} else {
|
} else {
|
||||||
dwEndMS = 0xFFFFFFFFul;
|
dwEndMS = 0xFFFFFFFFul;
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACE(mcimidi, "Playing from %lu to %lu\n", dwStartMS, dwEndMS);
|
TRACE(mcimidi, "Playing from %lu to %lu\n", dwStartMS, dwEndMS);
|
||||||
|
|
||||||
/* init tracks */
|
/* init tracks */
|
||||||
for (nt = 0; nt < wmm->nTracks; nt++) {
|
for (nt = 0; nt < wmm->nTracks; nt++) {
|
||||||
mmt = &wmm->tracks[nt];
|
mmt = &wmm->tracks[nt];
|
||||||
|
|
||||||
mmt->wStatus = 1; /* ok, playing */
|
mmt->wStatus = 1; /* ok, playing */
|
||||||
mmt->dwIndex = mmt->dwFirst;
|
mmt->dwIndex = mmt->dwFirst;
|
||||||
if (wmm->wFormat == 2 && nt > 0) {
|
if (wmm->wFormat == 2 && nt > 0) {
|
||||||
|
@ -794,26 +795,26 @@ static DWORD MIDI_mciPlay(UINT16 wDevID, DWORD dwFlags, LPMCI_PLAY_PARMS lpParms
|
||||||
}
|
}
|
||||||
MIDI_mciReadNextEvent(wmm, mmt); /* FIXME == 0 */
|
MIDI_mciReadNextEvent(wmm, mmt); /* FIXME == 0 */
|
||||||
}
|
}
|
||||||
|
|
||||||
wmm->dwPulse = 0;
|
wmm->dwPulse = 0;
|
||||||
wmm->dwTempo = 500000;
|
wmm->dwTempo = 500000;
|
||||||
wmm->dwStatus = MCI_MODE_PLAY;
|
wmm->dwStatus = MCI_MODE_PLAY;
|
||||||
wmm->dwPositionMS = 0;
|
wmm->dwPositionMS = 0;
|
||||||
wmm->wStartedPlaying = FALSE;
|
wmm->wStartedPlaying = FALSE;
|
||||||
|
|
||||||
while (wmm->dwStatus != MCI_MODE_STOP) {
|
while (wmm->dwStatus != MCI_MODE_STOP) {
|
||||||
/* it seems that in case of multi-threading, gcc is optimizing just a little bit
|
/* it seems that in case of multi-threading, gcc is optimizing just a little bit
|
||||||
* too much. Tell gcc not to optimize status value using volatile.
|
* too much. Tell gcc not to optimize status value using volatile.
|
||||||
*/
|
*/
|
||||||
while (((volatile WINE_MCIMIDI*)wmm)->dwStatus == MCI_MODE_PAUSE);
|
while (((volatile WINE_MCIMIDI*)wmm)->dwStatus == MCI_MODE_PAUSE);
|
||||||
|
|
||||||
doPlay = (wmm->dwPositionMS >= dwStartMS && wmm->dwPositionMS <= dwEndMS);
|
doPlay = (wmm->dwPositionMS >= dwStartMS && wmm->dwPositionMS <= dwEndMS);
|
||||||
|
|
||||||
TRACE(mcimidi, "wmm->dwStatus=%d, doPlay=%s\n", wmm->dwStatus, doPlay ? "T" : "F");
|
TRACE(mcimidi, "wmm->dwStatus=%d, doPlay=%s\n", wmm->dwStatus, doPlay ? "T" : "F");
|
||||||
|
|
||||||
if ((mmt = MIDI_mciFindNextEvent(wmm, &hiPulse)) == NULL)
|
if ((mmt = MIDI_mciFindNextEvent(wmm, &hiPulse)) == NULL)
|
||||||
break; /* no more event on tracks */
|
break; /* no more event on tracks */
|
||||||
|
|
||||||
/* if starting playing, then set StartTicks to the value it would have had
|
/* if starting playing, then set StartTicks to the value it would have had
|
||||||
* if play had started at position 0
|
* if play had started at position 0
|
||||||
*/
|
*/
|
||||||
|
@ -827,7 +828,7 @@ static DWORD MIDI_mciPlay(UINT16 wDevID, DWORD dwFlags, LPMCI_PLAY_PARMS lpParms
|
||||||
if (doPlay) {
|
if (doPlay) {
|
||||||
DWORD togo = wmm->dwStartTicks + wmm->dwPositionMS + MIDI_ConvertPulseToMS(wmm, hiPulse - wmm->dwPulse);
|
DWORD togo = wmm->dwStartTicks + wmm->dwPositionMS + MIDI_ConvertPulseToMS(wmm, hiPulse - wmm->dwPulse);
|
||||||
DWORD tc = GetTickCount();
|
DWORD tc = GetTickCount();
|
||||||
|
|
||||||
TRACE(mcimidi, "Pulses hi=0x%08lx <> cur=0x%08lx\n", hiPulse, wmm->dwPulse);
|
TRACE(mcimidi, "Pulses hi=0x%08lx <> cur=0x%08lx\n", hiPulse, wmm->dwPulse);
|
||||||
TRACE(mcimidi, "Wait until %lu => %lu ms\n",
|
TRACE(mcimidi, "Wait until %lu => %lu ms\n",
|
||||||
tc - wmm->dwStartTicks, togo - wmm->dwStartTicks);
|
tc - wmm->dwStartTicks, togo - wmm->dwStartTicks);
|
||||||
|
@ -837,7 +838,7 @@ static DWORD MIDI_mciPlay(UINT16 wDevID, DWORD dwFlags, LPMCI_PLAY_PARMS lpParms
|
||||||
wmm->dwPositionMS += MIDI_ConvertPulseToMS(wmm, hiPulse - wmm->dwPulse);
|
wmm->dwPositionMS += MIDI_ConvertPulseToMS(wmm, hiPulse - wmm->dwPulse);
|
||||||
wmm->dwPulse = hiPulse;
|
wmm->dwPulse = hiPulse;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (LOBYTE(LOWORD(mmt->dwEventData))) {
|
switch (LOBYTE(LOWORD(mmt->dwEventData))) {
|
||||||
case 0xF0:
|
case 0xF0:
|
||||||
case 0xF7: /* sysex events */
|
case 0xF7: /* sysex events */
|
||||||
|
@ -852,7 +853,7 @@ static DWORD MIDI_mciPlay(UINT16 wDevID, DWORD dwFlags, LPMCI_PLAY_PARMS lpParms
|
||||||
case 0x00: /* 16-bit sequence number */
|
case 0x00: /* 16-bit sequence number */
|
||||||
if (TRACE_ON(midi)) {
|
if (TRACE_ON(midi)) {
|
||||||
WORD twd;
|
WORD twd;
|
||||||
|
|
||||||
MIDI_mciReadWord(wmm, &twd); /* == 0 */
|
MIDI_mciReadWord(wmm, &twd); /* == 0 */
|
||||||
TRACE(mcimidi, "Got sequence number %u\n", twd);
|
TRACE(mcimidi, "Got sequence number %u\n", twd);
|
||||||
}
|
}
|
||||||
|
@ -870,7 +871,7 @@ static DWORD MIDI_mciPlay(UINT16 wDevID, DWORD dwFlags, LPMCI_PLAY_PARMS lpParms
|
||||||
static char* info[8] = {"", "Text", "Copyright", "Seq/Trk name",
|
static char* info[8] = {"", "Text", "Copyright", "Seq/Trk name",
|
||||||
"Instrument", "Lyric", "Marker", "Cue-point"};
|
"Instrument", "Lyric", "Marker", "Cue-point"};
|
||||||
WORD idx = HIBYTE(LOWORD(mmt->dwEventData));
|
WORD idx = HIBYTE(LOWORD(mmt->dwEventData));
|
||||||
|
|
||||||
if (len >= sizeof(buf)) {
|
if (len >= sizeof(buf)) {
|
||||||
WARN(mcimidi, "Buffer for text is too small (%d bytes, when %u are needed)\n", sizeof(buf) - 1, len);
|
WARN(mcimidi, "Buffer for text is too small (%d bytes, when %u are needed)\n", sizeof(buf) - 1, len);
|
||||||
len = sizeof(buf) - 1;
|
len = sizeof(buf) - 1;
|
||||||
|
@ -928,7 +929,7 @@ static DWORD MIDI_mciPlay(UINT16 wDevID, DWORD dwFlags, LPMCI_PLAY_PARMS lpParms
|
||||||
WARN(mcimidi, "SMPTE track start can only be expressed at start of track (%lu)\n", mmt->dwEventPulse);
|
WARN(mcimidi, "SMPTE track start can only be expressed at start of track (%lu)\n", mmt->dwEventPulse);
|
||||||
} else {
|
} else {
|
||||||
BYTE h, m, s, f, ff;
|
BYTE h, m, s, f, ff;
|
||||||
|
|
||||||
MIDI_mciReadByte(wmm, &h);
|
MIDI_mciReadByte(wmm, &h);
|
||||||
MIDI_mciReadByte(wmm, &m);
|
MIDI_mciReadByte(wmm, &m);
|
||||||
MIDI_mciReadByte(wmm, &s);
|
MIDI_mciReadByte(wmm, &s);
|
||||||
|
@ -944,18 +945,18 @@ static DWORD MIDI_mciPlay(UINT16 wDevID, DWORD dwFlags, LPMCI_PLAY_PARMS lpParms
|
||||||
MIDI_mciReadByte(wmm, &num);
|
MIDI_mciReadByte(wmm, &num);
|
||||||
MIDI_mciReadByte(wmm, &den); /* to notate e.g. 6/8 */
|
MIDI_mciReadByte(wmm, &den); /* to notate e.g. 6/8 */
|
||||||
MIDI_mciReadByte(wmm, &cpmc); /* number of MIDI clocks per metronome click */
|
MIDI_mciReadByte(wmm, &cpmc); /* number of MIDI clocks per metronome click */
|
||||||
MIDI_mciReadByte(wmm, &_32npqn); /* number of notated 32nd notes per MIDI quarter note */
|
MIDI_mciReadByte(wmm, &_32npqn); /* number of notated 32nd notes per MIDI quarter note */
|
||||||
|
|
||||||
TRACE(mcimidi, "%u/%u, clock per metronome click=%u, 32nd notes by 1/4 note=%u\n", num, 1 << den, cpmc, _32npqn);
|
TRACE(mcimidi, "%u/%u, clock per metronome click=%u, 32nd notes by 1/4 note=%u\n", num, 1 << den, cpmc, _32npqn);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 0x59: /* key signature */
|
case 0x59: /* key signature */
|
||||||
if (TRACE_ON(mcimidi)) {
|
if (TRACE_ON(mcimidi)) {
|
||||||
BYTE sf, mm;
|
BYTE sf, mm;
|
||||||
|
|
||||||
MIDI_mciReadByte(wmm, &sf);
|
MIDI_mciReadByte(wmm, &sf);
|
||||||
MIDI_mciReadByte(wmm, &mm);
|
MIDI_mciReadByte(wmm, &mm);
|
||||||
|
|
||||||
if (sf >= 0x80) TRACE(mcimidi, "%d flats\n", -(char)sf);
|
if (sf >= 0x80) TRACE(mcimidi, "%d flats\n", -(char)sf);
|
||||||
else if (sf > 0) TRACE(mcimidi, "%d sharps\n", (char)sf);
|
else if (sf > 0) TRACE(mcimidi, "%d sharps\n", (char)sf);
|
||||||
else TRACE(mcimidi, "Key of C\n");
|
else TRACE(mcimidi, "Key of C\n");
|
||||||
|
@ -989,7 +990,7 @@ static DWORD MIDI_mciPlay(UINT16 wDevID, DWORD dwFlags, LPMCI_PLAY_PARMS lpParms
|
||||||
MIDI_mciReadNextEvent(wmm, mmt);
|
MIDI_mciReadNextEvent(wmm, mmt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* stop all notes */
|
/* stop all notes */
|
||||||
/* should be (0x7800 | MIDI_CTL_CHANGE) instead of 0x78B0,
|
/* should be (0x7800 | MIDI_CTL_CHANGE) instead of 0x78B0,
|
||||||
* but MIDI_CTL_CHANGE is defined in OSS's soundcard.h and MCI must compile
|
* but MIDI_CTL_CHANGE is defined in OSS's soundcard.h and MCI must compile
|
||||||
|
@ -1003,16 +1004,16 @@ static DWORD MIDI_mciPlay(UINT16 wDevID, DWORD dwFlags, LPMCI_PLAY_PARMS lpParms
|
||||||
for (chn = 0; chn < 16; chn++)
|
for (chn = 0; chn < 16; chn++)
|
||||||
modMessage(wDevID, MODM_DATA, 0, 0x78B0 | chn, 0);
|
modMessage(wDevID, MODM_DATA, 0, 0x78B0 | chn, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
wmm->dwStatus = MCI_MODE_STOP;
|
wmm->dwStatus = MCI_MODE_STOP;
|
||||||
|
|
||||||
/* to restart playing at beginning when it's over */
|
/* to restart playing at beginning when it's over */
|
||||||
wmm->dwPositionMS = 0;
|
wmm->dwPositionMS = 0;
|
||||||
|
|
||||||
if (lpParms && (dwFlags & MCI_NOTIFY)) {
|
if (lpParms && (dwFlags & MCI_NOTIFY)) {
|
||||||
TRACE(mcimidi, "MCI_NOTIFY_SUCCESSFUL %08lX !\n", lpParms->dwCallback);
|
TRACE(mcimidi, "MCI_NOTIFY_SUCCESSFUL %08lX !\n", lpParms->dwCallback);
|
||||||
mciDriverNotify16((HWND16)LOWORD(lpParms->dwCallback),
|
mciDriverNotify16((HWND16)LOWORD(lpParms->dwCallback),
|
||||||
wmm->wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
|
wmm->wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1028,9 +1029,9 @@ static DWORD MIDI_mciRecord(UINT16 wDevID, DWORD dwFlags, LPMCI_RECORD_PARMS lpP
|
||||||
WINE_MCIMIDI* wmm = MIDI_mciGetOpenDev(wDevID);
|
WINE_MCIMIDI* wmm = MIDI_mciGetOpenDev(wDevID);
|
||||||
|
|
||||||
TRACE(mcimidi, "(%04X, %08lX, %p);\n", wDevID, dwFlags, lpParms);
|
TRACE(mcimidi, "(%04X, %08lX, %p);\n", wDevID, dwFlags, lpParms);
|
||||||
|
|
||||||
if (wmm == 0) return MCIERR_INVALID_DEVICE_ID;
|
if (wmm == 0) return MCIERR_INVALID_DEVICE_ID;
|
||||||
|
|
||||||
if (wmm->hFile == 0) {
|
if (wmm->hFile == 0) {
|
||||||
WARN(mcimidi, "Can't find file='%08lx' !\n",
|
WARN(mcimidi, "Can't find file='%08lx' !\n",
|
||||||
(DWORD)wmm->openParms.lpstrElementName);
|
(DWORD)wmm->openParms.lpstrElementName);
|
||||||
|
@ -1073,7 +1074,7 @@ static DWORD MIDI_mciRecord(UINT16 wDevID, DWORD dwFlags, LPMCI_RECORD_PARMS lpP
|
||||||
if (lpParms && (dwFlags & MCI_NOTIFY)) {
|
if (lpParms && (dwFlags & MCI_NOTIFY)) {
|
||||||
TRACE(mcimidi, "MCI_NOTIFY_SUCCESSFUL %08lX !\n", lpParms->dwCallback);
|
TRACE(mcimidi, "MCI_NOTIFY_SUCCESSFUL %08lX !\n", lpParms->dwCallback);
|
||||||
mciDriverNotify16((HWND16)LOWORD(lpParms->dwCallback),
|
mciDriverNotify16((HWND16)LOWORD(lpParms->dwCallback),
|
||||||
wmm->wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
|
wmm->wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1084,11 +1085,11 @@ static DWORD MIDI_mciRecord(UINT16 wDevID, DWORD dwFlags, LPMCI_RECORD_PARMS lpP
|
||||||
static DWORD MIDI_mciPause(UINT16 wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
|
static DWORD MIDI_mciPause(UINT16 wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
|
||||||
{
|
{
|
||||||
WINE_MCIMIDI* wmm = MIDI_mciGetOpenDev(wDevID);
|
WINE_MCIMIDI* wmm = MIDI_mciGetOpenDev(wDevID);
|
||||||
|
|
||||||
TRACE(mcimidi, "(%04X, %08lX, %p);\n", wDevID, dwFlags, lpParms);
|
TRACE(mcimidi, "(%04X, %08lX, %p);\n", wDevID, dwFlags, lpParms);
|
||||||
|
|
||||||
if (wmm == NULL) return MCIERR_INVALID_DEVICE_ID;
|
if (wmm == NULL) return MCIERR_INVALID_DEVICE_ID;
|
||||||
|
|
||||||
if (wmm->dwStatus == MCI_MODE_PLAY) {
|
if (wmm->dwStatus == MCI_MODE_PLAY) {
|
||||||
/* stop all notes */
|
/* stop all notes */
|
||||||
/* see note in MIDI_mciPlay */
|
/* see note in MIDI_mciPlay */
|
||||||
|
@ -1100,9 +1101,9 @@ static DWORD MIDI_mciPause(UINT16 wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpP
|
||||||
if (lpParms && (dwFlags & MCI_NOTIFY)) {
|
if (lpParms && (dwFlags & MCI_NOTIFY)) {
|
||||||
TRACE(mcimidi, "MCI_NOTIFY_SUCCESSFUL %08lX !\n", lpParms->dwCallback);
|
TRACE(mcimidi, "MCI_NOTIFY_SUCCESSFUL %08lX !\n", lpParms->dwCallback);
|
||||||
mciDriverNotify16((HWND16)LOWORD(lpParms->dwCallback),
|
mciDriverNotify16((HWND16)LOWORD(lpParms->dwCallback),
|
||||||
wmm->wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
|
wmm->wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1112,11 +1113,11 @@ static DWORD MIDI_mciPause(UINT16 wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpP
|
||||||
static DWORD MIDI_mciResume(UINT16 wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
|
static DWORD MIDI_mciResume(UINT16 wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
|
||||||
{
|
{
|
||||||
WINE_MCIMIDI* wmm = MIDI_mciGetOpenDev(wDevID);
|
WINE_MCIMIDI* wmm = MIDI_mciGetOpenDev(wDevID);
|
||||||
|
|
||||||
TRACE(mcimidi, "(%04X, %08lX, %p);\n", wDevID, dwFlags, lpParms);
|
TRACE(mcimidi, "(%04X, %08lX, %p);\n", wDevID, dwFlags, lpParms);
|
||||||
|
|
||||||
if (wmm == NULL) return MCIERR_INVALID_DEVICE_ID;
|
if (wmm == NULL) return MCIERR_INVALID_DEVICE_ID;
|
||||||
|
|
||||||
if (wmm->dwStatus == MCI_MODE_PAUSE) {
|
if (wmm->dwStatus == MCI_MODE_PAUSE) {
|
||||||
wmm->wStartedPlaying = FALSE;
|
wmm->wStartedPlaying = FALSE;
|
||||||
wmm->dwStatus = MCI_MODE_PLAY;
|
wmm->dwStatus = MCI_MODE_PLAY;
|
||||||
|
@ -1124,7 +1125,7 @@ static DWORD MIDI_mciResume(UINT16 wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lp
|
||||||
if (lpParms && (dwFlags & MCI_NOTIFY)) {
|
if (lpParms && (dwFlags & MCI_NOTIFY)) {
|
||||||
TRACE(mcimidi, "MCI_NOTIFY_SUCCESSFUL %08lX !\n", lpParms->dwCallback);
|
TRACE(mcimidi, "MCI_NOTIFY_SUCCESSFUL %08lX !\n", lpParms->dwCallback);
|
||||||
mciDriverNotify16((HWND16)LOWORD(lpParms->dwCallback),
|
mciDriverNotify16((HWND16)LOWORD(lpParms->dwCallback),
|
||||||
wmm->wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
|
wmm->wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1135,12 +1136,12 @@ static DWORD MIDI_mciResume(UINT16 wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lp
|
||||||
static DWORD MIDI_mciSet(UINT16 wDevID, DWORD dwFlags, LPMCI_SET_PARMS lpParms)
|
static DWORD MIDI_mciSet(UINT16 wDevID, DWORD dwFlags, LPMCI_SET_PARMS lpParms)
|
||||||
{
|
{
|
||||||
WINE_MCIMIDI* wmm = MIDI_mciGetOpenDev(wDevID);
|
WINE_MCIMIDI* wmm = MIDI_mciGetOpenDev(wDevID);
|
||||||
|
|
||||||
TRACE(mcimidi, "(%04X, %08lX, %p);\n", wDevID, dwFlags, lpParms);
|
TRACE(mcimidi, "(%04X, %08lX, %p);\n", wDevID, dwFlags, lpParms);
|
||||||
|
|
||||||
if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
|
if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
|
||||||
if (wmm == NULL) return MCIERR_INVALID_DEVICE_ID;
|
if (wmm == NULL) return MCIERR_INVALID_DEVICE_ID;
|
||||||
|
|
||||||
if (dwFlags & MCI_SET_TIME_FORMAT) {
|
if (dwFlags & MCI_SET_TIME_FORMAT) {
|
||||||
switch (lpParms->dwTimeFormat) {
|
switch (lpParms->dwTimeFormat) {
|
||||||
case MCI_FORMAT_MILLISECONDS:
|
case MCI_FORMAT_MILLISECONDS:
|
||||||
|
@ -1185,7 +1186,7 @@ static DWORD MIDI_mciSet(UINT16 wDevID, DWORD dwFlags, LPMCI_SET_PARMS lpParms)
|
||||||
WARN(mcimidi, "MCI_SET_AUDIO without SET_ON or SET_OFF\n");
|
WARN(mcimidi, "MCI_SET_AUDIO without SET_ON or SET_OFF\n");
|
||||||
return MCIERR_BAD_INTEGER;
|
return MCIERR_BAD_INTEGER;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lpParms->dwAudio & MCI_SET_AUDIO_ALL)
|
if (lpParms->dwAudio & MCI_SET_AUDIO_ALL)
|
||||||
TRACE(mcimidi, "MCI_SET_AUDIO_ALL !\n");
|
TRACE(mcimidi, "MCI_SET_AUDIO_ALL !\n");
|
||||||
if (lpParms->dwAudio & MCI_SET_AUDIO_LEFT)
|
if (lpParms->dwAudio & MCI_SET_AUDIO_LEFT)
|
||||||
|
@ -1193,7 +1194,7 @@ static DWORD MIDI_mciSet(UINT16 wDevID, DWORD dwFlags, LPMCI_SET_PARMS lpParms)
|
||||||
if (lpParms->dwAudio & MCI_SET_AUDIO_RIGHT)
|
if (lpParms->dwAudio & MCI_SET_AUDIO_RIGHT)
|
||||||
TRACE(mcimidi, "MCI_SET_AUDIO_RIGHT !\n");
|
TRACE(mcimidi, "MCI_SET_AUDIO_RIGHT !\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dwFlags & MCI_SEQ_SET_MASTER)
|
if (dwFlags & MCI_SEQ_SET_MASTER)
|
||||||
TRACE(mcimidi, "MCI_SEQ_SET_MASTER !\n");
|
TRACE(mcimidi, "MCI_SEQ_SET_MASTER !\n");
|
||||||
if (dwFlags & MCI_SEQ_SET_SLAVE)
|
if (dwFlags & MCI_SEQ_SET_SLAVE)
|
||||||
|
@ -1213,12 +1214,12 @@ static DWORD MIDI_mciSet(UINT16 wDevID, DWORD dwFlags, LPMCI_SET_PARMS lpParms)
|
||||||
static DWORD MIDI_mciStatus(UINT16 wDevID, DWORD dwFlags, LPMCI_STATUS_PARMS lpParms)
|
static DWORD MIDI_mciStatus(UINT16 wDevID, DWORD dwFlags, LPMCI_STATUS_PARMS lpParms)
|
||||||
{
|
{
|
||||||
WINE_MCIMIDI* wmm = MIDI_mciGetOpenDev(wDevID);
|
WINE_MCIMIDI* wmm = MIDI_mciGetOpenDev(wDevID);
|
||||||
|
|
||||||
TRACE(mcimidi, "(%04X, %08lX, %p);\n", wDevID, dwFlags, lpParms);
|
TRACE(mcimidi, "(%04X, %08lX, %p);\n", wDevID, dwFlags, lpParms);
|
||||||
|
|
||||||
if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
|
if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
|
||||||
if (wmm == NULL) return MCIERR_INVALID_DEVICE_ID;
|
if (wmm == NULL) return MCIERR_INVALID_DEVICE_ID;
|
||||||
|
|
||||||
if (dwFlags & MCI_STATUS_ITEM) {
|
if (dwFlags & MCI_STATUS_ITEM) {
|
||||||
switch (lpParms->dwItem) {
|
switch (lpParms->dwItem) {
|
||||||
case MCI_STATUS_CURRENT_TRACK:
|
case MCI_STATUS_CURRENT_TRACK:
|
||||||
|
@ -1310,7 +1311,7 @@ static DWORD MIDI_mciStatus(UINT16 wDevID, DWORD dwFlags, LPMCI_STATUS_PARMS lpP
|
||||||
if (dwFlags & MCI_NOTIFY) {
|
if (dwFlags & MCI_NOTIFY) {
|
||||||
TRACE(mcimidi, "MCI_NOTIFY_SUCCESSFUL %08lX !\n", lpParms->dwCallback);
|
TRACE(mcimidi, "MCI_NOTIFY_SUCCESSFUL %08lX !\n", lpParms->dwCallback);
|
||||||
mciDriverNotify16((HWND16)LOWORD(lpParms->dwCallback),
|
mciDriverNotify16((HWND16)LOWORD(lpParms->dwCallback),
|
||||||
wmm->wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
|
wmm->wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1322,12 +1323,12 @@ static DWORD MIDI_mciGetDevCaps(UINT16 wDevID, DWORD dwFlags,
|
||||||
LPMCI_GETDEVCAPS_PARMS lpParms)
|
LPMCI_GETDEVCAPS_PARMS lpParms)
|
||||||
{
|
{
|
||||||
WINE_MCIMIDI* wmm = MIDI_mciGetOpenDev(wDevID);
|
WINE_MCIMIDI* wmm = MIDI_mciGetOpenDev(wDevID);
|
||||||
|
|
||||||
TRACE(mcimidi, "(%04X, %08lX, %p);\n", wDevID, dwFlags, lpParms);
|
TRACE(mcimidi, "(%04X, %08lX, %p);\n", wDevID, dwFlags, lpParms);
|
||||||
|
|
||||||
if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
|
if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
|
||||||
if (wmm == NULL) return MCIERR_INVALID_DEVICE_ID;
|
if (wmm == NULL) return MCIERR_INVALID_DEVICE_ID;
|
||||||
|
|
||||||
if (dwFlags & MCI_GETDEVCAPS_ITEM) {
|
if (dwFlags & MCI_GETDEVCAPS_ITEM) {
|
||||||
switch (lpParms->dwItem) {
|
switch (lpParms->dwItem) {
|
||||||
case MCI_GETDEVCAPS_DEVICE_TYPE:
|
case MCI_GETDEVCAPS_DEVICE_TYPE:
|
||||||
|
@ -1385,16 +1386,16 @@ static DWORD MIDI_mciInfo(UINT16 wDevID, DWORD dwFlags, LPMCI_INFO_PARMS32A lpPa
|
||||||
DWORD ret = 0;
|
DWORD ret = 0;
|
||||||
LPSTR str = 0;
|
LPSTR str = 0;
|
||||||
WINE_MCIMIDI* wmm = MIDI_mciGetOpenDev(wDevID);
|
WINE_MCIMIDI* wmm = MIDI_mciGetOpenDev(wDevID);
|
||||||
|
|
||||||
TRACE(mcimidi, "(%04X, %08lX, %p);\n", wDevID, dwFlags, lpParms);
|
TRACE(mcimidi, "(%04X, %08lX, %p);\n", wDevID, dwFlags, lpParms);
|
||||||
|
|
||||||
if (lpParms == NULL || lpParms->lpstrReturn == NULL) {
|
if (lpParms == NULL || lpParms->lpstrReturn == NULL) {
|
||||||
ret = MCIERR_NULL_PARAMETER_BLOCK;
|
ret = MCIERR_NULL_PARAMETER_BLOCK;
|
||||||
} else if (wmm == NULL) {
|
} else if (wmm == NULL) {
|
||||||
ret = MCIERR_INVALID_DEVICE_ID;
|
ret = MCIERR_INVALID_DEVICE_ID;
|
||||||
} else {
|
} else {
|
||||||
TRACE(mcimidi, "buf=%p, len=%lu\n", lpParms->lpstrReturn, lpParms->dwRetSize);
|
TRACE(mcimidi, "buf=%p, len=%lu\n", lpParms->lpstrReturn, lpParms->dwRetSize);
|
||||||
|
|
||||||
switch (dwFlags) {
|
switch (dwFlags) {
|
||||||
case MCI_INFO_PRODUCT:
|
case MCI_INFO_PRODUCT:
|
||||||
str = "Wine's MIDI sequencer";
|
str = "Wine's MIDI sequencer";
|
||||||
|
@ -1403,7 +1404,7 @@ static DWORD MIDI_mciInfo(UINT16 wDevID, DWORD dwFlags, LPMCI_INFO_PARMS32A lpPa
|
||||||
str = wmm->openParms.lpstrElementName;
|
str = wmm->openParms.lpstrElementName;
|
||||||
break;
|
break;
|
||||||
#if 0
|
#if 0
|
||||||
/* FIXME: the following manifest constants are not defined in <WINE>/include/mmsystem.h */
|
/* FIXME: the following manifest constants are not defined in <WINE>/include/mmsystem.h */
|
||||||
case MCI_INFO_COPYRIGHT:
|
case MCI_INFO_COPYRIGHT:
|
||||||
break;
|
break;
|
||||||
case MCI_INFO_NAME:
|
case MCI_INFO_NAME:
|
||||||
|
@ -1419,7 +1420,7 @@ static DWORD MIDI_mciInfo(UINT16 wDevID, DWORD dwFlags, LPMCI_INFO_PARMS32A lpPa
|
||||||
} else {
|
} else {
|
||||||
lpParms->lpstrReturn[0] = 0;
|
lpParms->lpstrReturn[0] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1430,9 +1431,9 @@ static DWORD MIDI_mciSeek(UINT16 wDevID, DWORD dwFlags, LPMCI_SEEK_PARMS lpParms
|
||||||
{
|
{
|
||||||
DWORD ret = 0;
|
DWORD ret = 0;
|
||||||
WINE_MCIMIDI* wmm = MIDI_mciGetOpenDev(wDevID);
|
WINE_MCIMIDI* wmm = MIDI_mciGetOpenDev(wDevID);
|
||||||
|
|
||||||
TRACE(mcimidi, "(%04X, %08lX, %p);\n", wDevID, dwFlags, lpParms);
|
TRACE(mcimidi, "(%04X, %08lX, %p);\n", wDevID, dwFlags, lpParms);
|
||||||
|
|
||||||
if (lpParms == NULL) {
|
if (lpParms == NULL) {
|
||||||
ret = MCIERR_NULL_PARAMETER_BLOCK;
|
ret = MCIERR_NULL_PARAMETER_BLOCK;
|
||||||
} else if (wmm == NULL) {
|
} else if (wmm == NULL) {
|
||||||
|
@ -1456,7 +1457,7 @@ static DWORD MIDI_mciSeek(UINT16 wDevID, DWORD dwFlags, LPMCI_SEEK_PARMS lpParms
|
||||||
if (dwFlags & MCI_NOTIFY) {
|
if (dwFlags & MCI_NOTIFY) {
|
||||||
TRACE(mcimidi, "MCI_NOTIFY_SUCCESSFUL %08lX !\n", lpParms->dwCallback);
|
TRACE(mcimidi, "MCI_NOTIFY_SUCCESSFUL %08lX !\n", lpParms->dwCallback);
|
||||||
mciDriverNotify16((HWND16)LOWORD(lpParms->dwCallback),
|
mciDriverNotify16((HWND16)LOWORD(lpParms->dwCallback),
|
||||||
wmm->wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
|
wmm->wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -1470,8 +1471,8 @@ static DWORD MIDI_mciSeek(UINT16 wDevID, DWORD dwFlags, LPMCI_SEEK_PARMS lpParms
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* MCIMIDI_DriverProc32 [sample driver]
|
* MCIMIDI_DriverProc32 [sample driver]
|
||||||
*/
|
*/
|
||||||
LONG MCIMIDI_DriverProc32(DWORD dwDevID, HDRVR16 hDriv, DWORD wMsg,
|
LONG WINAPI MCIMIDI_DriverProc32(DWORD dwDevID, HDRVR16 hDriv, DWORD wMsg,
|
||||||
DWORD dwParam1, DWORD dwParam2)
|
DWORD dwParam1, DWORD dwParam2)
|
||||||
{
|
{
|
||||||
switch (wMsg) {
|
switch (wMsg) {
|
||||||
case DRV_LOAD: return 1;
|
case DRV_LOAD: return 1;
|
||||||
|
@ -1481,7 +1482,7 @@ LONG MCIMIDI_DriverProc32(DWORD dwDevID, HDRVR16 hDriv, DWORD wMsg,
|
||||||
case DRV_ENABLE: return 1;
|
case DRV_ENABLE: return 1;
|
||||||
case DRV_DISABLE: return 1;
|
case DRV_DISABLE: return 1;
|
||||||
case DRV_QUERYCONFIGURE: return 1;
|
case DRV_QUERYCONFIGURE: return 1;
|
||||||
case DRV_CONFIGURE: MessageBox16(0, "Sample Midi Linux Driver !", "MMLinux Driver", MB_OK); return 1;
|
case DRV_CONFIGURE: MessageBox32A(0, "Sample Midi Linux Driver !", "MMLinux Driver", MB_OK); return 1;
|
||||||
case DRV_INSTALL: return DRVCNF_RESTART;
|
case DRV_INSTALL: return DRVCNF_RESTART;
|
||||||
case DRV_REMOVE: return DRVCNF_RESTART;
|
case DRV_REMOVE: return DRVCNF_RESTART;
|
||||||
#ifdef SNDCTL_MIDI_INFO
|
#ifdef SNDCTL_MIDI_INFO
|
||||||
|
@ -1540,4 +1541,4 @@ LONG MCIMIDI_DriverProc32(DWORD dwDevID, HDRVR16 hDriv, DWORD wMsg,
|
||||||
return MCIERR_UNRECOGNIZED_COMMAND;
|
return MCIERR_UNRECOGNIZED_COMMAND;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------*/
|
|
||||||
|
|
|
@ -178,21 +178,26 @@ static DWORD WAVE_mciOpen(UINT16 wDevID, DWORD dwFlags, LPMCI_WAVE_OPEN_PARMS32A
|
||||||
TRACE(mciwave, "wDevID=%04X (lpParams->wDeviceID=%08lX)\n", wDevID, dwDeviceID);
|
TRACE(mciwave, "wDevID=%04X (lpParams->wDeviceID=%08lX)\n", wDevID, dwDeviceID);
|
||||||
|
|
||||||
if (dwFlags & MCI_OPEN_ELEMENT) {
|
if (dwFlags & MCI_OPEN_ELEMENT) {
|
||||||
LPCSTR lpstrElementName;
|
if (dwFlags & MCI_OPEN_ELEMENT_ID) {
|
||||||
|
/* could it be that (DWORD)lpOpenParms->lpstrElementName
|
||||||
lpstrElementName = lpOpenParms->lpstrElementName;
|
* contains the hFile value ?
|
||||||
|
*/
|
||||||
/*FIXME : what should be done id wmw->hFile is already != 0, or the driver is playin' */
|
dwRet = MCIERR_UNRECOGNIZED_COMMAND;
|
||||||
TRACE(mciwave,"MCI_OPEN_ELEMENT '%s' !\n", lpstrElementName);
|
|
||||||
if (lpstrElementName && (strlen(lpstrElementName) > 0)) {
|
|
||||||
wmw->hFile = mmioOpen32A(lpstrElementName, NULL,
|
|
||||||
MMIO_ALLOCBUF | MMIO_READWRITE | MMIO_EXCLUSIVE);
|
|
||||||
if (wmw->hFile == 0) {
|
|
||||||
WARN(mciwave, "can't find file='%s' !\n", lpstrElementName);
|
|
||||||
return MCIERR_FILE_NOT_FOUND;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
wmw->hFile = 0;
|
LPCSTR lpstrElementName = lpOpenParms->lpstrElementName;
|
||||||
|
|
||||||
|
/*FIXME : what should be done id wmw->hFile is already != 0, or the driver is playin' */
|
||||||
|
TRACE(mciwave,"MCI_OPEN_ELEMENT '%s' !\n", lpstrElementName);
|
||||||
|
if (lpstrElementName && (strlen(lpstrElementName) > 0)) {
|
||||||
|
wmw->hFile = mmioOpen32A(lpstrElementName, NULL,
|
||||||
|
MMIO_ALLOCBUF | MMIO_READWRITE | MMIO_EXCLUSIVE);
|
||||||
|
if (wmw->hFile == 0) {
|
||||||
|
WARN(mciwave, "can't find file='%s' !\n", lpstrElementName);
|
||||||
|
dwRet = MCIERR_FILE_NOT_FOUND;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
wmw->hFile = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TRACE(mciwave,"hFile=%u\n", wmw->hFile);
|
TRACE(mciwave,"hFile=%u\n", wmw->hFile);
|
||||||
|
@ -203,15 +208,15 @@ static DWORD WAVE_mciOpen(UINT16 wDevID, DWORD dwFlags, LPMCI_WAVE_OPEN_PARMS32A
|
||||||
|
|
||||||
wmw->waveDesc.hWave = 0;
|
wmw->waveDesc.hWave = 0;
|
||||||
|
|
||||||
if (wmw->hFile != 0) {
|
if (dwRet == 0 && wmw->hFile != 0) {
|
||||||
MMCKINFO ckMainRIFF;
|
MMCKINFO ckMainRIFF;
|
||||||
|
|
||||||
if (mmioDescend(wmw->hFile, &ckMainRIFF, NULL, 0) != 0) {
|
if (mmioDescend(wmw->hFile, &ckMainRIFF, NULL, 0) != 0) {
|
||||||
dwRet = MCIERR_INVALID_FILE;
|
dwRet = MCIERR_INVALID_FILE;
|
||||||
} else {
|
} else {
|
||||||
TRACE(mciwave, "ParentChunk ckid=%.4s fccType=%.4s cksize=%08lX \n",
|
TRACE(mciwave, "ParentChunk ckid=%.4s fccType=%.4s cksize=%08lX \n",
|
||||||
(LPSTR)&ckMainRIFF.ckid, (LPSTR)&ckMainRIFF.fccType, ckMainRIFF.cksize);
|
(LPSTR)&ckMainRIFF.ckid, (LPSTR)&ckMainRIFF.fccType, ckMainRIFF.cksize);
|
||||||
if ((ckMainRIFF.ckid != FOURCC_RIFF) ||
|
if ((ckMainRIFF.ckid != FOURCC_RIFF) ||
|
||||||
(ckMainRIFF.fccType != mmioFOURCC('W', 'A', 'V', 'E'))) {
|
(ckMainRIFF.fccType != mmioFOURCC('W', 'A', 'V', 'E'))) {
|
||||||
dwRet = MCIERR_INVALID_FILE;
|
dwRet = MCIERR_INVALID_FILE;
|
||||||
} else {
|
} else {
|
||||||
|
@ -222,16 +227,16 @@ static DWORD WAVE_mciOpen(UINT16 wDevID, DWORD dwFlags, LPMCI_WAVE_OPEN_PARMS32A
|
||||||
wmw->dwLength = 0;
|
wmw->dwLength = 0;
|
||||||
}
|
}
|
||||||
if (dwRet == 0) {
|
if (dwRet == 0) {
|
||||||
wmw->WaveFormat.wf.nAvgBytesPerSec =
|
wmw->WaveFormat.wf.nAvgBytesPerSec =
|
||||||
wmw->WaveFormat.wf.nSamplesPerSec * wmw->WaveFormat.wf.nBlockAlign;
|
wmw->WaveFormat.wf.nSamplesPerSec * wmw->WaveFormat.wf.nBlockAlign;
|
||||||
wmw->waveDesc.lpFormat = (LPWAVEFORMAT)&wmw->WaveFormat;
|
wmw->waveDesc.lpFormat = (LPWAVEFORMAT)&wmw->WaveFormat;
|
||||||
wmw->dwPosition = 0;
|
wmw->dwPosition = 0;
|
||||||
|
|
||||||
/* By default the device will be opened for output, the MCI_CUE function is there to
|
/* By default the device will be opened for output, the MCI_CUE function is there to
|
||||||
* change from output to input and back
|
* change from output to input and back
|
||||||
*/
|
*/
|
||||||
dwRet = wodMessage(wDevID, WODM_OPEN, 0, (DWORD)&wmw->waveDesc, CALLBACK_NULL);
|
dwRet = wodMessage(wDevID, WODM_OPEN, 0, (DWORD)&wmw->waveDesc, CALLBACK_NULL);
|
||||||
wmw->dwStatus = MCI_MODE_STOP;
|
wmw->dwStatus = MCI_MODE_STOP;
|
||||||
} else {
|
} else {
|
||||||
wmw->nUseCount--;
|
wmw->nUseCount--;
|
||||||
if (wmw->hFile != 0)
|
if (wmw->hFile != 0)
|
||||||
|
@ -757,8 +762,7 @@ static DWORD WAVE_mciStatus(UINT16 wDevID, DWORD dwFlags, LPMCI_STATUS_PARMS lpP
|
||||||
TRACE(mciwave,"MCI_WAVE_STATUS_CHANNELS => %lu!\n", lpParms->dwReturn);
|
TRACE(mciwave,"MCI_WAVE_STATUS_CHANNELS => %lu!\n", lpParms->dwReturn);
|
||||||
break;
|
break;
|
||||||
case MCI_WAVE_STATUS_FORMATTAG:
|
case MCI_WAVE_STATUS_FORMATTAG:
|
||||||
lpParms->dwReturn = wmw->WaveFormat.wf.
|
lpParms->dwReturn = wmw->WaveFormat.wf.wFormatTag;
|
||||||
wFormatTag;
|
|
||||||
TRACE(mciwave,"MCI_WAVE_FORMATTAG => %lu!\n", lpParms->dwReturn);
|
TRACE(mciwave,"MCI_WAVE_FORMATTAG => %lu!\n", lpParms->dwReturn);
|
||||||
break;
|
break;
|
||||||
case MCI_WAVE_STATUS_LEVEL:
|
case MCI_WAVE_STATUS_LEVEL:
|
||||||
|
@ -871,7 +875,7 @@ static DWORD WAVE_mciInfo(UINT16 wDevID, DWORD dwFlags, LPMCI_INFO_PARMS16 lpPar
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
WARN(mciwave, "Don't know this info command (%lu)\n", dwFlags);
|
WARN(mciwave, "Don't know this info command (%lu)\n", dwFlags);
|
||||||
return MCIERR_UNRECOGNIZED_COMMAND;
|
ret = MCIERR_UNRECOGNIZED_COMMAND;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (str) {
|
if (str) {
|
||||||
|
@ -904,7 +908,7 @@ LONG MCIWAVE_DriverProc32(DWORD dwDevID, HDRVR16 hDriv, DWORD wMsg,
|
||||||
case DRV_ENABLE: return 1;
|
case DRV_ENABLE: return 1;
|
||||||
case DRV_DISABLE: return 1;
|
case DRV_DISABLE: return 1;
|
||||||
case DRV_QUERYCONFIGURE: return 1;
|
case DRV_QUERYCONFIGURE: return 1;
|
||||||
case DRV_CONFIGURE: MessageBox16(0, "Sample MultiMedia Linux Driver !", "MMLinux Driver", MB_OK); return 1;
|
case DRV_CONFIGURE: MessageBox32A(0, "Sample MultiMedia Linux Driver !", "MMLinux Driver", MB_OK); return 1;
|
||||||
case DRV_INSTALL: return DRVCNF_RESTART;
|
case DRV_INSTALL: return DRVCNF_RESTART;
|
||||||
case DRV_REMOVE: return DRVCNF_RESTART;
|
case DRV_REMOVE: return DRVCNF_RESTART;
|
||||||
case MCI_OPEN_DRIVER: return WAVE_mciOpen (dwDevID, dwParam1, (LPMCI_WAVE_OPEN_PARMS32A)dwParam2);
|
case MCI_OPEN_DRIVER: return WAVE_mciOpen (dwDevID, dwParam1, (LPMCI_WAVE_OPEN_PARMS32A)dwParam2);
|
||||||
|
|
|
@ -1541,12 +1541,12 @@ LONG MIDI_DriverProc32(DWORD dwDevID, HDRVR16 hDriv, DWORD wMsg,
|
||||||
case DRV_ENABLE: return 1;
|
case DRV_ENABLE: return 1;
|
||||||
case DRV_DISABLE: return 1;
|
case DRV_DISABLE: return 1;
|
||||||
case DRV_QUERYCONFIGURE: return 1;
|
case DRV_QUERYCONFIGURE: return 1;
|
||||||
case DRV_CONFIGURE: MessageBox16(0, "Sample Midi Linux Driver !", "MMLinux Driver", MB_OK); return 1;
|
case DRV_CONFIGURE: MessageBox32A(0, "Sample Midi Linux Driver !", "MMLinux Driver", MB_OK); return 1;
|
||||||
case DRV_INSTALL: return DRVCNF_RESTART;
|
case DRV_INSTALL: return DRVCNF_RESTART;
|
||||||
case DRV_REMOVE: return DRVCNF_RESTART;
|
case DRV_REMOVE: return DRVCNF_RESTART;
|
||||||
default:
|
default:
|
||||||
TRACE(midi, "Sending msg=%lu to default driver proc\n", wMsg);
|
TRACE(midi, "Sending msg=%lu to default driver proc\n", wMsg);
|
||||||
return DefDriverProc32(dwDevID, hDriv, wMsg, dwParam1, dwParam2);
|
return DefDriverProc16(dwDevID, hDriv, wMsg, dwParam1, dwParam2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1564,7 +1564,7 @@ LONG MIDI_DriverProc16(DWORD dwDevID, HDRVR16 hDriv, WORD wMsg,
|
||||||
case DRV_ENABLE: return 1;
|
case DRV_ENABLE: return 1;
|
||||||
case DRV_DISABLE: return 1;
|
case DRV_DISABLE: return 1;
|
||||||
case DRV_QUERYCONFIGURE: return 1;
|
case DRV_QUERYCONFIGURE: return 1;
|
||||||
case DRV_CONFIGURE: MessageBox16(0, "Sample Midi Linux Driver !", "MMLinux Driver", MB_OK); return 1;
|
case DRV_CONFIGURE: MessageBox32A(0, "Sample Midi Linux Driver !", "MMLinux Driver", MB_OK); return 1;
|
||||||
case DRV_INSTALL: return DRVCNF_RESTART;
|
case DRV_INSTALL: return DRVCNF_RESTART;
|
||||||
case DRV_REMOVE: return DRVCNF_RESTART;
|
case DRV_REMOVE: return DRVCNF_RESTART;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -24,8 +24,8 @@ static DWORD MIX_GetDevCaps(WORD wDevID, LPMIXERCAPS16 lpCaps, DWORD dwSize)
|
||||||
#ifdef HAVE_OSS
|
#ifdef HAVE_OSS
|
||||||
int mixer,mask;
|
int mixer,mask;
|
||||||
|
|
||||||
TRACE(mmaux,"(%04X, %p, %lu);\n", wDevID, lpCaps, dwSize);
|
TRACE(mmaux, "(%04X, %p, %lu);\n", wDevID, lpCaps, dwSize);
|
||||||
if (lpCaps == NULL) return MMSYSERR_NOTENABLED;
|
if (lpCaps == NULL) return MMSYSERR_INVALPARAM;
|
||||||
if ((mixer = open(MIXER_DEV, O_RDWR)) < 0) {
|
if ((mixer = open(MIXER_DEV, O_RDWR)) < 0) {
|
||||||
WARN(mmaux, "mixer device not available !\n");
|
WARN(mmaux, "mixer device not available !\n");
|
||||||
return MMSYSERR_NOTENABLED;
|
return MMSYSERR_NOTENABLED;
|
||||||
|
@ -33,7 +33,7 @@ static DWORD MIX_GetDevCaps(WORD wDevID, LPMIXERCAPS16 lpCaps, DWORD dwSize)
|
||||||
lpCaps->wMid = 0xAA;
|
lpCaps->wMid = 0xAA;
|
||||||
lpCaps->wPid = 0x55;
|
lpCaps->wPid = 0x55;
|
||||||
lpCaps->vDriverVersion = 0x0100;
|
lpCaps->vDriverVersion = 0x0100;
|
||||||
strcpy(lpCaps->szPname,"WINE Generic Mixer");
|
strcpy(lpCaps->szPname, "WINE Generic Mixer");
|
||||||
if (ioctl(mixer, SOUND_MIXER_READ_DEVMASK, &mask) == -1) {
|
if (ioctl(mixer, SOUND_MIXER_READ_DEVMASK, &mask) == -1) {
|
||||||
close(mixer);
|
close(mixer);
|
||||||
perror("ioctl mixer SOUND_MIXER_DEVMASK");
|
perror("ioctl mixer SOUND_MIXER_DEVMASK");
|
||||||
|
@ -53,6 +53,41 @@ static DWORD MIX_GetDevCaps(WORD wDevID, LPMIXERCAPS16 lpCaps, DWORD dwSize)
|
||||||
#ifdef HAVE_OSS
|
#ifdef HAVE_OSS
|
||||||
static char *sdlabels[SOUND_MIXER_NRDEVICES] = SOUND_DEVICE_LABELS;
|
static char *sdlabels[SOUND_MIXER_NRDEVICES] = SOUND_DEVICE_LABELS;
|
||||||
static char *sdnames[SOUND_MIXER_NRDEVICES] = SOUND_DEVICE_NAMES;
|
static char *sdnames[SOUND_MIXER_NRDEVICES] = SOUND_DEVICE_NAMES;
|
||||||
|
|
||||||
|
static void MIX_GetLineInfoFromIndex(LPMIXERLINE16 lpml, int devmask, DWORD idx)
|
||||||
|
{
|
||||||
|
strcpy(lpml->szShortName, sdlabels[idx]);
|
||||||
|
strcpy(lpml->szName, sdnames[idx]);
|
||||||
|
lpml->dwLineID = idx;
|
||||||
|
lpml->dwDestination = 0; /* index for speakers */
|
||||||
|
lpml->cConnections = 1;
|
||||||
|
lpml->cControls = 1;
|
||||||
|
switch (idx) {
|
||||||
|
case SOUND_MIXER_SYNTH:
|
||||||
|
lpml->dwComponentType = MIXERLINE_COMPONENTTYPE_SRC_SYNTHESIZER;
|
||||||
|
lpml->fdwLine |= MIXERLINE_LINEF_SOURCE;
|
||||||
|
break;
|
||||||
|
case SOUND_MIXER_CD:
|
||||||
|
lpml->dwComponentType = MIXERLINE_COMPONENTTYPE_SRC_COMPACTDISC;
|
||||||
|
lpml->fdwLine |= MIXERLINE_LINEF_SOURCE;
|
||||||
|
break;
|
||||||
|
case SOUND_MIXER_LINE:
|
||||||
|
lpml->dwComponentType = MIXERLINE_COMPONENTTYPE_SRC_LINE;
|
||||||
|
lpml->fdwLine |= MIXERLINE_LINEF_SOURCE;
|
||||||
|
break;
|
||||||
|
case SOUND_MIXER_MIC:
|
||||||
|
lpml->dwComponentType = MIXERLINE_COMPONENTTYPE_SRC_MICROPHONE;
|
||||||
|
lpml->fdwLine |= MIXERLINE_LINEF_SOURCE;
|
||||||
|
break;
|
||||||
|
case SOUND_MIXER_PCM:
|
||||||
|
lpml->dwComponentType = MIXERLINE_COMPONENTTYPE_SRC_WAVEOUT;
|
||||||
|
lpml->fdwLine |= MIXERLINE_LINEF_SOURCE;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
ERR(mmaux, "Index %ld not handled.\n", idx);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
|
@ -61,10 +96,12 @@ static char *sdnames[SOUND_MIXER_NRDEVICES] = SOUND_DEVICE_NAMES;
|
||||||
static DWORD MIX_GetLineInfo(WORD wDevID, LPMIXERLINE16 lpml, DWORD fdwInfo)
|
static DWORD MIX_GetLineInfo(WORD wDevID, LPMIXERLINE16 lpml, DWORD fdwInfo)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_OSS
|
#ifdef HAVE_OSS
|
||||||
int mixer,i,j,devmask,recsrc,recmask;
|
int mixer, i, j, devmask, recsrc, recmask;
|
||||||
|
DWORD ret = MMSYSERR_NOERROR;
|
||||||
|
|
||||||
TRACE(mmaux,"(%04X, %p, %lu);\n", wDevID, lpml, fdwInfo);
|
TRACE(mmaux, "(%04X, %p, %lu);\n", wDevID, lpml, fdwInfo);
|
||||||
if (lpml == NULL) return MMSYSERR_NOTENABLED;
|
if (lpml == NULL || lpml->cbStruct != sizeof(*lpml))
|
||||||
|
return MMSYSERR_INVALPARAM;
|
||||||
if ((mixer = open(MIXER_DEV, O_RDWR)) < 0)
|
if ((mixer = open(MIXER_DEV, O_RDWR)) < 0)
|
||||||
return MMSYSERR_NOTENABLED;
|
return MMSYSERR_NOTENABLED;
|
||||||
|
|
||||||
|
@ -83,12 +120,12 @@ static DWORD MIX_GetLineInfo(WORD wDevID, LPMIXERLINE16 lpml, DWORD fdwInfo)
|
||||||
perror("ioctl mixer SOUND_MIXER_RECMASK");
|
perror("ioctl mixer SOUND_MIXER_RECMASK");
|
||||||
return MMSYSERR_NOTENABLED;
|
return MMSYSERR_NOTENABLED;
|
||||||
}
|
}
|
||||||
lpml->cbStruct = sizeof(MIXERLINE16);
|
|
||||||
/* FIXME: set all the variables correctly... the lines below
|
/* FIXME: set all the variables correctly... the lines below
|
||||||
* are very wrong...
|
* are very wrong...
|
||||||
*/
|
*/
|
||||||
lpml->fdwLine = MIXERLINE_LINEF_ACTIVE;
|
lpml->fdwLine = MIXERLINE_LINEF_ACTIVE;
|
||||||
lpml->cChannels = 2;
|
lpml->cChannels = 2;
|
||||||
|
|
||||||
switch (fdwInfo & MIXER_GETLINEINFOF_QUERYMASK) {
|
switch (fdwInfo & MIXER_GETLINEINFOF_QUERYMASK) {
|
||||||
case MIXER_GETLINEINFOF_DESTINATION:
|
case MIXER_GETLINEINFOF_DESTINATION:
|
||||||
|
@ -103,55 +140,63 @@ static DWORD MIX_GetLineInfo(WORD wDevID, LPMIXERLINE16 lpml, DWORD fdwInfo)
|
||||||
lpml->cConnections++;
|
lpml->cConnections++;
|
||||||
break;
|
break;
|
||||||
case MIXER_GETLINEINFOF_SOURCE:
|
case MIXER_GETLINEINFOF_SOURCE:
|
||||||
for (i=j=0;j<31;j++) {
|
for (i = j = 0; j < 31; j++) {
|
||||||
if (devmask & (1<<j)) {
|
if (devmask & (1 << j)) {
|
||||||
if (lpml->dwSource == i)
|
if (lpml->dwSource == i)
|
||||||
break;
|
break;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
strcpy(lpml->szShortName,sdlabels[i]);
|
MIX_GetLineInfoFromIndex(lpml, devmask, i);
|
||||||
strcpy(lpml->szName,sdnames[i]);
|
|
||||||
lpml->dwLineID = i;
|
|
||||||
switch (i) {
|
|
||||||
case SOUND_MIXER_SYNTH:
|
|
||||||
lpml->dwComponentType = MIXERLINE_COMPONENTTYPE_SRC_SYNTHESIZER;
|
|
||||||
lpml->fdwLine |= MIXERLINE_LINEF_SOURCE;
|
|
||||||
break;
|
|
||||||
case SOUND_MIXER_CD:
|
|
||||||
lpml->dwComponentType = MIXERLINE_COMPONENTTYPE_SRC_COMPACTDISC;
|
|
||||||
lpml->fdwLine |= MIXERLINE_LINEF_SOURCE;
|
|
||||||
break;
|
|
||||||
case SOUND_MIXER_LINE:
|
|
||||||
lpml->dwComponentType = MIXERLINE_COMPONENTTYPE_SRC_LINE;
|
|
||||||
lpml->fdwLine |= MIXERLINE_LINEF_SOURCE;
|
|
||||||
break;
|
|
||||||
case SOUND_MIXER_MIC:
|
|
||||||
lpml->dwComponentType = MIXERLINE_COMPONENTTYPE_SRC_MICROPHONE;
|
|
||||||
lpml->fdwLine |= MIXERLINE_LINEF_SOURCE;
|
|
||||||
break;
|
|
||||||
case SOUND_MIXER_PCM:
|
|
||||||
lpml->dwComponentType = MIXERLINE_COMPONENTTYPE_SRC_WAVEOUT;
|
|
||||||
lpml->fdwLine |= MIXERLINE_LINEF_SOURCE;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
ERR(mmaux,"Mixertype %d not handle.\n",i);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case MIXER_GETLINEINFOF_LINEID:
|
case MIXER_GETLINEINFOF_LINEID:
|
||||||
FIXME(mmaux,"_LINEID (%ld) not implemented yet.\n",lpml->dwLineID);
|
MIX_GetLineInfoFromIndex(lpml, devmask, lpml->dwLineID);
|
||||||
break;
|
break;
|
||||||
case MIXER_GETLINEINFOF_COMPONENTTYPE:
|
case MIXER_GETLINEINFOF_COMPONENTTYPE:
|
||||||
FIXME(mmaux," _COMPONENTTYPE not implemented yet.\n");
|
TRACE(mmaux, "Getting component type (%08lx)\n", lpml->dwComponentType);
|
||||||
|
switch (lpml->dwComponentType) {
|
||||||
|
case MIXERLINE_COMPONENTTYPE_DST_SPEAKERS:
|
||||||
|
i = -1;
|
||||||
|
break;
|
||||||
|
case MIXERLINE_COMPONENTTYPE_SRC_SYNTHESIZER:
|
||||||
|
i = SOUND_MIXER_SYNTH;
|
||||||
|
break;
|
||||||
|
case MIXERLINE_COMPONENTTYPE_SRC_COMPACTDISC:
|
||||||
|
i = SOUND_MIXER_CD;
|
||||||
|
break;
|
||||||
|
case MIXERLINE_COMPONENTTYPE_SRC_LINE:
|
||||||
|
i = SOUND_MIXER_LINE;
|
||||||
|
break;
|
||||||
|
case MIXERLINE_COMPONENTTYPE_SRC_MICROPHONE:
|
||||||
|
i = SOUND_MIXER_MIC;
|
||||||
|
break;
|
||||||
|
case MIXERLINE_COMPONENTTYPE_SRC_WAVEOUT:
|
||||||
|
i = SOUND_MIXER_PCM;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
FIXME(mmaux, "Unhandled component type (%08lx)\n", lpml->dwComponentType);
|
||||||
|
return MMSYSERR_INVALPARAM;
|
||||||
|
}
|
||||||
|
if (i != -1 && (devmask & (1 << i))) {
|
||||||
|
strcpy(lpml->szShortName, sdlabels[i]);
|
||||||
|
strcpy(lpml->szName, sdnames[i]);
|
||||||
|
lpml->dwLineID = i;
|
||||||
|
lpml->fdwLine = MIXERLINE_LINEF_SOURCE;
|
||||||
|
} else {
|
||||||
|
lpml->cConnections = 0;
|
||||||
|
for (j=0;j<31;j++)
|
||||||
|
if (devmask & (1<<j))
|
||||||
|
lpml->cConnections++;
|
||||||
|
lpml->dwLineID = 32;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case MIXER_GETLINEINFOF_TARGETTYPE:
|
case MIXER_GETLINEINFOF_TARGETTYPE:
|
||||||
FIXME(mmaux,"_TARGETTYPE not implemented yet.\n");
|
FIXME(mmaux, "_TARGETTYPE not implemented yet.\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
lpml->Target.dwType = MIXERLINE_TARGETTYPE_AUX;
|
lpml->Target.dwType = MIXERLINE_TARGETTYPE_AUX;
|
||||||
close(mixer);
|
close(mixer);
|
||||||
return MMSYSERR_NOERROR;
|
return ret;
|
||||||
#else
|
#else
|
||||||
return MMSYSERR_NOTENABLED;
|
return MMSYSERR_NOTENABLED;
|
||||||
#endif
|
#endif
|
||||||
|
@ -164,8 +209,8 @@ static DWORD MIX_Open(WORD wDevID, LPMIXEROPENDESC lpmod, DWORD flags)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_OSS
|
#ifdef HAVE_OSS
|
||||||
|
|
||||||
TRACE(mmaux,"(%04X, %p, %lu);\n",wDevID,lpmod,flags);
|
TRACE(mmaux, "(%04X, %p, %lu);\n", wDevID,lpmod,flags);
|
||||||
if (lpmod == NULL) return MMSYSERR_NOTENABLED;
|
if (lpmod == NULL) return MMSYSERR_INVALPARAM;
|
||||||
/* hmm. We don't keep the mixer device open. So just pretend it works */
|
/* hmm. We don't keep the mixer device open. So just pretend it works */
|
||||||
return MMSYSERR_NOERROR;
|
return MMSYSERR_NOERROR;
|
||||||
#else
|
#else
|
||||||
|
@ -177,22 +222,25 @@ static DWORD MIX_Open(WORD wDevID, LPMIXEROPENDESC lpmod, DWORD flags)
|
||||||
* mixMessage [sample driver]
|
* mixMessage [sample driver]
|
||||||
*/
|
*/
|
||||||
DWORD WINAPI mixMessage(WORD wDevID, WORD wMsg, DWORD dwUser,
|
DWORD WINAPI mixMessage(WORD wDevID, WORD wMsg, DWORD dwUser,
|
||||||
DWORD dwParam1, DWORD dwParam2)
|
DWORD dwParam1, DWORD dwParam2)
|
||||||
{
|
{
|
||||||
TRACE(mmaux,"(%04X, %04X, %08lX, %08lX, %08lX);\n",
|
TRACE(mmaux, "(%04X, %04X, %08lX, %08lX, %08lX);\n",
|
||||||
wDevID, wMsg, dwUser, dwParam1, dwParam2);
|
wDevID, wMsg, dwUser, dwParam1, dwParam2);
|
||||||
|
|
||||||
switch(wMsg) {
|
switch(wMsg) {
|
||||||
case MXDM_GETDEVCAPS:
|
case MXDM_GETDEVCAPS:
|
||||||
return MIX_GetDevCaps(wDevID,(LPMIXERCAPS16)dwParam1,dwParam2);
|
return MIX_GetDevCaps(wDevID, (LPMIXERCAPS16)dwParam1, dwParam2);
|
||||||
case MXDM_GETLINEINFO:
|
case MXDM_GETLINEINFO:
|
||||||
return MIX_GetLineInfo(wDevID,(LPMIXERLINE16)dwParam1,dwParam2);
|
return MIX_GetLineInfo(wDevID, (LPMIXERLINE16)dwParam1, dwParam2);
|
||||||
case MXDM_GETNUMDEVS:
|
case MXDM_GETNUMDEVS:
|
||||||
TRACE(mmsys,"return 1;\n");
|
TRACE(mmaux, "return 1;\n");
|
||||||
return 1;
|
return 1;
|
||||||
case MXDM_OPEN:
|
case MXDM_OPEN:
|
||||||
return MIX_Open(wDevID,(LPMIXEROPENDESC)dwParam1,dwParam2);
|
return MIX_Open(wDevID, (LPMIXEROPENDESC)dwParam1, dwParam2);
|
||||||
|
case MXDM_CLOSE:
|
||||||
|
return MMSYSERR_NOERROR;
|
||||||
default:
|
default:
|
||||||
WARN(mmaux,"unknown message %d!\n",wMsg);
|
WARN(mmaux, "unknown message %d!\n", wMsg);
|
||||||
}
|
}
|
||||||
return MMSYSERR_NOTSUPPORTED;
|
return MMSYSERR_NOTSUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -136,7 +136,7 @@ type win32
|
||||||
133 stdcall mmioWrite(long ptr long) mmioWrite32
|
133 stdcall mmioWrite(long ptr long) mmioWrite32
|
||||||
134 stdcall mmsystemGetVersion() mmsystemGetVersion32
|
134 stdcall mmsystemGetVersion() mmsystemGetVersion32
|
||||||
135 stdcall sndPlaySoundA(ptr long) sndPlaySound
|
135 stdcall sndPlaySoundA(ptr long) sndPlaySound
|
||||||
136 stub sndPlaySoundW
|
136 stdcall sndPlaySoundW(ptr long) sndPlaySound32W
|
||||||
137 stdcall timeBeginPeriod(long) timeBeginPeriod32
|
137 stdcall timeBeginPeriod(long) timeBeginPeriod32
|
||||||
138 stdcall timeEndPeriod(long) timeEndPeriod32
|
138 stdcall timeEndPeriod(long) timeEndPeriod32
|
||||||
139 stdcall timeGetDevCaps(ptr long) timeGetDevCaps32
|
139 stdcall timeGetDevCaps(ptr long) timeGetDevCaps32
|
||||||
|
|
Loading…
Reference in New Issue