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
25629698
Commit
25629698
authored
Jan 22, 2013
by
Christian Costa
Committed by
Alexandre Julliard
Jan 22, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dmusic: Add support for loading articulations.
parent
c90a1e5e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
75 additions
and
1 deletion
+75
-1
dmusic_private.h
dlls/dmusic/dmusic_private.h
+7
-0
instrument.c
dlls/dmusic/instrument.c
+68
-1
No files found.
dlls/dmusic/dmusic_private.h
View file @
25629698
...
...
@@ -85,6 +85,11 @@ typedef struct instrument_region {
BOOL
loop_present
;
}
instrument_region
;
typedef
struct
instrument_articulation
{
CONNECTIONLIST
connections_list
;
CONNECTION
*
connections
;
}
instrument_articulation
;
/*****************************************************************************
* ClassFactory
*/
...
...
@@ -245,6 +250,8 @@ struct IDirectMusicInstrumentImpl {
/* instrument data */
BOOL
loaded
;
instrument_region
*
regions
;
ULONG
nb_articulations
;
instrument_articulation
*
articulations
;
};
static
inline
IDirectMusicInstrumentImpl
*
impl_from_IDirectMusicInstrument
(
IDirectMusicInstrument
*
iface
)
...
...
dlls/dmusic/instrument.c
View file @
25629698
...
...
@@ -76,7 +76,12 @@ static ULONG WINAPI IDirectMusicInstrumentImpl_Release(LPDIRECTMUSICINSTRUMENT i
if
(
!
ref
)
{
ULONG
i
;
HeapFree
(
GetProcessHeap
(),
0
,
This
->
regions
);
for
(
i
=
0
;
i
<
This
->
nb_articulations
;
i
++
)
HeapFree
(
GetProcessHeap
(),
0
,
This
->
articulations
->
connections
);
HeapFree
(
GetProcessHeap
(),
0
,
This
->
articulations
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
}
...
...
@@ -243,6 +248,42 @@ static HRESULT load_region(IDirectMusicInstrumentImpl *This, IStream *stream, in
return
S_OK
;
}
static
HRESULT
load_articulation
(
IDirectMusicInstrumentImpl
*
This
,
IStream
*
stream
,
ULONG
length
)
{
HRESULT
ret
;
instrument_articulation
*
articulation
;
if
(
!
This
->
articulations
)
This
->
articulations
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
This
->
articulations
));
else
This
->
articulations
=
HeapReAlloc
(
GetProcessHeap
(),
0
,
This
->
articulations
,
sizeof
(
*
This
->
articulations
)
*
(
This
->
nb_articulations
+
1
));
if
(
!
This
->
articulations
)
return
E_OUTOFMEMORY
;
articulation
=
&
This
->
articulations
[
This
->
nb_articulations
];
ret
=
read_from_stream
(
stream
,
&
articulation
->
connections_list
,
sizeof
(
CONNECTIONLIST
));
if
(
FAILED
(
ret
))
return
ret
;
articulation
->
connections
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
CONNECTION
)
*
articulation
->
connections_list
.
cConnections
);
if
(
!
articulation
->
connections
)
return
E_OUTOFMEMORY
;
ret
=
read_from_stream
(
stream
,
articulation
->
connections
,
sizeof
(
CONNECTION
)
*
articulation
->
connections_list
.
cConnections
);
if
(
FAILED
(
ret
))
{
HeapFree
(
GetProcessHeap
(),
0
,
articulation
->
connections
);
return
ret
;
}
subtract_bytes
(
length
,
sizeof
(
CONNECTIONLIST
)
+
sizeof
(
CONNECTION
)
*
articulation
->
connections_list
.
cConnections
);
This
->
nb_articulations
++
;
return
S_OK
;
}
/* Function that loads all instrument data and which is called from IDirectMusicCollection_GetInstrument as in native */
HRESULT
IDirectMusicInstrumentImpl_CustomLoad
(
IDirectMusicInstrument
*
iface
,
IStream
*
stream
)
{
...
...
@@ -323,7 +364,7 @@ HRESULT IDirectMusicInstrumentImpl_CustomLoad(IDirectMusicInstrument *iface, ISt
if
(
chunk
.
fccID
==
FOURCC_RGN
)
{
TRACE
(
"RGN chunk (region
list
): %u bytes
\n
"
,
chunk
.
dwSize
);
TRACE
(
"RGN chunk (region): %u bytes
\n
"
,
chunk
.
dwSize
);
hr
=
load_region
(
This
,
stream
,
&
This
->
regions
[
i
++
],
chunk
.
dwSize
-
sizeof
(
chunk
.
fccID
));
}
else
...
...
@@ -338,6 +379,32 @@ HRESULT IDirectMusicInstrumentImpl_CustomLoad(IDirectMusicInstrument *iface, ISt
}
break
;
case
FOURCC_LART
:
TRACE
(
"LART chunk (articulations list): %u bytes
\n
"
,
size
);
while
(
size
)
{
hr
=
read_from_stream
(
stream
,
&
chunk
,
sizeof
(
chunk
));
if
(
FAILED
(
hr
))
goto
error
;
if
(
chunk
.
fccID
==
FOURCC_ART1
)
{
TRACE
(
"ART1 chunk (level 1 articulation): %u bytes
\n
"
,
chunk
.
dwSize
);
hr
=
load_articulation
(
This
,
stream
,
chunk
.
dwSize
);
}
else
{
TRACE
(
"Unknown chunk %s: %u bytes
\n
"
,
debugstr_fourcc
(
chunk
.
fccID
),
chunk
.
dwSize
);
hr
=
advance_stream
(
stream
,
chunk
.
dwSize
);
}
if
(
FAILED
(
hr
))
goto
error
;
size
=
subtract_bytes
(
size
,
chunk
.
dwSize
+
sizeof
(
chunk
));
}
break
;
default:
TRACE
(
"Unknown chunk %s: %u bytes
\n
"
,
debugstr_fourcc
(
chunk
.
fccID
),
chunk
.
dwSize
);
...
...
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