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
b0fc000c
Commit
b0fc000c
authored
Jan 23, 2013
by
Jörg Höhle
Committed by
Alexandre Julliard
Mar 01, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winmm: Prevent some MIDI race conditions.
parent
702fe673
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
32 deletions
+22
-32
midi.c
dlls/winealsa.drv/midi.c
+16
-21
midi.c
dlls/wineoss.drv/midi.c
+6
-11
No files found.
dlls/winealsa.drv/midi.c
View file @
b0fc000c
...
...
@@ -389,9 +389,9 @@ static DWORD WINAPI midRecThread(LPVOID arg)
* to handle the case where ALSA split the sysex into several events */
if
((
lpMidiHdr
->
dwBytesRecorded
==
lpMidiHdr
->
dwBufferLength
)
||
(
*
(
BYTE
*
)(
lpMidiHdr
->
lpData
+
lpMidiHdr
->
dwBytesRecorded
-
1
)
==
0xF7
))
{
MidiInDev
[
wDevID
].
lpQueueHdr
=
lpMidiHdr
->
lpNext
;
lpMidiHdr
->
dwFlags
&=
~
MHDR_INQUEUE
;
lpMidiHdr
->
dwFlags
|=
MHDR_DONE
;
MidiInDev
[
wDevID
].
lpQueueHdr
=
lpMidiHdr
->
lpNext
;
MIDI_NotifyClient
(
wDevID
,
MIM_LONGDATA
,
(
DWORD_PTR
)
lpMidiHdr
,
dwTime
);
}
}
else
{
...
...
@@ -478,6 +478,16 @@ static DWORD midOpen(WORD wDevID, LPMIDIOPENDESC lpDesc, DWORD dwFlags)
return
MMSYSERR_ERROR
;
}
MidiInDev
[
wDevID
].
wFlags
=
HIWORD
(
dwFlags
&
CALLBACK_TYPEMASK
);
MidiInDev
[
wDevID
].
lpQueueHdr
=
NULL
;
MidiInDev
[
wDevID
].
dwTotalPlayed
=
0
;
MidiInDev
[
wDevID
].
bufsize
=
0x3FFF
;
MidiInDev
[
wDevID
].
midiDesc
=
*
lpDesc
;
MidiInDev
[
wDevID
].
state
=
0
;
MidiInDev
[
wDevID
].
incLen
=
0
;
MidiInDev
[
wDevID
].
startTime
=
0
;
/* Connect our app port to the device port */
if
(
snd_seq_connect_from
(
midiSeq
,
port_in
,
MidiInDev
[
wDevID
].
addr
.
client
,
MidiInDev
[
wDevID
].
addr
.
port
)
<
0
)
return
MMSYSERR_NOTENABLED
;
...
...
@@ -497,16 +507,6 @@ static DWORD midOpen(WORD wDevID, LPMIDIOPENDESC lpDesc, DWORD dwFlags)
TRACE
(
"Created thread for midi-in
\n
"
);
}
MidiInDev
[
wDevID
].
wFlags
=
HIWORD
(
dwFlags
&
CALLBACK_TYPEMASK
);
MidiInDev
[
wDevID
].
lpQueueHdr
=
NULL
;
MidiInDev
[
wDevID
].
dwTotalPlayed
=
0
;
MidiInDev
[
wDevID
].
bufsize
=
0x3FFF
;
MidiInDev
[
wDevID
].
midiDesc
=
*
lpDesc
;
MidiInDev
[
wDevID
].
state
=
0
;
MidiInDev
[
wDevID
].
incLen
=
0
;
MidiInDev
[
wDevID
].
startTime
=
0
;
MIDI_NotifyClient
(
wDevID
,
MIM_OPEN
,
0L
,
0L
);
return
MMSYSERR_NOERROR
;
}
...
...
@@ -644,12 +644,11 @@ static DWORD midReset(WORD wDevID)
EnterCriticalSection
(
&
crit_sect
);
while
(
MidiInDev
[
wDevID
].
lpQueueHdr
)
{
MidiInDev
[
wDevID
].
lpQueueHdr
->
dwFlags
&=
~
MHDR_INQUEUE
;
MidiInDev
[
wDevID
].
lpQueueHdr
->
dwFlags
|=
MHDR_DONE
;
/* FIXME: when called from 16 bit, lpQueueHdr needs to be a segmented ptr */
MIDI_NotifyClient
(
wDevID
,
MIM_LONGDATA
,
(
DWORD_PTR
)
MidiInDev
[
wDevID
].
lpQueueHdr
,
dwTime
);
MidiInDev
[
wDevID
].
lpQueueHdr
=
MidiInDev
[
wDevID
].
lpQueueHdr
->
lpNext
;
LPMIDIHDR
lpMidiHdr
=
MidiInDev
[
wDevID
].
lpQueueHdr
;
MidiInDev
[
wDevID
].
lpQueueHdr
=
lpMidiHdr
->
lpNext
;
lpMidiHdr
->
dwFlags
&=
~
MHDR_INQUEUE
;
lpMidiHdr
->
dwFlags
|=
MHDR_DONE
;
MIDI_NotifyClient
(
wDevID
,
MIM_LONGDATA
,
(
DWORD_PTR
)
lpMidiHdr
,
dwTime
);
}
LeaveCriticalSection
(
&
crit_sect
);
...
...
@@ -726,10 +725,6 @@ static DWORD modOpen(WORD wDevID, LPMIDIOPENDESC lpDesc, DWORD dwFlags)
WARN
(
"bad dwFlags
\n
"
);
return
MMSYSERR_INVALFLAG
;
}
if
(
!
MidiOutDev
[
wDevID
].
bEnabled
)
{
TRACE
(
"disabled wDevID
\n
"
);
return
MMSYSERR_NOTENABLED
;
}
MidiOutDev
[
wDevID
].
lpExtra
=
0
;
...
...
dlls/wineoss.drv/midi.c
View file @
b0fc000c
...
...
@@ -563,9 +563,9 @@ static void midReceiveChar(WORD wDevID, unsigned char value, DWORD dwTime)
}
if
(
sbfb
&&
lpMidiHdr
!=
NULL
)
{
lpMidiHdr
=
MidiInDev
[
wDevID
].
lpQueueHdr
;
MidiInDev
[
wDevID
].
lpQueueHdr
=
lpMidiHdr
->
lpNext
;
lpMidiHdr
->
dwFlags
&=
~
MHDR_INQUEUE
;
lpMidiHdr
->
dwFlags
|=
MHDR_DONE
;
MidiInDev
[
wDevID
].
lpQueueHdr
=
lpMidiHdr
->
lpNext
;
MIDI_NotifyClient
(
wDevID
,
MIM_LONGDATA
,
(
DWORD_PTR
)
lpMidiHdr
,
dwTime
);
}
LeaveCriticalSection
(
&
crit_sect
);
...
...
@@ -906,12 +906,11 @@ static DWORD midReset(WORD wDevID)
EnterCriticalSection
(
&
crit_sect
);
while
(
MidiInDev
[
wDevID
].
lpQueueHdr
)
{
MidiInDev
[
wDevID
].
lpQueueHdr
->
dwFlags
&=
~
MHDR_INQUEUE
;
MidiInDev
[
wDevID
].
lpQueueHdr
->
dwFlags
|=
MHDR_DONE
;
/* FIXME: when called from 16 bit, lpQueueHdr needs to be a segmented ptr */
MIDI_NotifyClient
(
wDevID
,
MIM_LONGDATA
,
(
DWORD_PTR
)
MidiInDev
[
wDevID
].
lpQueueHdr
,
dwTime
);
MidiInDev
[
wDevID
].
lpQueueHdr
=
MidiInDev
[
wDevID
].
lpQueueHdr
->
lpNext
;
LPMIDIHDR
lpMidiHdr
=
MidiInDev
[
wDevID
].
lpQueueHdr
;
MidiInDev
[
wDevID
].
lpQueueHdr
=
lpMidiHdr
->
lpNext
;
lpMidiHdr
->
dwFlags
&=
~
MHDR_INQUEUE
;
lpMidiHdr
->
dwFlags
|=
MHDR_DONE
;
MIDI_NotifyClient
(
wDevID
,
MIM_LONGDATA
,
(
DWORD_PTR
)
lpMidiHdr
,
dwTime
);
}
LeaveCriticalSection
(
&
crit_sect
);
...
...
@@ -1102,10 +1101,6 @@ static DWORD modOpen(WORD wDevID, LPMIDIOPENDESC lpDesc, DWORD dwFlags)
WARN
(
"bad dwFlags
\n
"
);
return
MMSYSERR_INVALFLAG
;
}
if
(
!
MidiOutDev
[
wDevID
].
bEnabled
)
{
TRACE
(
"disabled wDevID
\n
"
);
return
MMSYSERR_NOTENABLED
;
}
MidiOutDev
[
wDevID
].
lpExtra
=
0
;
...
...
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