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
d3b5c6bb
Commit
d3b5c6bb
authored
Sep 04, 2023
by
Rémi Bernon
Committed by
Alexandre Julliard
Oct 11, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dmsynth: Parse MIDI events in IDirectMusicSynth_PlayBuffer.
parent
a4e933a3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
54 additions
and
2 deletions
+54
-2
synth.c
dlls/dmsynth/synth.c
+54
-2
No files found.
dlls/dmsynth/synth.c
View file @
d3b5c6bb
...
...
@@ -31,6 +31,8 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
dmsynth
);
#define ROUND_ADDR(addr, mask) ((void *)((UINT_PTR)(addr) & ~(UINT_PTR)(mask)))
#define CONN_SRC_CC2 0x0082
#define CONN_SRC_RPN0 0x0100
...
...
@@ -291,6 +293,13 @@ static void instrument_release(struct instrument *instrument)
}
}
struct
event
{
struct
list
entry
;
LONGLONG
position
;
BYTE
midi
[
3
];
};
struct
synth
{
IDirectMusicSynth8
IDirectMusicSynth8_iface
;
...
...
@@ -306,6 +315,7 @@ struct synth
CRITICAL_SECTION
cs
;
struct
list
instruments
;
struct
list
waves
;
struct
list
events
;
fluid_settings_t
*
fluid_settings
;
fluid_sfont_t
*
fluid_sfont
;
...
...
@@ -366,6 +376,7 @@ static ULONG WINAPI synth_Release(IDirectMusicSynth8 *iface)
if
(
!
ref
)
{
struct
instrument
*
instrument
;
struct
event
*
event
;
struct
wave
*
wave
;
void
*
next
;
...
...
@@ -381,6 +392,12 @@ static ULONG WINAPI synth_Release(IDirectMusicSynth8 *iface)
wave_release
(
wave
);
}
LIST_FOR_EACH_ENTRY_SAFE
(
event
,
next
,
&
This
->
events
,
struct
event
,
entry
)
{
list_remove
(
&
event
->
entry
);
free
(
event
);
}
fluid_sfont_set_data
(
This
->
fluid_sfont
,
NULL
);
delete_fluid_sfont
(
This
->
fluid_sfont
);
This
->
fluid_sfont
=
NULL
;
...
...
@@ -815,11 +832,45 @@ static HRESULT WINAPI synth_Unload(IDirectMusicSynth8 *iface, HANDLE handle,
}
static
HRESULT
WINAPI
synth_PlayBuffer
(
IDirectMusicSynth8
*
iface
,
REFERENCE_TIME
rt
,
BYTE
*
buffer
,
DWORD
size
)
REFERENCE_TIME
time
,
BYTE
*
buffer
,
DWORD
size
)
{
struct
synth
*
This
=
impl_from_IDirectMusicSynth8
(
iface
);
DMUS_EVENTHEADER
*
head
=
(
DMUS_EVENTHEADER
*
)
buffer
;
BYTE
*
end
=
buffer
+
size
,
*
data
;
HRESULT
hr
;
TRACE
(
"(%p, %I64d, %p, %lu)
\n
"
,
This
,
time
,
buffer
,
size
);
while
((
data
=
(
BYTE
*
)(
head
+
1
))
<
end
)
{
DMUS_EVENTHEADER
*
next
=
ROUND_ADDR
(
data
+
head
->
cbEvent
+
7
,
7
);
struct
event
*
event
,
*
next_event
;
LONGLONG
position
;
if
((
BYTE
*
)
next
>
end
)
return
E_INVALIDARG
;
if
(
FAILED
(
hr
=
IDirectMusicSynthSink_RefTimeToSample
(
This
->
sink
,
time
+
head
->
rtDelta
,
&
position
)))
return
hr
;
if
(
!
(
head
->
dwFlags
&
DMUS_EVENT_STRUCTURED
))
FIXME
(
"Unstructured events not implemeted
\n
"
);
else
if
(
head
->
cbEvent
>
3
)
FIXME
(
"Unexpected MIDI event size %lu
\n
"
,
head
->
cbEvent
);
else
{
if
(
!
(
event
=
calloc
(
1
,
sizeof
(
*
event
))))
return
E_OUTOFMEMORY
;
memcpy
(
event
->
midi
,
data
,
head
->
cbEvent
);
event
->
position
=
position
;
EnterCriticalSection
(
&
This
->
cs
);
LIST_FOR_EACH_ENTRY
(
next_event
,
&
This
->
events
,
struct
event
,
entry
)
if
(
next_event
->
position
>=
event
->
position
)
break
;
list_add_before
(
&
next_event
->
entry
,
&
event
->
entry
);
LeaveCriticalSection
(
&
This
->
cs
);
}
FIXME
(
"(%p, 0x%s, %p, %lu): stub
\n
"
,
This
,
wine_dbgstr_longlong
(
rt
),
buffer
,
size
);
head
=
next
;
}
return
S_OK
;
}
...
...
@@ -1244,6 +1295,7 @@ HRESULT synth_create(IUnknown **ret_iface)
list_init
(
&
obj
->
instruments
);
list_init
(
&
obj
->
waves
);
list_init
(
&
obj
->
events
);
if
(
!
(
obj
->
fluid_settings
=
new_fluid_settings
()))
goto
failed
;
if
(
!
(
obj
->
fluid_sfont
=
new_fluid_sfont
(
synth_sfont_get_name
,
synth_sfont_get_preset
,
...
...
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