Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
1a47f36c
Commit
1a47f36c
authored
Apr 26, 2007
by
Emmanuel Maillard
Committed by
Alexandre Julliard
Apr 26, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winecoreaudio: Initial MIDI In Mach message handling.
parent
4903fbed
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
95 additions
and
1 deletion
+95
-1
coremidi.c
dlls/winecoreaudio.drv/coremidi.c
+1
-1
coremidi.h
dlls/winecoreaudio.drv/coremidi.h
+3
-0
midi.c
dlls/winecoreaudio.drv/midi.c
+91
-0
No files found.
dlls/winecoreaudio.drv/coremidi.c
View file @
1a47f36c
...
...
@@ -67,7 +67,7 @@ void MIDIIn_ReadProc(const MIDIPacketList *pktlist, void *refCon, void *connRefC
msg
.
length
=
packet
->
length
;
memcpy
(
msg
.
data
,
packet
->
data
,
sizeof
(
packet
->
data
));
/* send message to Wine */
MIDIIn_SendMessage
(
msg
);
packet
=
MIDIPacketNext
(
packet
);
}
...
...
dlls/winecoreaudio.drv/coremidi.h
View file @
1a47f36c
...
...
@@ -76,4 +76,7 @@ extern MIDIClientRef CoreMIDI_CreateClient(CFStringRef name);
extern
void
CoreMIDI_GetObjectName
(
MIDIObjectRef
obj
,
char
*
name
,
int
size
);
extern
void
MIDIIn_ReadProc
(
const
MIDIPacketList
*
pktlist
,
void
*
refCon
,
void
*
connRefCon
);
/* midi.c */
void
MIDIIn_SendMessage
(
MIDIMessage
msg
);
#endif
dlls/winecoreaudio.drv/midi.c
View file @
1a47f36c
...
...
@@ -76,6 +76,10 @@ typedef struct tagMIDISource {
DWORD
startTime
;
}
MIDISource
;
static
CRITICAL_SECTION
midiInLock
;
/* Critical section for MIDI In */
static
CFStringRef
MIDIInThreadPortName
=
NULL
;
static
DWORD
WINAPI
MIDIIn_MessageThread
(
LPVOID
p
);
#define MAX_MIDI_SYNTHS 1
...
...
@@ -114,6 +118,13 @@ LONG CoreAudio_MIDIInit(void)
destinations
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
MIDIOut_NumDevs
*
sizeof
(
MIDIDestination
));
sources
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
MIDIIn_NumDevs
*
sizeof
(
MIDISource
));
if
(
MIDIIn_NumDevs
>
0
)
{
InitializeCriticalSection
(
&
midiInLock
);
MIDIInThreadPortName
=
CFStringCreateWithFormat
(
kCFAllocatorDefault
,
NULL
,
CFSTR
(
"MIDIInThreadPortName.%u"
),
getpid
());
CreateThread
(
NULL
,
0
,
MIDIIn_MessageThread
,
NULL
,
0
,
NULL
);
}
/* initialize sources */
for
(
i
=
0
;
i
<
MIDIIn_NumDevs
;
i
++
)
{
...
...
@@ -182,6 +193,17 @@ LONG CoreAudio_MIDIInit(void)
LONG
CoreAudio_MIDIRelease
(
void
)
{
TRACE
(
"
\n
"
);
if
(
MIDIIn_NumDevs
>
0
)
{
CFMessagePortRef
messagePort
;
/* Stop CFRunLoop in MIDIIn_MessageThread */
messagePort
=
CFMessagePortCreateRemote
(
kCFAllocatorDefault
,
MIDIInThreadPortName
);
CFMessagePortSendRequest
(
messagePort
,
1
,
NULL
,
0
.
0
,
0
.
0
,
NULL
,
NULL
);
CFRelease
(
messagePort
);
DeleteCriticalSection
(
&
midiInLock
);
}
if
(
wineMIDIClient
)
MIDIClientDispose
(
wineMIDIClient
);
/* MIDIClientDispose will close all ports */
HeapFree
(
GetProcessHeap
(),
0
,
sources
);
...
...
@@ -567,6 +589,75 @@ static DWORD MIDIOut_Reset(WORD wDevID)
return
MMSYSERR_NOERROR
;
}
/*
* MIDI In Mach message handling
*/
/*
* Call from CoreMIDI IO threaded callback,
* we can't call Wine debug channels, critical section or anything using NtCurrentTeb here.
*/
void
MIDIIn_SendMessage
(
MIDIMessage
msg
)
{
CFDataRef
data
;
CFMessagePortRef
messagePort
;
messagePort
=
CFMessagePortCreateRemote
(
kCFAllocatorDefault
,
MIDIInThreadPortName
);
data
=
CFDataCreate
(
kCFAllocatorDefault
,
(
UInt8
*
)
&
msg
,
sizeof
(
msg
));
if
(
data
)
{
CFMessagePortSendRequest
(
messagePort
,
0
,
data
,
0
.
0
,
0
.
0
,
NULL
,
NULL
);
CFRelease
(
data
);
CFRelease
(
messagePort
);
}
}
static
CFDataRef
MIDIIn_MessageHandler
(
CFMessagePortRef
local
,
SInt32
msgid
,
CFDataRef
data
,
void
*
info
)
{
MIDIMessage
*
msg
=
NULL
;
int
i
=
0
;
FIXME
(
"
\n
"
);
switch
(
msgid
)
{
case
0
:
msg
=
(
MIDIMessage
*
)
CFDataGetBytePtr
(
data
);
TRACE
(
"devID=%d
\n
"
,
msg
->
devID
);
for
(
i
=
0
;
i
<
msg
->
length
;
++
i
)
{
TRACE
(
"%02X "
,
msg
->
data
[
i
]);
}
TRACE
(
"
\n
"
);
break
;
default:
CFRunLoopStop
(
CFRunLoopGetCurrent
());
break
;
}
return
NULL
;
}
static
DWORD
WINAPI
MIDIIn_MessageThread
(
LPVOID
p
)
{
CFMessagePortRef
local
;
CFRunLoopSourceRef
source
;
Boolean
info
;
local
=
CFMessagePortCreateLocal
(
kCFAllocatorDefault
,
MIDIInThreadPortName
,
&
MIDIIn_MessageHandler
,
NULL
,
&
info
);
source
=
CFMessagePortCreateRunLoopSource
(
kCFAllocatorDefault
,
local
,
(
CFIndex
)
0
);
CFRunLoopAddSource
(
CFRunLoopGetCurrent
(),
source
,
kCFRunLoopDefaultMode
);
CFRunLoopRun
();
CFRunLoopSourceInvalidate
(
source
);
CFRelease
(
source
);
CFRelease
(
local
);
CFRelease
(
MIDIInThreadPortName
);
MIDIInThreadPortName
=
NULL
;
return
0
;
}
/**************************************************************************
* modMessage
*/
...
...
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