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
36e845ce
Commit
36e845ce
authored
Mar 02, 2005
by
Jeremy White
Committed by
Alexandre Julliard
Mar 02, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Aggressively round up to the proper alignment when reporting position
on streams where we are converting up.
parent
21222772
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
5 deletions
+50
-5
wavemap.c
dlls/winmm/wavemap/wavemap.c
+50
-5
No files found.
dlls/winmm/wavemap/wavemap.c
View file @
36e845ce
...
@@ -418,14 +418,59 @@ static DWORD wodUnprepare(WAVEMAPDATA* wom, LPWAVEHDR lpWaveHdrSrc, DWORD dwPara
...
@@ -418,14 +418,59 @@ static DWORD wodUnprepare(WAVEMAPDATA* wom, LPWAVEHDR lpWaveHdrSrc, DWORD dwPara
static
DWORD
wodGetPosition
(
WAVEMAPDATA
*
wom
,
LPMMTIME
lpTime
,
DWORD
dwParam2
)
static
DWORD
wodGetPosition
(
WAVEMAPDATA
*
wom
,
LPMMTIME
lpTime
,
DWORD
dwParam2
)
{
{
DWORD
val
;
DWORD
val
;
MMTIME
timepos
;
TRACE
(
"(%p %p %08lx)
\n
"
,
wom
,
lpTime
,
dwParam2
);
TRACE
(
"(%p %p %08lx)
\n
"
,
wom
,
lpTime
,
dwParam2
);
val
=
waveOutGetPosition
(
wom
->
u
.
out
.
hInnerWave
,
lpTime
,
dwParam2
);
memcpy
(
&
timepos
,
lpTime
,
sizeof
(
timepos
));
if
(
lpTime
->
wType
==
TIME_BYTES
)
lpTime
->
u
.
cb
=
MulDiv
(
lpTime
->
u
.
cb
,
wom
->
avgSpeedOuter
,
wom
->
avgSpeedInner
);
/* For TIME_MS, we're going to recalculate using TIME_BYTES */
if
(
lpTime
->
wType
==
TIME_SAMPLES
)
if
(
lpTime
->
wType
==
TIME_MS
)
lpTime
->
u
.
cb
=
MulDiv
(
lpTime
->
u
.
cb
,
wom
->
nSamplesPerSecOuter
,
wom
->
nSamplesPerSecInner
);
timepos
.
wType
=
TIME_BYTES
;
val
=
waveOutGetPosition
(
wom
->
u
.
out
.
hInnerWave
,
&
timepos
,
dwParam2
);
if
(
lpTime
->
wType
==
TIME_BYTES
||
lpTime
->
wType
==
TIME_MS
)
{
DWORD
dwInnerSamplesPerOuter
=
wom
->
nSamplesPerSecInner
/
wom
->
nSamplesPerSecOuter
;
if
(
dwInnerSamplesPerOuter
>
0
)
{
DWORD
dwInnerBytesPerSample
=
wom
->
avgSpeedInner
/
wom
->
nSamplesPerSecInner
;
DWORD
dwInnerBytesPerOuterSample
=
dwInnerBytesPerSample
*
dwInnerSamplesPerOuter
;
DWORD
remainder
=
0
;
/* If we are up sampling (going from lower sample rate to higher),
** we need to make a special accomodation for times when we've
** written a partial output sample. This happens frequently
** to us because we use msacm to do our up sampling, and it
** will up sample on an unaligned basis.
** For example, if you convert a 2 byte wide 8,000 'outer'
** buffer to a 2 byte wide 48,000 inner device, you would
** expect 2 bytes of input to produce 12 bytes of output.
** Instead, msacm will produce 8 bytes of output.
** But reporting our position as 1 byte of output is
** nonsensical; the output buffer position needs to be
** aligned on outer sample size, and aggressively rounded up.
*/
remainder
=
timepos
.
u
.
cb
%
dwInnerBytesPerOuterSample
;
if
(
remainder
>
0
)
{
timepos
.
u
.
cb
-=
remainder
;
timepos
.
u
.
cb
+=
dwInnerBytesPerOuterSample
;
}
}
lpTime
->
u
.
cb
=
MulDiv
(
timepos
.
u
.
cb
,
wom
->
avgSpeedOuter
,
wom
->
avgSpeedInner
);
/* Once we have the TIME_BYTES right, we can easily convert to TIME_MS */
if
(
lpTime
->
wType
==
TIME_MS
)
lpTime
->
u
.
cb
=
MulDiv
(
lpTime
->
u
.
cb
,
1000
,
wom
->
avgSpeedOuter
);
}
else
if
(
lpTime
->
wType
==
TIME_SAMPLES
)
lpTime
->
u
.
cb
=
MulDiv
(
timepos
.
u
.
cb
,
wom
->
nSamplesPerSecOuter
,
wom
->
nSamplesPerSecInner
);
else
/* other time types don't require conversion */
/* other time types don't require conversion */
lpTime
->
u
=
timepos
.
u
;
return
val
;
return
val
;
}
}
...
...
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