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
9f05f545
Commit
9f05f545
authored
May 04, 2012
by
Christian Costa
Committed by
Alexandre Julliard
May 07, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dmusic: Midi message takes 4 bytes space but only 3 are relevant.
parent
d1cfbbb6
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
6 deletions
+48
-6
buffer.c
dlls/dmusic/buffer.c
+2
-2
dmusic.c
dlls/dmusic/tests/dmusic.c
+46
-4
No files found.
dlls/dmusic/buffer.c
View file @
9f05f545
...
...
@@ -109,7 +109,7 @@ static HRESULT WINAPI IDirectMusicBufferImpl_PackStructured(LPDIRECTMUSICBUFFER
if
(
new_write_pos
>
This
->
size
)
return
DMUS_E_BUFFER_FULL
;
/* Channel_message 0xZZYYXX is a midi message where XX = status byte, YY = byte 1 and ZZ = byte 2 */
/* Channel_message 0xZZYYXX
(3 bytes)
is a midi message where XX = status byte, YY = byte 1 and ZZ = byte 2 */
if
(
!
(
channel_message
&
0x80
))
{
...
...
@@ -120,7 +120,7 @@ static HRESULT WINAPI IDirectMusicBufferImpl_PackStructured(LPDIRECTMUSICBUFFER
if
(
!
This
->
write_pos
)
This
->
start_time
=
ref_time
;
header
.
cbEvent
=
sizeof
(
channel_message
);
header
.
cbEvent
=
3
;
/* Midi message takes 4 bytes space but only 3 are relevant */
header
.
dwChannelGroup
=
channel_group
;
header
.
rtDelta
=
ref_time
-
This
->
start_time
;
header
.
dwFlags
=
DMUS_EVENT_STRUCTURED
;
...
...
dlls/dmusic/tests/dmusic.c
View file @
9f05f545
...
...
@@ -29,7 +29,7 @@
#include "dmusici.h"
#include "dmksctrl.h"
static
inline
char
*
debugstr_guid
(
CONST
GUID
*
id
)
static
inline
c
onst
c
har
*
debugstr_guid
(
CONST
GUID
*
id
)
{
static
char
string
[
39
];
sprintf
(
string
,
"{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}"
,
...
...
@@ -39,6 +39,16 @@ static inline char* debugstr_guid(CONST GUID *id)
return
string
;
}
static
inline
const
char
*
debugstr_longlong
(
ULONGLONG
ll
)
{
static
char
string
[
17
];
if
(
sizeof
(
ll
)
>
sizeof
(
unsigned
long
)
&&
ll
>>
32
)
sprintf
(
string
,
"%lx%08lx"
,
(
unsigned
long
)(
ll
>>
32
),
(
unsigned
long
)
ll
);
else
sprintf
(
string
,
"%lx"
,
(
unsigned
long
)
ll
);
return
string
;
}
static
void
test_dmusic
(
void
)
{
IDirectMusic
*
dmusic
=
NULL
;
...
...
@@ -127,6 +137,7 @@ static void test_dmbuffer(void)
DWORD
size
;
DWORD
bytes
;
REFERENCE_TIME
time
;
LPBYTE
data
;
hr
=
CoCreateInstance
(
&
CLSID_DirectMusic
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID_IDirectMusic
,
(
LPVOID
*
)
&
dmusic
);
if
(
hr
!=
S_OK
)
...
...
@@ -161,18 +172,49 @@ static void test_dmbuffer(void)
ok
(
hr
==
DMUS_E_INVALID_EVENT
,
"IDirectMusicBuffer_PackStructured returned %x
\n
"
,
hr
);
hr
=
IDirectMusicBuffer_PackStructured
(
dmbuffer
,
20
,
0
,
0x000090
);
/* note on : chan 0, note 0 & vel 0 */
ok
(
hr
==
S_OK
,
"IDirectMusicBuffer_PackStructured returned %x
\n
"
,
hr
);
hr
=
IDirectMusicBuffer_PackStructured
(
dmbuffer
,
30
,
0
,
0x000080
);
/* note off : chan 0, note 0 & vel 0 */
ok
(
hr
==
S_OK
,
"IDirectMusicBuffer_PackStructured returned %x
\n
"
,
hr
);
hr
=
IDirectMusicBuffer_GetUsedBytes
(
dmbuffer
,
&
bytes
);
ok
(
hr
==
S_OK
,
"IDirectMusicBuffer_GetUsedBytes returned %x
\n
"
,
hr
);
ok
(
bytes
==
24
,
"Buffer size is %u instead of 0
\n
"
,
bytes
);
ok
(
bytes
==
48
,
"Buffer size is %u instead of 48
\n
"
,
bytes
);
hr
=
IDirectMusicBuffer_GetStartTime
(
dmbuffer
,
&
time
);
ok
(
hr
==
S_OK
,
"IDirectMusicBuffer_GetStartTime returned %x
\n
"
,
hr
);
ok
(
time
==
20
,
"Buffer start time is wrong
\n
"
);
hr
=
IDirectMusicBuffer_SetStartTime
(
dmbuffer
,
3
0
);
hr
=
IDirectMusicBuffer_SetStartTime
(
dmbuffer
,
4
0
);
ok
(
hr
==
S_OK
,
"IDirectMusicBuffer_GetStartTime returned %x
\n
"
,
hr
);
hr
=
IDirectMusicBuffer_GetStartTime
(
dmbuffer
,
&
time
);
ok
(
hr
==
S_OK
,
"IDirectMusicBuffer_GetStartTime returned %x
\n
"
,
hr
);
ok
(
time
==
30
,
"Buffer start time is wrong
\n
"
);
ok
(
time
==
40
,
"Buffer start time is wrong
\n
"
);
hr
=
IDirectMusicBuffer_GetRawBufferPtr
(
dmbuffer
,
&
data
);
ok
(
hr
==
S_OK
,
"IDirectMusicBuffer_GetRawBufferPtr returned %x
\n
"
,
hr
);
if
(
hr
==
S_OK
)
{
DMUS_EVENTHEADER
*
header
;
DWORD
message
;
/* Check message 1 */
header
=
(
DMUS_EVENTHEADER
*
)
data
;
data
+=
sizeof
(
DMUS_EVENTHEADER
);
ok
(
header
->
cbEvent
==
3
,
"cbEvent is %u instead of 3
\n
"
,
header
->
cbEvent
);
ok
(
header
->
dwChannelGroup
==
0
,
"dwChannelGroup is %u instead of 0
\n
"
,
header
->
dwChannelGroup
);
ok
(
header
->
rtDelta
==
0
,
"rtDelta is %s instead of 0
\n
"
,
debugstr_longlong
(
header
->
rtDelta
));
ok
(
header
->
dwFlags
==
DMUS_EVENT_STRUCTURED
,
"dwFlags is %x instead of %x
\n
"
,
header
->
dwFlags
,
DMUS_EVENT_STRUCTURED
);
message
=
*
(
DWORD
*
)
data
&
0xffffff
;
/* Only 3 bytes are relevant */
data
+=
sizeof
(
DWORD
);
ok
(
message
==
0x000090
,
"Message is %0x instead of 0x000090
\n
"
,
message
);
/* Check message 2 */
header
=
(
DMUS_EVENTHEADER
*
)
data
;
data
+=
sizeof
(
DMUS_EVENTHEADER
);
ok
(
header
->
cbEvent
==
3
,
"cbEvent is %u instead of 3
\n
"
,
header
->
cbEvent
);
ok
(
header
->
dwChannelGroup
==
0
,
"dwChannelGroup is %u instead of 0
\n
"
,
header
->
dwChannelGroup
);
ok
(
header
->
rtDelta
==
10
,
"rtDelta is %s instead of 0
\n
"
,
debugstr_longlong
(
header
->
rtDelta
));
ok
(
header
->
dwFlags
==
DMUS_EVENT_STRUCTURED
,
"dwFlags is %x instead of %x
\n
"
,
header
->
dwFlags
,
DMUS_EVENT_STRUCTURED
);
message
=
*
(
DWORD
*
)
data
&
0xffffff
;
/* Only 3 bytes are relevant */
ok
(
message
==
0x000080
,
"Message 2 is %0x instead of 0x000080
\n
"
,
message
);
}
if
(
dmbuffer
)
IDirectMusicBuffer_Release
(
dmbuffer
);
...
...
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