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
52ae3fad
Commit
52ae3fad
authored
Sep 14, 2023
by
Rémi Bernon
Committed by
Alexandre Julliard
Sep 14, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dmime: Implement MusicToReferenceTime and ReferenceToMusicTime.
parent
d407b3ca
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
18 deletions
+42
-18
performance.c
dlls/dmime/performance.c
+28
-4
dmime.c
dlls/dmime/tests/dmime.c
+14
-14
No files found.
dlls/dmime/performance.c
View file @
52ae3fad
...
...
@@ -66,6 +66,7 @@ struct performance
struct
DMUS_PMSGItem
*
imm_head
;
IReferenceClock
*
master_clock
;
REFERENCE_TIME
init_time
;
};
typedef
struct
DMUS_PMSGItem
DMUS_PMSGItem
;
...
...
@@ -451,20 +452,40 @@ static HRESULT WINAPI performance_SendPMsg(IDirectMusicPerformance8 *iface, DMUS
}
static
HRESULT
WINAPI
performance_MusicToReferenceTime
(
IDirectMusicPerformance8
*
iface
,
MUSIC_TIME
m
tTime
,
REFERENCE_TIME
*
prtT
ime
)
MUSIC_TIME
m
usic_time
,
REFERENCE_TIME
*
t
ime
)
{
struct
performance
*
This
=
impl_from_IDirectMusicPerformance8
(
iface
);
FIXME
(
"(%p, %ld, %p): stub
\n
"
,
This
,
mtTime
,
prtTime
);
FIXME
(
"(%p, %ld, %p): semi-stub
\n
"
,
This
,
music_time
,
time
);
if
(
!
time
)
return
E_POINTER
;
*
time
=
0
;
if
(
!
This
->
master_clock
)
return
DMUS_E_NO_MASTER_CLOCK
;
/* FIXME: This should be (music_time * 60) / (DMUS_PPQ * tempo)
* but it gives innacurate results */
*
time
=
This
->
init_time
+
(
music_time
*
6510
);
return
S_OK
;
}
static
HRESULT
WINAPI
performance_ReferenceToMusicTime
(
IDirectMusicPerformance8
*
iface
,
REFERENCE_TIME
rtTime
,
MUSIC_TIME
*
pmtT
ime
)
REFERENCE_TIME
time
,
MUSIC_TIME
*
music_t
ime
)
{
struct
performance
*
This
=
impl_from_IDirectMusicPerformance8
(
iface
);
FIXME
(
"(%p, 0x%s, %p): stub
\n
"
,
This
,
wine_dbgstr_longlong
(
rtTime
),
pmtTime
);
FIXME
(
"(%p, %I64d, %p): semi-stub
\n
"
,
This
,
time
,
music_time
);
if
(
!
music_time
)
return
E_POINTER
;
*
music_time
=
0
;
if
(
!
This
->
master_clock
)
return
DMUS_E_NO_MASTER_CLOCK
;
/* FIXME: This should be (time * DMUS_PPQ * tempo) / 60
* but it gives innacurate results */
*
music_time
=
(
time
-
This
->
init_time
)
/
6510
;
return
S_OK
;
}
...
...
@@ -1006,6 +1027,9 @@ static HRESULT WINAPI performance_InitAudio(IDirectMusicPerformance8 *iface, IDi
*
dmusic
=
(
IDirectMusic
*
)
This
->
dmusic
;
IDirectMusic_AddRef
(
*
dmusic
);
}
if
(
FAILED
(
hr
=
IDirectMusicPerformance8_GetTime
(
iface
,
&
This
->
init_time
,
NULL
)))
return
hr
;
PostMessageToProcessMsgThread
(
This
,
PROCESSMSG_START
);
return
S_OK
;
...
...
dlls/dmime/tests/dmime.c
View file @
52ae3fad
...
...
@@ -1650,18 +1650,18 @@ static void test_performance_time(void)
hr
=
IDirectMusicPerformance_MusicToReferenceTime
(
performance
,
0
,
NULL
);
todo_wine
ok
(
hr
==
E_POINTER
,
"got %#lx
\n
"
,
hr
);
ok
(
hr
==
E_POINTER
,
"got %#lx
\n
"
,
hr
);
time
=
0xdeadbeef
;
hr
=
IDirectMusicPerformance_MusicToReferenceTime
(
performance
,
0
,
&
time
);
todo_wine
ok
(
hr
==
DMUS_E_NO_MASTER_CLOCK
,
"got %#lx
\n
"
,
hr
);
todo_wine
ok
(
time
==
0
,
"got %I64d
\n
"
,
time
);
ok
(
hr
==
DMUS_E_NO_MASTER_CLOCK
,
"got %#lx
\n
"
,
hr
);
ok
(
time
==
0
,
"got %I64d
\n
"
,
time
);
hr
=
IDirectMusicPerformance_ReferenceToMusicTime
(
performance
,
0
,
NULL
);
todo_wine
ok
(
hr
==
E_POINTER
,
"got %#lx
\n
"
,
hr
);
ok
(
hr
==
E_POINTER
,
"got %#lx
\n
"
,
hr
);
music_time
=
0xdeadbeef
;
hr
=
IDirectMusicPerformance_ReferenceToMusicTime
(
performance
,
0
,
&
music_time
);
todo_wine
ok
(
hr
==
DMUS_E_NO_MASTER_CLOCK
,
"got %#lx
\n
"
,
hr
);
todo_wine
ok
(
music_time
==
0
,
"got %ld
\n
"
,
music_time
);
ok
(
hr
==
DMUS_E_NO_MASTER_CLOCK
,
"got %#lx
\n
"
,
hr
);
ok
(
music_time
==
0
,
"got %ld
\n
"
,
music_time
);
dmusic
=
NULL
;
...
...
@@ -1684,38 +1684,38 @@ static void test_performance_time(void)
time
=
0xdeadbeef
;
hr
=
IDirectMusicPerformance_MusicToReferenceTime
(
performance
,
1
,
&
time
);
ok
(
hr
==
S_OK
,
"got %#lx
\n
"
,
hr
);
todo_wine
ok
(
time
-
init_time
>=
6505
,
"got %I64d
\n
"
,
time
-
init_time
);
ok
(
time
-
init_time
>=
6505
,
"got %I64d
\n
"
,
time
-
init_time
);
ok
(
time
-
init_time
<=
6515
,
"got %I64d
\n
"
,
time
-
init_time
);
time
=
0xdeadbeef
;
hr
=
IDirectMusicPerformance_MusicToReferenceTime
(
performance
,
1000
,
&
time
);
ok
(
hr
==
S_OK
,
"got %#lx
\n
"
,
hr
);
todo_wine
ok
(
time
-
init_time
>=
1000
*
6505
,
"got %I64d
\n
"
,
time
-
init_time
);
ok
(
time
-
init_time
>=
1000
*
6505
,
"got %I64d
\n
"
,
time
-
init_time
);
ok
(
time
-
init_time
<=
1000
*
6515
,
"got %I64d
\n
"
,
time
-
init_time
);
time
=
0xdeadbeef
;
hr
=
IDirectMusicPerformance_MusicToReferenceTime
(
performance
,
2000
,
&
time
);
ok
(
hr
==
S_OK
,
"got %#lx
\n
"
,
hr
);
todo_wine
ok
(
time
-
init_time
>=
2000
*
6505
,
"got %I64d
\n
"
,
time
-
init_time
);
ok
(
time
-
init_time
>=
2000
*
6505
,
"got %I64d
\n
"
,
time
-
init_time
);
ok
(
time
-
init_time
<=
2000
*
6515
,
"got %I64d
\n
"
,
time
-
init_time
);
music_time
=
0xdeadbeef
;
hr
=
IDirectMusicPerformance_ReferenceToMusicTime
(
performance
,
init_time
,
&
music_time
);
ok
(
hr
==
S_OK
,
"got %#lx
\n
"
,
hr
);
todo_wine
ok
(
music_time
==
0
,
"got %ld
\n
"
,
music_time
);
ok
(
music_time
==
0
,
"got %ld
\n
"
,
music_time
);
music_time
=
0xdeadbeef
;
hr
=
IDirectMusicPerformance_ReferenceToMusicTime
(
performance
,
init_time
+
1000
*
6510
,
&
music_time
);
ok
(
hr
==
S_OK
,
"got %#lx
\n
"
,
hr
);
todo_wine
ok
(
music_time
==
1000
,
"got %ld
\n
"
,
music_time
);
ok
(
music_time
==
1000
,
"got %ld
\n
"
,
music_time
);
music_time
=
0xdeadbeef
;
hr
=
IDirectMusicPerformance_ReferenceToMusicTime
(
performance
,
init_time
+
2000
*
6510
,
&
music_time
);
ok
(
hr
==
S_OK
,
"got %#lx
\n
"
,
hr
);
todo_wine
ok
(
music_time
==
2000
,
"got %ld
\n
"
,
music_time
);
ok
(
music_time
==
2000
,
"got %ld
\n
"
,
music_time
);
time
=
0xdeadbeef
;
music_time
=
0xdeadbeef
;
hr
=
IDirectMusicPerformance_GetTime
(
performance
,
&
time
,
&
music_time
);
ok
(
hr
==
S_OK
,
"got %#lx
\n
"
,
hr
);
todo_wine
ok
(
time
-
init_time
<=
200
*
10000
,
"got %I64d
\n
"
,
time
-
init_time
);
todo_wine
ok
(
music_time
==
(
time
-
init_time
)
/
6510
,
"got %ld
\n
"
,
music_time
);
ok
(
time
-
init_time
<=
200
*
10000
,
"got %I64d
\n
"
,
time
-
init_time
);
ok
(
music_time
==
(
time
-
init_time
)
/
6510
,
"got %ld
\n
"
,
music_time
);
hr
=
IDirectMusicPerformance_CloseDown
(
performance
);
...
...
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