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
3610b54b
Commit
3610b54b
authored
Sep 05, 2023
by
Rémi Bernon
Committed by
Alexandre Julliard
Sep 05, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dmsynth: Implement SampleToRefTime and RefTimeToSample.
parent
10da838a
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
9 deletions
+41
-9
synthsink.c
dlls/dmsynth/synthsink.c
+34
-2
dmsynth.c
dlls/dmsynth/tests/dmsynth.c
+7
-7
No files found.
dlls/dmsynth/synthsink.c
View file @
3610b54b
...
...
@@ -45,6 +45,25 @@ static inline struct synth_sink *impl_from_IDirectMusicSynthSink(IDirectMusicSyn
return
CONTAINING_RECORD
(
iface
,
struct
synth_sink
,
IDirectMusicSynthSink_iface
);
}
static
void
synth_sink_get_format
(
struct
synth_sink
*
This
,
WAVEFORMATEX
*
format
)
{
DWORD
size
=
sizeof
(
*
format
);
HRESULT
hr
;
format
->
wFormatTag
=
WAVE_FORMAT_PCM
;
format
->
nChannels
=
2
;
format
->
wBitsPerSample
=
16
;
format
->
nSamplesPerSec
=
22050
;
format
->
nBlockAlign
=
format
->
nChannels
*
format
->
wBitsPerSample
/
8
;
format
->
nAvgBytesPerSec
=
format
->
nSamplesPerSec
*
format
->
nBlockAlign
;
if
(
This
->
synth
)
{
if
(
FAILED
(
hr
=
IDirectMusicSynth_GetFormat
(
This
->
synth
,
format
,
&
size
)))
WARN
(
"Failed to get synth buffer format, hr %#lx
\n
"
,
hr
);
}
}
static
HRESULT
synth_sink_activate
(
struct
synth_sink
*
This
)
{
HRESULT
hr
;
...
...
@@ -183,8 +202,14 @@ static HRESULT WINAPI synth_sink_SampleToRefTime(IDirectMusicSynthSink *iface,
LONGLONG
sample_time
,
REFERENCE_TIME
*
ref_time
)
{
struct
synth_sink
*
This
=
impl_from_IDirectMusicSynthSink
(
iface
);
WAVEFORMATEX
format
;
TRACE
(
"(%p)->(%I64d, %p)
\n
"
,
This
,
sample_time
,
ref_time
);
if
(
!
ref_time
)
return
E_POINTER
;
FIXME
(
"(%p)->(0x%s, %p): stub
\n
"
,
This
,
wine_dbgstr_longlong
(
sample_time
),
ref_time
);
synth_sink_get_format
(
This
,
&
format
);
*
ref_time
=
This
->
activate_time
+
((
sample_time
*
10000
)
/
format
.
nSamplesPerSec
)
*
1000
;
return
S_OK
;
}
...
...
@@ -193,8 +218,15 @@ static HRESULT WINAPI synth_sink_RefTimeToSample(IDirectMusicSynthSink *iface,
REFERENCE_TIME
ref_time
,
LONGLONG
*
sample_time
)
{
struct
synth_sink
*
This
=
impl_from_IDirectMusicSynthSink
(
iface
);
WAVEFORMATEX
format
;
TRACE
(
"(%p)->(%I64d, %p)
\n
"
,
This
,
ref_time
,
sample_time
);
if
(
!
sample_time
)
return
E_POINTER
;
FIXME
(
"(%p)->(0x%s, %p): stub
\n
"
,
This
,
wine_dbgstr_longlong
(
ref_time
),
sample_time
);
synth_sink_get_format
(
This
,
&
format
);
ref_time
-=
This
->
activate_time
;
*
sample_time
=
((
ref_time
/
1000
)
*
format
.
nSamplesPerSec
)
/
10000
;
return
S_OK
;
}
...
...
dlls/dmsynth/tests/dmsynth.c
View file @
3610b54b
...
...
@@ -1197,18 +1197,18 @@ static void test_IDirectMusicSynthSink(void)
ok
(
hr
==
S_OK
,
"got %#lx
\n
"
,
hr
);
hr
=
IDirectMusicSynthSink_SampleToRefTime
(
sink
,
0
,
NULL
);
todo_wine
ok
(
hr
==
E_POINTER
,
"got %#lx
\n
"
,
hr
);
ok
(
hr
==
E_POINTER
,
"got %#lx
\n
"
,
hr
);
time
=
0xdeadbeef
;
hr
=
IDirectMusicSynthSink_SampleToRefTime
(
sink
,
10
,
&
time
);
ok
(
hr
==
S_OK
,
"got %#lx
\n
"
,
hr
);
todo_wine
ok
(
time
==
4000
,
"got %I64d
\n
"
,
time
);
ok
(
time
==
4000
,
"got %I64d
\n
"
,
time
);
hr
=
IDirectMusicSynthSink_RefTimeToSample
(
sink
,
0
,
NULL
);
todo_wine
ok
(
hr
==
E_POINTER
,
"got %#lx
\n
"
,
hr
);
ok
(
hr
==
E_POINTER
,
"got %#lx
\n
"
,
hr
);
sample
=
0xdeadbeef
;
hr
=
IDirectMusicSynthSink_RefTimeToSample
(
sink
,
4000
,
&
sample
);
ok
(
hr
==
S_OK
,
"got %#lx
\n
"
,
hr
);
todo_wine
ok
(
sample
==
8
,
"got %I64d
\n
"
,
sample
);
ok
(
sample
==
8
,
"got %I64d
\n
"
,
sample
);
hr
=
IDirectMusicSynthSink_GetDesiredBufferSize
(
sink
,
&
size
);
ok
(
hr
==
DMUS_E_SYNTHNOTCONFIGURED
,
"got %#lx
\n
"
,
hr
);
...
...
@@ -1273,12 +1273,12 @@ static void test_IDirectMusicSynthSink(void)
sample
=
0xdeadbeef
;
hr
=
IDirectMusicSynthSink_RefTimeToSample
(
sink
,
time
,
&
sample
);
ok
(
hr
==
S_OK
,
"got %#lx
\n
"
,
hr
);
todo_wine
ok
(
sample
<=
3000
,
"got %I64d
\n
"
,
sample
);
ok
(
sample
<=
3000
,
"got %I64d
\n
"
,
sample
);
tmp_time
=
time
+
1
;
hr
=
IDirectMusicSynthSink_SampleToRefTime
(
sink
,
sample
,
&
tmp_time
);
ok
(
hr
==
S_OK
,
"got %#lx
\n
"
,
hr
);
todo_wine
ok
(
tmp_time
<=
time
,
"got %I64d
\n
"
,
tmp_time
-
time
);
ok
(
time
-
tmp_time
<=
5000
,
"got %I64d
\n
"
,
t
ime
-
t
mp_time
);
ok
(
tmp_time
<=
time
,
"got %I64d
\n
"
,
tmp_time
-
time
);
ok
(
time
-
tmp_time
<=
5000
,
"got %I64d
\n
"
,
tmp_time
);
/* latency clock now works fine */
tmp_time
=
time
;
...
...
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