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:
Eric Pouech 1999-02-13 12:38:09 +00:00 committed by Alexandre Julliard
parent 6ccda0d582
commit c11b167f62
12 changed files with 1039 additions and 602 deletions

View File

@ -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

View File

@ -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",

View File

@ -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 */

View File

@ -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 \

View File

@ -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;

316
multimedia/mciavi.c Normal file
View File

@ -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;
}

View File

@ -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];
/*======================================================================* /*======================================================================*
@ -225,9 +226,9 @@ static DWORD MIDI_mciReadNextEvent(WINE_MCIMIDI* wmm, MCI_MIDITRACK* mmt)
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;
} }
@ -330,7 +331,7 @@ 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 */
@ -371,7 +372,7 @@ 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;
} }
@ -607,22 +608,22 @@ static DWORD MIDI_mciOpen(UINT16 wDevID, DWORD dwFlags, LPMCI_OPEN_PARMS32A lpPa
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;
} }
@ -708,7 +709,7 @@ static DWORD MIDI_mciClose(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;
} }
@ -944,7 +945,7 @@ 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);
} }
@ -1012,7 +1013,7 @@ static DWORD MIDI_mciPlay(UINT16 wDevID, DWORD dwFlags, LPMCI_PLAY_PARMS lpParms
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;
} }
@ -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;
} }
@ -1100,7 +1101,7 @@ 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;
@ -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;
} }
@ -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;
} }
@ -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:
@ -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;
} }
/*-----------------------------------------------------------------------*/

View File

@ -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);

View File

@ -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:

View File

@ -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

View File

@ -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