Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
139f8fca
Commit
139f8fca
authored
Sep 05, 1999
by
Eric Pouech
Committed by
Alexandre Julliard
Sep 05, 1999
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated to new MM header organization.
Cleaned-up internal structures (now 32 bit only). Now using the MMSYSTEM entry points rather than the low level driver ones directly.
parent
7004766e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
126 additions
and
164 deletions
+126
-164
mcimidi.c
multimedia/mcimidi.c
+64
-93
mciwave.c
multimedia/mciwave.c
+62
-71
No files found.
multimedia/mcimidi.c
View file @
139f8fca
...
...
@@ -3,7 +3,8 @@
/*
* Sample MIDI Wine Driver for Linux
*
* Copyright 1994 Martin Ayotte
* Copyright 1994 Martin Ayotte
* 1999 Eric Pouech
*/
/*
...
...
@@ -16,15 +17,15 @@
#include <stdlib.h>
#include "winuser.h"
#include "multimedia.h"
#include "user.h"
#include "mmddk.h"
#include "driver.h"
#include "heap.h"
#include "debugtools.h"
DEFAULT_DEBUG_CHANNEL
(
mcimidi
)
#ifdef SNDCTL_MIDI_INFO
#define MIDI_NOTEOFF 0x80
#define MIDI_NOTEON 0x90
typedef
struct
{
DWORD
dwFirst
;
/* offset in file of track */
...
...
@@ -40,14 +41,13 @@ typedef struct {
}
MCI_MIDITRACK
;
typedef
struct
tagWINE_MCIMIDI
{
UINT
16
wDevID
;
UINT16
wMidiID
;
UINT
wDevID
;
HMIDI
hMidi
;
int
nUseCount
;
/* Incremented for each shared open */
WORD
wNotifyDeviceID
;
/* MCI device ID with a pending notification */
HANDLE
16
hCallback
;
/* Callback handle for pending notification */
HANDLE
hCallback
;
/* Callback handle for pending notification */
HMMIO
hFile
;
/* mmio file handle open as Element */
LPCSTR
lpstrElementName
;
/* Name of file */
HLOCAL16
hMidiHdr
;
WORD
dwStatus
;
/* one from MCI_MODE_xxxx */
DWORD
dwMciTimeFormat
;
/* One of the supported MCI_FORMAT_xxxx */
WORD
wFormat
;
/* Format of MIDI hFile (0, 1 or 2) */
...
...
@@ -61,16 +61,11 @@ typedef struct tagWINE_MCIMIDI {
DWORD
dwStartTicks
;
}
WINE_MCIMIDI
;
#endif
/* defined(SNDCTL_MIDI_INFO) */
/*======================================================================*
* MCI MIDI implemantation *
*======================================================================*/
#ifdef SNDCTL_MIDI_INFO
static
DWORD
MIDI_mciResume
(
UINT16
wDevID
,
DWORD
dwFlags
,
LPMCI_GENERIC_PARMS
lpParms
);
static
DWORD
MIDI_mciResume
(
UINT
wDevID
,
DWORD
dwFlags
,
LPMCI_GENERIC_PARMS
lpParms
);
/**************************************************************************
* MIDI_drvOpen [internal]
...
...
@@ -107,7 +102,7 @@ static DWORD MIDI_drvClose(DWORD dwDevID)
/**************************************************************************
* MIDI_mciGetOpenDev [internal]
*/
static
WINE_MCIMIDI
*
MIDI_mciGetOpenDev
(
UINT
16
wDevID
)
static
WINE_MCIMIDI
*
MIDI_mciGetOpenDev
(
UINT
wDevID
)
{
WINE_MCIMIDI
*
wmm
=
(
WINE_MCIMIDI
*
)
mciGetDriverData
(
wDevID
);
...
...
@@ -126,7 +121,7 @@ static DWORD MIDI_mciReadByte(WINE_MCIMIDI* wmm, BYTE *lpbyt)
DWORD
ret
=
0
;
if
(
lpbyt
==
NULL
||
mmioRead
(
wmm
->
hFile
,
(
HPSTR
)
lpbyt
,
(
long
)
sizeof
(
BYTE
))
!=
(
long
)
sizeof
(
BYTE
))
{
mmioRead
(
wmm
->
hFile
,
(
HPSTR
)
lpbyt
,
sizeof
(
BYTE
))
!=
(
long
)
sizeof
(
BYTE
))
{
WARN
(
"Error reading wmm=%p
\n
"
,
wmm
);
ret
=
MCIERR_INVALID_FILE
;
}
...
...
@@ -575,7 +570,7 @@ static DWORD MIDI_GetMThdLengthMS(WINE_MCIMIDI* wmm)
/**************************************************************************
* MIDI_mciOpen [internal]
*/
static
DWORD
MIDI_mciOpen
(
UINT
16
wDevID
,
DWORD
dwFlags
,
LPMCI_OPEN_PARMSA
lpParms
)
static
DWORD
MIDI_mciOpen
(
UINT
wDevID
,
DWORD
dwFlags
,
LPMCI_OPEN_PARMSA
lpParms
)
{
DWORD
dwRet
=
0
;
DWORD
dwDeviceID
;
...
...
@@ -597,7 +592,7 @@ static DWORD MIDI_mciOpen(UINT16 wDevID, DWORD dwFlags, LPMCI_OPEN_PARMSA lpParm
wmm
->
nUseCount
++
;
wmm
->
hFile
=
0
;
wmm
->
wMidiID
=
0
;
wmm
->
hMidi
=
0
;
dwDeviceID
=
lpParms
->
wDeviceID
;
TRACE
(
"wDevID=%04X (lpParams->wDeviceID=%08lX)
\n
"
,
wDevID
,
dwDeviceID
);
...
...
@@ -671,7 +666,6 @@ static DWORD MIDI_mciOpen(UINT16 wDevID, DWORD dwFlags, LPMCI_OPEN_PARMSA lpParm
}
else
{
wmm
->
dwPositionMS
=
0
;
wmm
->
dwStatus
=
MCI_MODE_STOP
;
wmm
->
hMidiHdr
=
USER_HEAP_ALLOC
(
sizeof
(
MIDIHDR16
));
}
return
dwRet
;
}
...
...
@@ -679,7 +673,7 @@ static DWORD MIDI_mciOpen(UINT16 wDevID, DWORD dwFlags, LPMCI_OPEN_PARMSA lpParm
/**************************************************************************
* MIDI_mciStop [internal]
*/
static
DWORD
MIDI_mciStop
(
UINT
16
wDevID
,
DWORD
dwFlags
,
LPMCI_GENERIC_PARMS
lpParms
)
static
DWORD
MIDI_mciStop
(
UINT
wDevID
,
DWORD
dwFlags
,
LPMCI_GENERIC_PARMS
lpParms
)
{
WINE_MCIMIDI
*
wmm
=
MIDI_mciGetOpenDev
(
wDevID
);
...
...
@@ -689,14 +683,14 @@ static DWORD MIDI_mciStop(UINT16 wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpPa
if
(
wmm
->
dwStatus
!=
MCI_MODE_STOP
)
{
wmm
->
dwStatus
=
MCI_MODE_STOP
;
m
odMessage
(
wmm
->
wMidiID
,
MODM_CLOSE
,
0
,
0L
,
0L
);
m
idiOutClose
(
wmm
->
hMidi
);
}
TRACE
(
"wmm->dwStatus=%d
\n
"
,
wmm
->
dwStatus
);
if
(
lpParms
&&
(
dwFlags
&
MCI_NOTIFY
))
{
TRACE
(
"MCI_NOTIFY_SUCCESSFUL %08lX !
\n
"
,
lpParms
->
dwCallback
);
mciDriverNotify
16
((
HWND16
)
LOWORD
(
lpParms
->
dwCallback
),
wmm
->
wNotifyDeviceID
,
MCI_NOTIFY_SUCCESSFUL
);
mciDriverNotify
((
HWND
)
LOWORD
(
lpParms
->
dwCallback
),
wmm
->
wNotifyDeviceID
,
MCI_NOTIFY_SUCCESSFUL
);
}
return
0
;
}
...
...
@@ -704,7 +698,7 @@ static DWORD MIDI_mciStop(UINT16 wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpPa
/**************************************************************************
* MIDI_mciClose [internal]
*/
static
DWORD
MIDI_mciClose
(
UINT
16
wDevID
,
DWORD
dwFlags
,
LPMCI_GENERIC_PARMS
lpParms
)
static
DWORD
MIDI_mciClose
(
UINT
wDevID
,
DWORD
dwFlags
,
LPMCI_GENERIC_PARMS
lpParms
)
{
WINE_MCIMIDI
*
wmm
=
MIDI_mciGetOpenDev
(
wDevID
);
...
...
@@ -724,7 +718,6 @@ static DWORD MIDI_mciClose(UINT16 wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpP
wmm
->
hFile
=
0
;
TRACE
(
"hFile closed !
\n
"
);
}
USER_HEAP_FREE
(
wmm
->
hMidiHdr
);
HeapFree
(
GetProcessHeap
(),
0
,
wmm
->
tracks
);
}
else
{
TRACE
(
"Shouldn't happen... nUseCount=%d
\n
"
,
wmm
->
nUseCount
);
...
...
@@ -733,8 +726,8 @@ static DWORD MIDI_mciClose(UINT16 wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpP
if
(
lpParms
&&
(
dwFlags
&
MCI_NOTIFY
))
{
TRACE
(
"MCI_NOTIFY_SUCCESSFUL %08lX !
\n
"
,
lpParms
->
dwCallback
);
mciDriverNotify
16
((
HWND16
)
LOWORD
(
lpParms
->
dwCallback
),
wmm
->
wNotifyDeviceID
,
MCI_NOTIFY_SUCCESSFUL
);
mciDriverNotify
((
HWND
)
LOWORD
(
lpParms
->
dwCallback
),
wmm
->
wNotifyDeviceID
,
MCI_NOTIFY_SUCCESSFUL
);
}
return
0
;
}
...
...
@@ -766,14 +759,13 @@ static MCI_MIDITRACK* MIDI_mciFindNextEvent(WINE_MCIMIDI* wmm, LPDWORD hiPulse)
/**************************************************************************
* MIDI_mciPlay [internal]
*/
static
DWORD
MIDI_mciPlay
(
UINT
16
wDevID
,
DWORD
dwFlags
,
LPMCI_PLAY_PARMS
lpParms
)
static
DWORD
MIDI_mciPlay
(
UINT
wDevID
,
DWORD
dwFlags
,
LPMCI_PLAY_PARMS
lpParms
)
{
DWORD
dwStartMS
,
dwEndMS
,
dwRet
;
WORD
doPlay
,
nt
;
MCI_MIDITRACK
*
mmt
;
DWORD
hiPulse
;
WINE_MCIMIDI
*
wmm
=
MIDI_mciGetOpenDev
(
wDevID
);
MIDIOPENDESC
midiOpenDesc
;
TRACE
(
"(%04X, %08lX, %p);
\n
"
,
wDevID
,
dwFlags
,
lpParms
);
...
...
@@ -832,9 +824,8 @@ static DWORD MIDI_mciPlay(UINT16 wDevID, DWORD dwFlags, LPMCI_PLAY_PARMS lpParms
wmm
->
dwPositionMS
=
0
;
wmm
->
wStartedPlaying
=
FALSE
;
midiOpenDesc
.
hMidi
=
0
;
dwRet
=
modMessage
(
wmm
->
wMidiID
,
MODM_OPEN
,
0
,
(
DWORD
)
&
midiOpenDesc
,
CALLBACK_NULL
);
/* dwRet = midMessage(wmm->wMidiID, MIDM_OPEN, 0, (DWORD)&midiOpenDesc, CALLBACK_NULL);*/
dwRet
=
midiOutOpen
(
&
wmm
->
hMidi
,
0
,
0L
,
0L
,
CALLBACK_NULL
);
/* dwRet = midiInOpen(&wmm->hMidi, 0, 0L, 0L, CALLBACK_NULL);*/
while
(
wmm
->
dwStatus
!=
MCI_MODE_STOP
)
{
/* it seems that in case of multi-threading, gcc is optimizing just a little bit
...
...
@@ -1004,7 +995,7 @@ static DWORD MIDI_mciPlay(UINT16 wDevID, DWORD dwFlags, LPMCI_PLAY_PARMS lpParms
break
;
default:
if
(
doPlay
)
{
dwRet
=
m
odMessage
(
wmm
->
wMidiID
,
MODM_DATA
,
0
,
mmt
->
dwEventData
,
0
);
dwRet
=
m
idiOutShortMsg
(
wmm
->
hMidi
,
mmt
->
dwEventData
);
}
else
{
switch
(
LOBYTE
(
LOWORD
(
mmt
->
dwEventData
))
&
0xF0
)
{
case
MIDI_NOTEON
:
...
...
@@ -1012,7 +1003,7 @@ static DWORD MIDI_mciPlay(UINT16 wDevID, DWORD dwFlags, LPMCI_PLAY_PARMS lpParms
dwRet
=
0
;
break
;
default:
dwRet
=
m
odMessage
(
wmm
->
wMidiID
,
MODM_DATA
,
0
,
mmt
->
dwEventData
,
0
);
dwRet
=
m
idiOutShortMsg
(
wmm
->
hMidi
,
mmt
->
dwEventData
);
}
}
}
...
...
@@ -1036,10 +1027,10 @@ static DWORD MIDI_mciPlay(UINT16 wDevID, DWORD dwFlags, LPMCI_PLAY_PARMS lpParms
{
unsigned
chn
;
for
(
chn
=
0
;
chn
<
16
;
chn
++
)
m
odMessage
(
wmm
->
wMidiID
,
MODM_DATA
,
0
,
0x78B0
|
chn
,
0
);
m
idiOutShortMsg
(
wmm
->
hMidi
,
0x78B0
|
chn
);
}
dwRet
=
m
odMessage
(
wmm
->
wMidiID
,
MODM_CLOSE
,
0
,
0L
,
0L
);
dwRet
=
m
idiOutClose
(
wmm
->
hMidi
);
wmm
->
dwStatus
=
MCI_MODE_STOP
;
/* to restart playing at beginning when it's over */
...
...
@@ -1047,8 +1038,8 @@ static DWORD MIDI_mciPlay(UINT16 wDevID, DWORD dwFlags, LPMCI_PLAY_PARMS lpParms
if
(
lpParms
&&
(
dwFlags
&
MCI_NOTIFY
))
{
TRACE
(
"MCI_NOTIFY_SUCCESSFUL %08lX !
\n
"
,
lpParms
->
dwCallback
);
mciDriverNotify
16
((
HWND16
)
LOWORD
(
lpParms
->
dwCallback
),
wmm
->
wNotifyDeviceID
,
MCI_NOTIFY_SUCCESSFUL
);
mciDriverNotify
((
HWND
)
LOWORD
(
lpParms
->
dwCallback
),
wmm
->
wNotifyDeviceID
,
MCI_NOTIFY_SUCCESSFUL
);
}
return
0
;
}
...
...
@@ -1056,10 +1047,10 @@ static DWORD MIDI_mciPlay(UINT16 wDevID, DWORD dwFlags, LPMCI_PLAY_PARMS lpParms
/**************************************************************************
* MIDI_mciRecord [internal]
*/
static
DWORD
MIDI_mciRecord
(
UINT
16
wDevID
,
DWORD
dwFlags
,
LPMCI_RECORD_PARMS
lpParms
)
static
DWORD
MIDI_mciRecord
(
UINT
wDevID
,
DWORD
dwFlags
,
LPMCI_RECORD_PARMS
lpParms
)
{
int
start
,
end
;
LPMIDIHDR16
lpM
idiHdr
;
MIDIHDR
m
idiHdr
;
DWORD
dwRet
;
WINE_MCIMIDI
*
wmm
=
MIDI_mciGetOpenDev
(
wDevID
);
...
...
@@ -1080,37 +1071,35 @@ static DWORD MIDI_mciRecord(UINT16 wDevID, DWORD dwFlags, LPMCI_RECORD_PARMS lpP
end
=
lpParms
->
dwTo
;
TRACE
(
"MCI_TO=%d
\n
"
,
end
);
}
lpMidiHdr
=
USER_HEAP_LIN_ADDR
(
wmm
->
hMidiHdr
);
lpMidiHdr
->
lpData
=
(
LPSTR
)
HeapAlloc
(
GetProcessHeap
(),
0
,
1200
);
if
(
!
lpMidiHdr
)
midiHdr
.
lpData
=
(
LPSTR
)
HeapAlloc
(
GetProcessHeap
(),
0
,
1200
);
if
(
!
midiHdr
.
lpData
)
return
MCIERR_OUT_OF_MEMORY
;
lpMidiHdr
->
dwBufferLength
=
1024
;
lpMidiHdr
->
dwUser
=
0L
;
lpMidiHdr
->
dwFlags
=
0L
;
dwRet
=
mid
Message
(
wmm
->
wMidiID
,
MIDM_PREPARE
,
0
,
(
DWORD
)
lpMidiHdr
,
sizeof
(
MIDIHDR16
));
midiHdr
.
dwBufferLength
=
1024
;
midiHdr
.
dwUser
=
0L
;
midiHdr
.
dwFlags
=
0L
;
dwRet
=
mid
iInPrepareHeader
(
wmm
->
hMidi
,
&
midiHdr
,
sizeof
(
MIDIHDR
));
TRACE
(
"After MIDM_PREPARE
\n
"
);
wmm
->
dwStatus
=
MCI_MODE_RECORD
;
while
(
wmm
->
dwStatus
!=
MCI_MODE_STOP
)
{
TRACE
(
"wmm->dwStatus=%p %d
\n
"
,
&
wmm
->
dwStatus
,
wmm
->
dwStatus
);
lpMidiHdr
->
dwBytesRecorded
=
0
;
dwRet
=
midMessage
(
wmm
->
wMidiID
,
MIDM_START
,
0
,
0L
,
0L
);
TRACE
(
"After MIDM_START lpMidiHdr=%p dwBytesRecorded=%lu
\n
"
,
lpMidiHdr
,
lpMidiHdr
->
dwBytesRecorded
);
if
(
lpMidiHdr
->
dwBytesRecorded
==
0
)
break
;
midiHdr
.
dwBytesRecorded
=
0
;
dwRet
=
midiInStart
(
wmm
->
hMidi
);
TRACE
(
"midiInStart => dwBytesRecorded=%lu
\n
"
,
midiHdr
.
dwBytesRecorded
);
if
(
midiHdr
.
dwBytesRecorded
==
0
)
break
;
}
TRACE
(
"Before MIDM_UNPREPARE
\n
"
);
dwRet
=
mid
Message
(
wmm
->
wMidiID
,
MIDM_UNPREPARE
,
0
,
(
DWORD
)
lpMidiHdr
,
sizeof
(
MIDIHDR16
));
dwRet
=
mid
iInUnprepareHeader
(
wmm
->
hMidi
,
&
midiHdr
,
sizeof
(
MIDIHDR
));
TRACE
(
"After MIDM_UNPREPARE
\n
"
);
if
(
lpMidiHdr
->
lpData
!=
NULL
)
{
HeapFree
(
GetProcessHeap
(),
0
,
lpMidiHdr
->
lpData
);
lpMidiHdr
->
lpData
=
NULL
;
if
(
midiHdr
.
lpData
!=
NULL
)
{
HeapFree
(
GetProcessHeap
(),
0
,
midiHdr
.
lpData
);
midiHdr
.
lpData
=
NULL
;
}
wmm
->
dwStatus
=
MCI_MODE_STOP
;
if
(
lpParms
&&
(
dwFlags
&
MCI_NOTIFY
))
{
TRACE
(
"MCI_NOTIFY_SUCCESSFUL %08lX !
\n
"
,
lpParms
->
dwCallback
);
mciDriverNotify
16
((
HWND16
)
LOWORD
(
lpParms
->
dwCallback
),
wmm
->
wNotifyDeviceID
,
MCI_NOTIFY_SUCCESSFUL
);
mciDriverNotify
((
HWND
)
LOWORD
(
lpParms
->
dwCallback
),
wmm
->
wNotifyDeviceID
,
MCI_NOTIFY_SUCCESSFUL
);
}
return
0
;
}
...
...
@@ -1118,7 +1107,7 @@ static DWORD MIDI_mciRecord(UINT16 wDevID, DWORD dwFlags, LPMCI_RECORD_PARMS lpP
/**************************************************************************
* MIDI_mciPause [internal]
*/
static
DWORD
MIDI_mciPause
(
UINT
16
wDevID
,
DWORD
dwFlags
,
LPMCI_GENERIC_PARMS
lpParms
)
static
DWORD
MIDI_mciPause
(
UINT
wDevID
,
DWORD
dwFlags
,
LPMCI_GENERIC_PARMS
lpParms
)
{
WINE_MCIMIDI
*
wmm
=
MIDI_mciGetOpenDev
(
wDevID
);
...
...
@@ -1131,13 +1120,13 @@ static DWORD MIDI_mciPause(UINT16 wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpP
/* see note in MIDI_mciPlay */
unsigned
chn
;
for
(
chn
=
0
;
chn
<
16
;
chn
++
)
m
odMessage
(
wmm
->
wMidiID
,
MODM_DATA
,
0
,
0x78B0
|
chn
,
0
);
m
idiOutShortMsg
(
wmm
->
hMidi
,
0x78B0
|
chn
);
wmm
->
dwStatus
=
MCI_MODE_PAUSE
;
}
if
(
lpParms
&&
(
dwFlags
&
MCI_NOTIFY
))
{
TRACE
(
"MCI_NOTIFY_SUCCESSFUL %08lX !
\n
"
,
lpParms
->
dwCallback
);
mciDriverNotify
16
((
HWND16
)
LOWORD
(
lpParms
->
dwCallback
),
wmm
->
wNotifyDeviceID
,
MCI_NOTIFY_SUCCESSFUL
);
mciDriverNotify
((
HWND
)
LOWORD
(
lpParms
->
dwCallback
),
wmm
->
wNotifyDeviceID
,
MCI_NOTIFY_SUCCESSFUL
);
}
return
0
;
...
...
@@ -1146,7 +1135,7 @@ static DWORD MIDI_mciPause(UINT16 wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpP
/**************************************************************************
* MIDI_mciResume [internal]
*/
static
DWORD
MIDI_mciResume
(
UINT
16
wDevID
,
DWORD
dwFlags
,
LPMCI_GENERIC_PARMS
lpParms
)
static
DWORD
MIDI_mciResume
(
UINT
wDevID
,
DWORD
dwFlags
,
LPMCI_GENERIC_PARMS
lpParms
)
{
WINE_MCIMIDI
*
wmm
=
MIDI_mciGetOpenDev
(
wDevID
);
...
...
@@ -1160,8 +1149,8 @@ static DWORD MIDI_mciResume(UINT16 wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lp
}
if
(
lpParms
&&
(
dwFlags
&
MCI_NOTIFY
))
{
TRACE
(
"MCI_NOTIFY_SUCCESSFUL %08lX !
\n
"
,
lpParms
->
dwCallback
);
mciDriverNotify
16
((
HWND16
)
LOWORD
(
lpParms
->
dwCallback
),
wmm
->
wNotifyDeviceID
,
MCI_NOTIFY_SUCCESSFUL
);
mciDriverNotify
((
HWND
)
LOWORD
(
lpParms
->
dwCallback
),
wmm
->
wNotifyDeviceID
,
MCI_NOTIFY_SUCCESSFUL
);
}
return
0
;
}
...
...
@@ -1169,7 +1158,7 @@ static DWORD MIDI_mciResume(UINT16 wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lp
/**************************************************************************
* MIDI_mciSet [internal]
*/
static
DWORD
MIDI_mciSet
(
UINT
16
wDevID
,
DWORD
dwFlags
,
LPMCI_SET_PARMS
lpParms
)
static
DWORD
MIDI_mciSet
(
UINT
wDevID
,
DWORD
dwFlags
,
LPMCI_SET_PARMS
lpParms
)
{
WINE_MCIMIDI
*
wmm
=
MIDI_mciGetOpenDev
(
wDevID
);
...
...
@@ -1247,7 +1236,7 @@ static DWORD MIDI_mciSet(UINT16 wDevID, DWORD dwFlags, LPMCI_SET_PARMS lpParms)
/**************************************************************************
* MIDI_mciStatus [internal]
*/
static
DWORD
MIDI_mciStatus
(
UINT
16
wDevID
,
DWORD
dwFlags
,
LPMCI_STATUS_PARMS
lpParms
)
static
DWORD
MIDI_mciStatus
(
UINT
wDevID
,
DWORD
dwFlags
,
LPMCI_STATUS_PARMS
lpParms
)
{
WINE_MCIMIDI
*
wmm
=
MIDI_mciGetOpenDev
(
wDevID
);
DWORD
ret
=
0
;
...
...
@@ -1337,8 +1326,8 @@ static DWORD MIDI_mciStatus(UINT16 wDevID, DWORD dwFlags, LPMCI_STATUS_PARMS lpP
lpParms
->
dwReturn
=
0
;
break
;
case
MCI_SEQ_STATUS_PORT
:
TRACE
(
"MCI_SEQ_STATUS_PORT
!
\n
"
);
lpParms
->
dwReturn
=
0
;
TRACE
(
"MCI_SEQ_STATUS_PORT
(%u)!
\n
"
,
wmm
->
wDevID
);
lpParms
->
dwReturn
=
wmm
->
wDevID
;
break
;
case
MCI_SEQ_STATUS_TEMPO
:
TRACE
(
"MCI_SEQ_STATUS_TEMPO !
\n
"
);
...
...
@@ -1354,8 +1343,8 @@ static DWORD MIDI_mciStatus(UINT16 wDevID, DWORD dwFlags, LPMCI_STATUS_PARMS lpP
}
if
(
dwFlags
&
MCI_NOTIFY
)
{
TRACE
(
"MCI_NOTIFY_SUCCESSFUL %08lX !
\n
"
,
lpParms
->
dwCallback
);
mciDriverNotify
16
((
HWND16
)
LOWORD
(
lpParms
->
dwCallback
),
wmm
->
wNotifyDeviceID
,
MCI_NOTIFY_SUCCESSFUL
);
mciDriverNotify
((
HWND
)
LOWORD
(
lpParms
->
dwCallback
),
wmm
->
wNotifyDeviceID
,
MCI_NOTIFY_SUCCESSFUL
);
}
return
ret
;
}
...
...
@@ -1363,7 +1352,7 @@ static DWORD MIDI_mciStatus(UINT16 wDevID, DWORD dwFlags, LPMCI_STATUS_PARMS lpP
/**************************************************************************
* MIDI_mciGetDevCaps [internal]
*/
static
DWORD
MIDI_mciGetDevCaps
(
UINT
16
wDevID
,
DWORD
dwFlags
,
static
DWORD
MIDI_mciGetDevCaps
(
UINT
wDevID
,
DWORD
dwFlags
,
LPMCI_GETDEVCAPS_PARMS
lpParms
)
{
WINE_MCIMIDI
*
wmm
=
MIDI_mciGetOpenDev
(
wDevID
);
...
...
@@ -1435,7 +1424,7 @@ static DWORD MIDI_mciGetDevCaps(UINT16 wDevID, DWORD dwFlags,
/**************************************************************************
* MIDI_mciInfo [internal]
*/
static
DWORD
MIDI_mciInfo
(
UINT
16
wDevID
,
DWORD
dwFlags
,
LPMCI_INFO_PARMSA
lpParms
)
static
DWORD
MIDI_mciInfo
(
UINT
wDevID
,
DWORD
dwFlags
,
LPMCI_INFO_PARMSA
lpParms
)
{
LPCSTR
str
=
0
;
WINE_MCIMIDI
*
wmm
=
MIDI_mciGetOpenDev
(
wDevID
);
...
...
@@ -1472,7 +1461,7 @@ static DWORD MIDI_mciInfo(UINT16 wDevID, DWORD dwFlags, LPMCI_INFO_PARMSA lpParm
/**************************************************************************
* MIDI_mciSeek [internal]
*/
static
DWORD
MIDI_mciSeek
(
UINT
16
wDevID
,
DWORD
dwFlags
,
LPMCI_SEEK_PARMS
lpParms
)
static
DWORD
MIDI_mciSeek
(
UINT
wDevID
,
DWORD
dwFlags
,
LPMCI_SEEK_PARMS
lpParms
)
{
DWORD
ret
=
0
;
WINE_MCIMIDI
*
wmm
=
MIDI_mciGetOpenDev
(
wDevID
);
...
...
@@ -1501,13 +1490,12 @@ static DWORD MIDI_mciSeek(UINT16 wDevID, DWORD dwFlags, LPMCI_SEEK_PARMS lpParms
if
(
dwFlags
&
MCI_NOTIFY
)
{
TRACE
(
"MCI_NOTIFY_SUCCESSFUL %08lX !
\n
"
,
lpParms
->
dwCallback
);
mciDriverNotify
16
((
HWND16
)
LOWORD
(
lpParms
->
dwCallback
),
mciDriverNotify
((
HWND
)
LOWORD
(
lpParms
->
dwCallback
),
wmm
->
wNotifyDeviceID
,
MCI_NOTIFY_SUCCESSFUL
);
}
}
return
ret
;
}
#endif
/*======================================================================*
* MIDI entry points *
...
...
@@ -1528,7 +1516,6 @@ LONG CALLBACK MCIMIDI_DriverProc(DWORD dwDevID, HDRVR hDriv, DWORD wMsg,
case
DRV_CONFIGURE
:
MessageBoxA
(
0
,
"Sample Midi Driver !"
,
"OSS Driver"
,
MB_OK
);
return
1
;
case
DRV_INSTALL
:
return
DRVCNF_RESTART
;
case
DRV_REMOVE
:
return
DRVCNF_RESTART
;
#ifdef SNDCTL_MIDI_INFO
case
DRV_OPEN
:
return
MIDI_drvOpen
((
LPSTR
)
dwParam1
,
(
LPMCI_OPEN_DRIVER_PARMSA
)
dwParam2
);
case
DRV_CLOSE
:
return
MIDI_drvClose
(
dwDevID
);
case
MCI_OPEN_DRIVER
:
return
MIDI_mciOpen
(
dwDevID
,
dwParam1
,
(
LPMCI_OPEN_PARMSA
)
dwParam2
);
...
...
@@ -1543,22 +1530,6 @@ LONG CALLBACK MCIMIDI_DriverProc(DWORD dwDevID, HDRVR hDriv, DWORD wMsg,
case
MCI_GETDEVCAPS
:
return
MIDI_mciGetDevCaps
(
dwDevID
,
dwParam1
,
(
LPMCI_GETDEVCAPS_PARMS
)
dwParam2
);
case
MCI_INFO
:
return
MIDI_mciInfo
(
dwDevID
,
dwParam1
,
(
LPMCI_INFO_PARMSA
)
dwParam2
);
case
MCI_SEEK
:
return
MIDI_mciSeek
(
dwDevID
,
dwParam1
,
(
LPMCI_SEEK_PARMS
)
dwParam2
);
#else
case
DRV_OPEN
:
return
1
;
case
DRV_CLOSE
:
return
1
;
case
MCI_OPEN_DRIVER
:
case
MCI_CLOSE_DRIVER
:
case
MCI_PLAY
:
case
MCI_RECORD
:
case
MCI_STOP
:
case
MCI_SET
:
case
MCI_PAUSE
:
case
MCI_RESUME
:
case
MCI_STATUS
:
case
MCI_GETDEVCAPS
:
case
MCI_INFO
:
case
MCI_SEEK
:
#endif
/* commands that should be supported */
case
MCI_LOAD
:
case
MCI_SAVE
:
...
...
multimedia/mciwave.c
View file @
139f8fca
/* -*- tab-width: 8; c-basic-offset: 4 -*- */
/*
* Sample Wine Driver for
Open Sound System (featured in Linux and FreeBSD)
* Sample Wine Driver for
MCI wave forms
*
* Copyright 1994 Martin Ayotte
* Copyright 1994 Martin Ayotte
* 1999 Eric Pouech
*/
/*
* FIXME:
...
...
@@ -10,31 +11,27 @@
* - segmented/linear pointer problems (lpData in waveheaders,W*_DONE cbs)
*/
#define EMULATE_SB16
#define DEBUG_MCIWAVE
#include "winuser.h"
#include "driver.h"
#include "m
ultimedia
.h"
#include "m
mddk
.h"
#include "heap.h"
#include "debugtools.h"
DEFAULT_DEBUG_CHANNEL
(
mciwave
)
typedef
struct
{
UINT
16
wDevID
;
UINT16
wWavID
;
UINT
wDevID
;
HANDLE
hWave
;
int
nUseCount
;
/* Incremented for each shared open */
BOOL
16
fShareable
;
/* TRUE if first open was shareable */
BOOL
fShareable
;
/* TRUE if first open was shareable */
WORD
wNotifyDeviceID
;
/* MCI device ID with a pending notification */
HANDLE
16
hCallback
;
/* Callback handle for pending notification */
HANDLE
hCallback
;
/* Callback handle for pending notification */
HMMIO
hFile
;
/* mmio file handle open as Element */
MCI_WAVE_OPEN_PARMSA
openParms
;
WAVEOPENDESC
waveDesc
;
PCMWAVEFORMAT
WaveFormat
;
WAVEHDR
WaveHdr
;
BOOL
16
fInput
;
/* FALSE = Output, TRUE = Input */
BOOL
fInput
;
/* FALSE = Output, TRUE = Input */
WORD
dwStatus
;
/* one from MCI_MODE_xxxx */
DWORD
dwMciTimeFormat
;
/* One of the supported MCI_FORMAT_xxxx */
DWORD
dwFileOffset
;
/* Offset of chunk in mmio file */
...
...
@@ -46,7 +43,7 @@ typedef struct {
* MCI WAVE implemantation *
*======================================================================*/
static
DWORD
WAVE_mciResume
(
UINT
16
wDevID
,
DWORD
dwFlags
,
LPMCI_GENERIC_PARMS
lpParms
);
static
DWORD
WAVE_mciResume
(
UINT
wDevID
,
DWORD
dwFlags
,
LPMCI_GENERIC_PARMS
lpParms
);
/**************************************************************************
* MCIWAVE_drvOpen [internal]
...
...
@@ -83,7 +80,7 @@ static DWORD WAVE_drvClose(DWORD dwDevID)
/**************************************************************************
* WAVE_mciGetOpenDev [internal]
*/
static
WINE_MCIWAVE
*
WAVE_mciGetOpenDev
(
UINT
16
wDevID
)
static
WINE_MCIWAVE
*
WAVE_mciGetOpenDev
(
UINT
wDevID
)
{
WINE_MCIWAVE
*
wmw
=
(
WINE_MCIWAVE
*
)
mciGetDriverData
(
wDevID
);
...
...
@@ -184,7 +181,7 @@ static DWORD WAVE_mciReadFmt(WINE_MCIWAVE* wmw, MMCKINFO* pckMainRIFF)
/**************************************************************************
* WAVE_mciOpen [internal]
*/
static
DWORD
WAVE_mciOpen
(
UINT
16
wDevID
,
DWORD
dwFlags
,
LPMCI_WAVE_OPEN_PARMSA
lpOpenParms
)
static
DWORD
WAVE_mciOpen
(
UINT
wDevID
,
DWORD
dwFlags
,
LPMCI_WAVE_OPEN_PARMSA
lpOpenParms
)
{
DWORD
dwRet
=
0
;
DWORD
dwDeviceID
;
...
...
@@ -208,7 +205,7 @@ static DWORD WAVE_mciOpen(UINT16 wDevID, DWORD dwFlags, LPMCI_WAVE_OPEN_PARMSA l
dwDeviceID
=
lpOpenParms
->
wDeviceID
;
wmw
->
fInput
=
FALSE
;
wmw
->
wWavID
=
0
;
wmw
->
hWave
=
0
;
TRACE
(
"wDevID=%04X (lpParams->wDeviceID=%08lX)
\n
"
,
wDevID
,
dwDeviceID
);
...
...
@@ -280,7 +277,7 @@ static DWORD WAVE_mciOpen(UINT16 wDevID, DWORD dwFlags, LPMCI_WAVE_OPEN_PARMSA l
/**************************************************************************
* WAVE_mciCue [internal]
*/
static
DWORD
WAVE_mciCue
(
UINT
16
wDevID
,
DWORD
dwParam
,
LPMCI_GENERIC_PARMS
lpParms
)
static
DWORD
WAVE_mciCue
(
UINT
wDevID
,
DWORD
dwParam
,
LPMCI_GENERIC_PARMS
lpParms
)
{
/*
FIXME
...
...
@@ -296,7 +293,7 @@ static DWORD WAVE_mciCue(UINT16 wDevID, DWORD dwParam, LPMCI_GENERIC_PARMS lpPar
DWORD
dwRet
;
WINE_MCIWAVE
*
wmw
=
WAVE_mciGetOpenDev
(
wDevID
);
TRACE
(
"(%u, %08lX, %p);
\n
"
,
wDevID
,
dwParam
,
lpParms
);
FIXME
(
"(%u, %08lX, %p); likely to fail
\n
"
,
wDevID
,
dwParam
,
lpParms
);
if
(
wmw
==
NULL
)
return
MCIERR_INVALID_DEVICE_ID
;
...
...
@@ -309,23 +306,22 @@ static DWORD WAVE_mciCue(UINT16 wDevID, DWORD dwParam, LPMCI_GENERIC_PARMS lpPar
dwRet
=
MMSYSERR_NOERROR
;
/* assume success */
if
((
dwParam
&
MCI_WAVE_INPUT
)
&&
!
wmw
->
fInput
)
{
dwRet
=
w
odMessage
(
wmw
->
wWavID
,
WODM_CLOSE
,
0
,
0L
,
0L
);
dwRet
=
w
aveOutClose
(
wmw
->
hWave
);
if
(
dwRet
!=
MMSYSERR_NOERROR
)
return
MCIERR_INTERNAL
;
dwRet
=
widMessage
(
wmw
->
wWavID
,
WIDM_OPEN
,
0
,
(
DWORD
)
&
wmw
->
waveDesc
,
CALLBACK_NULL
);
wmw
->
fInput
=
TRUE
;
}
else
if
(
wmw
->
fInput
)
{
dwRet
=
w
idMessage
(
wmw
->
wWavID
,
WIDM_CLOSE
,
0
,
0L
,
0L
);
dwRet
=
w
aveInClose
(
wmw
->
hWave
);
if
(
dwRet
!=
MMSYSERR_NOERROR
)
return
MCIERR_INTERNAL
;
dwRet
=
wodMessage
(
wmw
->
wWavID
,
WODM_OPEN
,
0
,
(
DWORD
)
&
wmw
->
waveDesc
,
CALLBACK_NULL
);
wmw
->
fInput
=
FALSE
;
}
wmw
->
hWave
=
0
;
return
(
dwRet
==
MMSYSERR_NOERROR
)
?
0
:
MCIERR_INTERNAL
;
}
/**************************************************************************
* WAVE_mciStop [internal]
*/
static
DWORD
WAVE_mciStop
(
UINT
16
wDevID
,
DWORD
dwFlags
,
LPMCI_GENERIC_PARMS
lpParms
)
static
DWORD
WAVE_mciStop
(
UINT
wDevID
,
DWORD
dwFlags
,
LPMCI_GENERIC_PARMS
lpParms
)
{
DWORD
dwRet
;
WINE_MCIWAVE
*
wmw
=
WAVE_mciGetOpenDev
(
wDevID
);
...
...
@@ -340,14 +336,14 @@ static DWORD WAVE_mciStop(UINT16 wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpPa
TRACE
(
"wmw->dwStatus=%d
\n
"
,
wmw
->
dwStatus
);
if
(
wmw
->
fInput
)
dwRet
=
w
idMessage
(
wmw
->
wWavID
,
WIDM_RESET
,
0
,
dwFlags
,
(
DWORD
)
lpParms
);
dwRet
=
w
aveInReset
(
wmw
->
hWave
);
else
dwRet
=
w
odMessage
(
wmw
->
wWavID
,
WODM_RESET
,
0
,
dwFlags
,
(
DWORD
)
lpParms
);
dwRet
=
w
aveOutReset
(
wmw
->
hWave
);
if
(
dwFlags
&
MCI_NOTIFY
)
{
TRACE
(
"MCI_NOTIFY_SUCCESSFUL %08lX !
\n
"
,
lpParms
->
dwCallback
);
mciDriverNotify
16
((
HWND16
)
LOWORD
(
lpParms
->
dwCallback
),
wmw
->
wNotifyDeviceID
,
MCI_NOTIFY_SUCCESSFUL
);
mciDriverNotify
((
HWND
)
LOWORD
(
lpParms
->
dwCallback
),
wmw
->
wNotifyDeviceID
,
MCI_NOTIFY_SUCCESSFUL
);
}
return
(
dwRet
==
MMSYSERR_NOERROR
)
?
0
:
MCIERR_INTERNAL
;
...
...
@@ -356,7 +352,7 @@ static DWORD WAVE_mciStop(UINT16 wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpPa
/**************************************************************************
* WAVE_mciClose [internal]
*/
static
DWORD
WAVE_mciClose
(
UINT
16
wDevID
,
DWORD
dwFlags
,
LPMCI_GENERIC_PARMS
lpParms
)
static
DWORD
WAVE_mciClose
(
UINT
wDevID
,
DWORD
dwFlags
,
LPMCI_GENERIC_PARMS
lpParms
)
{
DWORD
dwRet
=
0
;
WINE_MCIWAVE
*
wmw
=
WAVE_mciGetOpenDev
(
wDevID
);
...
...
@@ -377,17 +373,16 @@ static DWORD WAVE_mciClose(UINT16 wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpP
mmioClose
(
wmw
->
hFile
,
0
);
wmw
->
hFile
=
0
;
}
mmRet
=
(
wmw
->
fInput
)
?
widMessage
(
wmw
->
wWavID
,
WIDM_CLOSE
,
0
,
0L
,
0L
)
:
wodMessage
(
wmw
->
wWavID
,
WODM_CLOSE
,
0
,
0L
,
0L
);
mmRet
=
(
wmw
->
fInput
)
?
waveInClose
(
wmw
->
hWave
)
:
waveOutClose
(
wmw
->
hWave
);
if
(
mmRet
!=
MMSYSERR_NOERROR
)
dwRet
=
MCIERR_INTERNAL
;
}
if
((
dwFlags
&
MCI_NOTIFY
)
&&
lpParms
)
{
TRACE
(
"MCI_NOTIFY_SUCCESSFUL %08lX !
\n
"
,
lpParms
->
dwCallback
);
mciDriverNotify
16
((
HWND16
)
LOWORD
(
lpParms
->
dwCallback
),
wmw
->
wNotifyDeviceID
,
(
dwRet
==
0
)
?
MCI_NOTIFY_SUCCESSFUL
:
MCI_NOTIFY_FAILURE
);
mciDriverNotify
((
HWND
)
LOWORD
(
lpParms
->
dwCallback
),
wmw
->
wNotifyDeviceID
,
(
dwRet
==
0
)
?
MCI_NOTIFY_SUCCESSFUL
:
MCI_NOTIFY_FAILURE
);
}
return
0
;
}
...
...
@@ -395,7 +390,7 @@ static DWORD WAVE_mciClose(UINT16 wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpP
/**************************************************************************
* WAVE_mciPlay [internal]
*/
static
DWORD
WAVE_mciPlay
(
UINT
16
wDevID
,
DWORD
dwFlags
,
LPMCI_PLAY_PARMS
lpParms
)
static
DWORD
WAVE_mciPlay
(
UINT
wDevID
,
DWORD
dwFlags
,
LPMCI_PLAY_PARMS
lpParms
)
{
DWORD
end
;
LONG
bufsize
,
count
;
...
...
@@ -448,7 +443,8 @@ static DWORD WAVE_mciPlay(UINT16 wDevID, DWORD dwFlags, LPMCI_PLAY_PARMS lpParms
* change from output to input and back
*/
/* FIXME: how to choose between several output channels ? here 0 is forced */
dwRet
=
wodMessage
(
0
,
WODM_OPEN
,
0
,
(
DWORD
)
&
wmw
->
waveDesc
,
CALLBACK_NULL
);
/* I shall rather use WAVE_MAPPER */
dwRet
=
waveOutOpen
(
&
wmw
->
hWave
,
0
,
(
LPWAVEFORMATEX
)
&
wmw
->
WaveFormat
,
0L
,
0L
,
CALLBACK_NULL
);
if
(
dwRet
!=
0
)
{
TRACE
(
"Can't open low level audio device %ld
\n
"
,
dwRet
);
return
MCIERR_DEVICE_OPEN
;
...
...
@@ -472,14 +468,12 @@ static DWORD WAVE_mciPlay(UINT16 wDevID, DWORD dwFlags, LPMCI_PLAY_PARMS lpParms
TRACE
(
"mmioRead bufsize=%ld count=%ld
\n
"
,
bufsize
,
count
);
if
(
count
<
1
)
break
;
dwRet
=
w
odMessage
(
wmw
->
wWavID
,
WODM_PREPARE
,
0
,
(
DWORD
)
&
wmw
->
WaveHdr
,
sizeof
(
WAVEHDR
));
dwRet
=
w
aveOutPrepareHeader
(
wmw
->
hWave
,
&
wmw
->
WaveHdr
,
sizeof
(
WAVEHDR
));
wmw
->
WaveHdr
.
dwBufferLength
=
count
;
wmw
->
WaveHdr
.
dwBytesRecorded
=
0
;
/* FIXME */
wmw
->
WaveHdr
.
reserved
=
(
DWORD
)
&
wmw
->
WaveHdr
;
TRACE
(
"before WODM_WRITE lpWaveHdr=%p dwBufferLength=%lu dwBytesRecorded=%lu
\n
"
,
&
wmw
->
WaveHdr
,
wmw
->
WaveHdr
.
dwBufferLength
,
wmw
->
WaveHdr
.
dwBytesRecorded
);
dwRet
=
w
odMessage
(
wmw
->
wWavID
,
WODM_WRITE
,
0
,
(
DWORD
)
&
wmw
->
WaveHdr
,
sizeof
(
WAVEHDR
));
dwRet
=
w
aveOutWrite
(
wmw
->
hWave
,
&
wmw
->
WaveHdr
,
sizeof
(
WAVEHDR
));
/* FIXME: should use callback mechanisms from audio driver */
#if 1
while
(
!
(
wmw
->
WaveHdr
.
dwFlags
&
WHDR_DONE
))
...
...
@@ -487,7 +481,7 @@ static DWORD WAVE_mciPlay(UINT16 wDevID, DWORD dwFlags, LPMCI_PLAY_PARMS lpParms
#endif
wmw
->
dwPosition
+=
count
;
TRACE
(
"after WODM_WRITE dwPosition=%lu
\n
"
,
wmw
->
dwPosition
);
dwRet
=
w
odMessage
(
wmw
->
wWavID
,
WODM_UNPREPARE
,
0
,
(
DWORD
)
&
wmw
->
WaveHdr
,
sizeof
(
WAVEHDR
));
dwRet
=
w
aveOutUnprepareHeader
(
wmw
->
hWave
,
&
wmw
->
WaveHdr
,
sizeof
(
WAVEHDR
));
}
if
(
wmw
->
WaveHdr
.
lpData
!=
NULL
)
{
...
...
@@ -496,14 +490,14 @@ static DWORD WAVE_mciPlay(UINT16 wDevID, DWORD dwFlags, LPMCI_PLAY_PARMS lpParms
wmw
->
WaveHdr
.
lpData
=
NULL
;
}
w
odMessage
(
wmw
->
wWavID
,
WODM_RESET
,
0
,
0L
,
0L
);
w
odMessage
(
wmw
->
wWavID
,
WODM_CLOSE
,
0
,
0L
,
0L
);
w
aveOutReset
(
wmw
->
hWave
);
w
aveOutClose
(
wmw
->
hWave
);
wmw
->
dwStatus
=
MCI_MODE_STOP
;
if
(
lpParms
&&
(
dwFlags
&
MCI_NOTIFY
))
{
TRACE
(
"MCI_NOTIFY_SUCCESSFUL %08lX !
\n
"
,
lpParms
->
dwCallback
);
mciDriverNotify
16
((
HWND16
)
LOWORD
(
lpParms
->
dwCallback
),
wmw
->
wNotifyDeviceID
,
MCI_NOTIFY_SUCCESSFUL
);
mciDriverNotify
((
HWND
)
LOWORD
(
lpParms
->
dwCallback
),
wmw
->
wNotifyDeviceID
,
MCI_NOTIFY_SUCCESSFUL
);
}
return
0
;
}
...
...
@@ -511,7 +505,7 @@ static DWORD WAVE_mciPlay(UINT16 wDevID, DWORD dwFlags, LPMCI_PLAY_PARMS lpParms
/**************************************************************************
* WAVE_mciRecord [internal]
*/
static
DWORD
WAVE_mciRecord
(
UINT
16
wDevID
,
DWORD
dwFlags
,
LPMCI_RECORD_PARMS
lpParms
)
static
DWORD
WAVE_mciRecord
(
UINT
wDevID
,
DWORD
dwFlags
,
LPMCI_RECORD_PARMS
lpParms
)
{
int
start
,
end
;
LONG
bufsize
;
...
...
@@ -552,18 +546,15 @@ static DWORD WAVE_mciRecord(UINT16 wDevID, DWORD dwFlags, LPMCI_RECORD_PARMS lpP
lpWaveHdr
->
dwUser
=
0L
;
lpWaveHdr
->
dwFlags
=
0L
;
lpWaveHdr
->
dwLoops
=
0L
;
dwRet
=
widMessage
(
wmw
->
wWavID
,
WIDM_PREPARE
,
0
,
(
DWORD
)
lpWaveHdr
,
sizeof
(
WAVEHDR
));
TRACE
(
"after WIDM_PREPARE
\n
"
);
while
(
TRUE
)
{
dwRet
=
waveInPrepareHeader
(
wmw
->
hWave
,
lpWaveHdr
,
sizeof
(
WAVEHDR
));
while
(
TRUE
)
{
/* FIXME: I don't see any waveInAddBuffer ? */
lpWaveHdr
->
dwBytesRecorded
=
0
;
dwRet
=
w
idMessage
(
wmw
->
wWavID
,
WIDM_START
,
0
,
0L
,
0L
);
dwRet
=
w
aveInStart
(
wmw
->
hWave
);
TRACE
(
"after WIDM_START lpWaveHdr=%p dwBytesRecorded=%lu
\n
"
,
lpWaveHdr
,
lpWaveHdr
->
dwBytesRecorded
);
if
(
lpWaveHdr
->
dwBytesRecorded
==
0
)
break
;
}
TRACE
(
"before WIDM_UNPREPARE
\n
"
);
dwRet
=
widMessage
(
wmw
->
wWavID
,
WIDM_UNPREPARE
,
0
,
(
DWORD
)
lpWaveHdr
,
sizeof
(
WAVEHDR
));
TRACE
(
"after WIDM_UNPREPARE
\n
"
);
dwRet
=
waveInUnprepareHeader
(
wmw
->
hWave
,
lpWaveHdr
,
sizeof
(
WAVEHDR
));
if
(
lpWaveHdr
->
lpData
!=
NULL
)
{
GlobalUnlock16
(
hData
);
GlobalFree16
(
hData
);
...
...
@@ -571,8 +562,8 @@ static DWORD WAVE_mciRecord(UINT16 wDevID, DWORD dwFlags, LPMCI_RECORD_PARMS lpP
}
if
(
dwFlags
&
MCI_NOTIFY
)
{
TRACE
(
"MCI_NOTIFY_SUCCESSFUL %08lX !
\n
"
,
lpParms
->
dwCallback
);
mciDriverNotify
16
((
HWND16
)
LOWORD
(
lpParms
->
dwCallback
),
wmw
->
wNotifyDeviceID
,
MCI_NOTIFY_SUCCESSFUL
);
mciDriverNotify
((
HWND
)
LOWORD
(
lpParms
->
dwCallback
),
wmw
->
wNotifyDeviceID
,
MCI_NOTIFY_SUCCESSFUL
);
}
return
0
;
}
...
...
@@ -580,7 +571,7 @@ static DWORD WAVE_mciRecord(UINT16 wDevID, DWORD dwFlags, LPMCI_RECORD_PARMS lpP
/**************************************************************************
* WAVE_mciPause [internal]
*/
static
DWORD
WAVE_mciPause
(
UINT
16
wDevID
,
DWORD
dwFlags
,
LPMCI_GENERIC_PARMS
lpParms
)
static
DWORD
WAVE_mciPause
(
UINT
wDevID
,
DWORD
dwFlags
,
LPMCI_GENERIC_PARMS
lpParms
)
{
DWORD
dwRet
;
WINE_MCIWAVE
*
wmw
=
WAVE_mciGetOpenDev
(
wDevID
);
...
...
@@ -594,8 +585,8 @@ static DWORD WAVE_mciPause(UINT16 wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpP
wmw
->
dwStatus
=
MCI_MODE_PAUSE
;
}
if
(
wmw
->
fInput
)
dwRet
=
w
idMessage
(
wmw
->
wWavID
,
WIDM_PAUSE
,
0
,
0L
,
0L
);
else
dwRet
=
w
odMessage
(
wmw
->
wWavID
,
WODM_PAUSE
,
0
,
0L
,
0L
);
if
(
wmw
->
fInput
)
dwRet
=
w
aveInStop
(
wmw
->
hWave
);
else
dwRet
=
w
aveOutPause
(
wmw
->
hWave
);
return
(
dwRet
==
MMSYSERR_NOERROR
)
?
0
:
MCIERR_INTERNAL
;
}
...
...
@@ -603,7 +594,7 @@ static DWORD WAVE_mciPause(UINT16 wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpP
/**************************************************************************
* WAVE_mciResume [internal]
*/
static
DWORD
WAVE_mciResume
(
UINT
16
wDevID
,
DWORD
dwFlags
,
LPMCI_GENERIC_PARMS
lpParms
)
static
DWORD
WAVE_mciResume
(
UINT
wDevID
,
DWORD
dwFlags
,
LPMCI_GENERIC_PARMS
lpParms
)
{
WINE_MCIWAVE
*
wmw
=
WAVE_mciGetOpenDev
(
wDevID
);
DWORD
dwRet
=
0
;
...
...
@@ -618,15 +609,15 @@ static DWORD WAVE_mciResume(UINT16 wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lp
}
/* FIXME: I doubt WIDM_START is correct */
if
(
wmw
->
fInput
)
dwRet
=
w
idMessage
(
wmw
->
wWavID
,
WIDM_START
,
0
,
0L
,
0L
);
else
dwRet
=
w
odMessage
(
wmw
->
wWavID
,
WODM_RESTART
,
0
,
0L
,
0L
);
if
(
wmw
->
fInput
)
dwRet
=
w
aveInStart
(
wmw
->
hWave
);
else
dwRet
=
w
aveOutRestart
(
wmw
->
hWave
);
return
(
dwRet
==
MMSYSERR_NOERROR
)
?
0
:
MCIERR_INTERNAL
;
}
/**************************************************************************
* WAVE_mciSeek [internal]
*/
static
DWORD
WAVE_mciSeek
(
UINT
16
wDevID
,
DWORD
dwFlags
,
LPMCI_SEEK_PARMS
lpParms
)
static
DWORD
WAVE_mciSeek
(
UINT
wDevID
,
DWORD
dwFlags
,
LPMCI_SEEK_PARMS
lpParms
)
{
DWORD
ret
=
0
;
WINE_MCIWAVE
*
wmw
=
WAVE_mciGetOpenDev
(
wDevID
);
...
...
@@ -655,8 +646,8 @@ static DWORD WAVE_mciSeek(UINT16 wDevID, DWORD dwFlags, LPMCI_SEEK_PARMS lpParms
if
(
dwFlags
&
MCI_NOTIFY
)
{
TRACE
(
"MCI_NOTIFY_SUCCESSFUL %08lX !
\n
"
,
lpParms
->
dwCallback
);
mciDriverNotify
16
((
HWND16
)
LOWORD
(
lpParms
->
dwCallback
),
wmw
->
wNotifyDeviceID
,
MCI_NOTIFY_SUCCESSFUL
);
mciDriverNotify
((
HWND
)
LOWORD
(
lpParms
->
dwCallback
),
wmw
->
wNotifyDeviceID
,
MCI_NOTIFY_SUCCESSFUL
);
}
}
return
ret
;
...
...
@@ -665,7 +656,7 @@ static DWORD WAVE_mciSeek(UINT16 wDevID, DWORD dwFlags, LPMCI_SEEK_PARMS lpParms
/**************************************************************************
* WAVE_mciSet [internal]
*/
static
DWORD
WAVE_mciSet
(
UINT
16
wDevID
,
DWORD
dwFlags
,
LPMCI_SET_PARMS
lpParms
)
static
DWORD
WAVE_mciSet
(
UINT
wDevID
,
DWORD
dwFlags
,
LPMCI_SET_PARMS
lpParms
)
{
WINE_MCIWAVE
*
wmw
=
WAVE_mciGetOpenDev
(
wDevID
);
...
...
@@ -748,7 +739,7 @@ static DWORD WAVE_mciSet(UINT16 wDevID, DWORD dwFlags, LPMCI_SET_PARMS lpParms)
/**************************************************************************
* WAVE_mciStatus [internal]
*/
static
DWORD
WAVE_mciStatus
(
UINT
16
wDevID
,
DWORD
dwFlags
,
LPMCI_STATUS_PARMS
lpParms
)
static
DWORD
WAVE_mciStatus
(
UINT
wDevID
,
DWORD
dwFlags
,
LPMCI_STATUS_PARMS
lpParms
)
{
WINE_MCIWAVE
*
wmw
=
WAVE_mciGetOpenDev
(
wDevID
);
DWORD
ret
;
...
...
@@ -758,7 +749,7 @@ static DWORD WAVE_mciStatus(UINT16 wDevID, DWORD dwFlags, LPMCI_STATUS_PARMS lpP
if
(
wmw
==
NULL
)
return
MCIERR_INVALID_DEVICE_ID
;
if
(
dwFlags
&
MCI_STATUS_ITEM
)
{
switch
(
lpParms
->
dwItem
)
{
switch
(
lpParms
->
dwItem
)
{
case
MCI_STATUS_CURRENT_TRACK
:
lpParms
->
dwReturn
=
1
;
TRACE
(
"MCI_STATUS_CURRENT_TRACK => %lu
\n
"
,
lpParms
->
dwReturn
);
...
...
@@ -845,8 +836,8 @@ static DWORD WAVE_mciStatus(UINT16 wDevID, DWORD dwFlags, LPMCI_STATUS_PARMS lpP
}
if
(
dwFlags
&
MCI_NOTIFY
)
{
TRACE
(
"MCI_NOTIFY_SUCCESSFUL %08lX !
\n
"
,
lpParms
->
dwCallback
);
mciDriverNotify
16
((
HWND16
)
LOWORD
(
lpParms
->
dwCallback
),
wmw
->
wNotifyDeviceID
,
MCI_NOTIFY_SUCCESSFUL
);
mciDriverNotify
((
HWND
)
LOWORD
(
lpParms
->
dwCallback
),
wmw
->
wNotifyDeviceID
,
MCI_NOTIFY_SUCCESSFUL
);
}
return
ret
;
}
...
...
@@ -854,7 +845,7 @@ static DWORD WAVE_mciStatus(UINT16 wDevID, DWORD dwFlags, LPMCI_STATUS_PARMS lpP
/**************************************************************************
* WAVE_mciGetDevCaps [internal]
*/
static
DWORD
WAVE_mciGetDevCaps
(
UINT
16
wDevID
,
DWORD
dwFlags
,
static
DWORD
WAVE_mciGetDevCaps
(
UINT
wDevID
,
DWORD
dwFlags
,
LPMCI_GETDEVCAPS_PARMS
lpParms
)
{
WINE_MCIWAVE
*
wmw
=
WAVE_mciGetOpenDev
(
wDevID
);
...
...
@@ -923,7 +914,7 @@ static DWORD WAVE_mciGetDevCaps(UINT16 wDevID, DWORD dwFlags,
/**************************************************************************
* WAVE_mciInfo [internal]
*/
static
DWORD
WAVE_mciInfo
(
UINT
16
wDevID
,
DWORD
dwFlags
,
LPMCI_INFO_PARMS16
lpParms
)
static
DWORD
WAVE_mciInfo
(
UINT
wDevID
,
DWORD
dwFlags
,
LPMCI_INFO_PARMSA
lpParms
)
{
DWORD
ret
=
0
;
LPCSTR
str
=
0
;
...
...
@@ -1000,7 +991,7 @@ LONG CALLBACK MCIWAVE_DriverProc(DWORD dwDevID, HDRVR hDriv, DWORD wMsg,
case
MCI_RESUME
:
return
WAVE_mciResume
(
dwDevID
,
dwParam1
,
(
LPMCI_GENERIC_PARMS
)
dwParam2
);
case
MCI_STATUS
:
return
WAVE_mciStatus
(
dwDevID
,
dwParam1
,
(
LPMCI_STATUS_PARMS
)
dwParam2
);
case
MCI_GETDEVCAPS
:
return
WAVE_mciGetDevCaps
(
dwDevID
,
dwParam1
,
(
LPMCI_GETDEVCAPS_PARMS
)
dwParam2
);
case
MCI_INFO
:
return
WAVE_mciInfo
(
dwDevID
,
dwParam1
,
(
LPMCI_INFO_PARMS
16
)
dwParam2
);
case
MCI_INFO
:
return
WAVE_mciInfo
(
dwDevID
,
dwParam1
,
(
LPMCI_INFO_PARMS
A
)
dwParam2
);
case
MCI_SEEK
:
return
WAVE_mciSeek
(
dwDevID
,
dwParam1
,
(
LPMCI_SEEK_PARMS
)
dwParam2
);
/* commands that should be supported */
case
MCI_LOAD
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment