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
ab4ef663
Commit
ab4ef663
authored
Dec 12, 2011
by
Alexander E. Patrakov
Committed by
Alexandre Julliard
May 01, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dsound: Clean up cp_fields.
parent
f88f3d41
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
13 deletions
+10
-13
mixer.c
dlls/dsound/mixer.c
+10
-13
No files found.
dlls/dsound/mixer.c
View file @
ab4ef663
...
@@ -269,16 +269,19 @@ void DSOUND_CheckEvent(const IDirectSoundBufferImpl *dsb, DWORD playpos, int len
...
@@ -269,16 +269,19 @@ void DSOUND_CheckEvent(const IDirectSoundBufferImpl *dsb, DWORD playpos, int len
}
}
/**
/**
* Copy
a single frame
from the given input buffer to the given output buffer.
* Copy
frames
from the given input buffer to the given output buffer.
* Translate 8 <-> 16 bits and mono <-> stereo
* Translate 8 <-> 16 bits and mono <-> stereo
*/
*/
static
inline
void
cp_fields
(
const
IDirectSoundBufferImpl
*
dsb
,
const
BYTE
*
ibuf
,
static
inline
void
cp_fields
(
const
IDirectSoundBufferImpl
*
dsb
,
UINT
istride
,
UINT
ostride
,
UINT
count
,
UINT
freqAcc
,
UINT
adj
)
UINT
ostride
,
UINT
count
,
UINT
freqAcc
)
{
{
DWORD
ipos
=
dsb
->
sec_mixpos
;
UINT
istride
=
dsb
->
pwfx
->
nBlockAlign
;
UINT
adj
=
dsb
->
freqAdjust
;
DirectSoundDevice
*
device
=
dsb
->
device
;
DirectSoundDevice
*
device
=
dsb
->
device
;
float
value
;
float
value
;
ULONG
adv
;
ULONG
adv
;
DWORD
ipos
=
dsb
->
sec_mixpos
,
opos
=
0
;
DWORD
opos
=
0
;
while
(
count
--
>
0
)
{
while
(
count
--
>
0
)
{
if
(
device
->
pwfx
->
nChannels
==
dsb
->
pwfx
->
nChannels
||
if
(
device
->
pwfx
->
nChannels
==
dsb
->
pwfx
->
nChannels
||
...
@@ -345,13 +348,10 @@ static inline DWORD DSOUND_BufPtrDiff(DWORD buflen, DWORD ptr1, DWORD ptr2)
...
@@ -345,13 +348,10 @@ static inline DWORD DSOUND_BufPtrDiff(DWORD buflen, DWORD ptr1, DWORD ptr2)
*/
*/
static
void
DSOUND_MixToTemporary
(
const
IDirectSoundBufferImpl
*
dsb
,
DWORD
tmp_len
)
static
void
DSOUND_MixToTemporary
(
const
IDirectSoundBufferImpl
*
dsb
,
DWORD
tmp_len
)
{
{
INT
size
;
BYTE
*
ibp
;
INT
iAdvance
=
dsb
->
pwfx
->
nBlockAlign
;
INT
oAdvance
=
dsb
->
device
->
pwfx
->
nBlockAlign
;
INT
oAdvance
=
dsb
->
device
->
pwfx
->
nBlockAlign
;
INT
size
=
tmp_len
/
oAdvance
;
DWORD
freqAcc
;
DWORD
freqAcc
;
ibp
=
dsb
->
buffer
->
memory
+
dsb
->
sec_mixpos
;
if
(
dsb
->
device
->
tmp_buffer_len
<
tmp_len
||
!
dsb
->
device
->
tmp_buffer
)
if
(
dsb
->
device
->
tmp_buffer_len
<
tmp_len
||
!
dsb
->
device
->
tmp_buffer
)
{
{
dsb
->
device
->
tmp_buffer_len
=
tmp_len
;
dsb
->
device
->
tmp_buffer_len
=
tmp_len
;
...
@@ -361,15 +361,12 @@ static void DSOUND_MixToTemporary(const IDirectSoundBufferImpl *dsb, DWORD tmp_l
...
@@ -361,15 +361,12 @@ static void DSOUND_MixToTemporary(const IDirectSoundBufferImpl *dsb, DWORD tmp_l
dsb
->
device
->
tmp_buffer
=
HeapAlloc
(
GetProcessHeap
(),
0
,
tmp_len
);
dsb
->
device
->
tmp_buffer
=
HeapAlloc
(
GetProcessHeap
(),
0
,
tmp_len
);
}
}
TRACE
(
"(%p, %p)
\n
"
,
dsb
,
ibp
);
size
=
tmp_len
/
oAdvance
;
/* Check for same sample rate */
/* Check for same sample rate */
if
(
dsb
->
freq
==
dsb
->
device
->
pwfx
->
nSamplesPerSec
)
{
if
(
dsb
->
freq
==
dsb
->
device
->
pwfx
->
nSamplesPerSec
)
{
TRACE
(
"(%p) Same sample rate %d = primary %d
\n
"
,
dsb
,
TRACE
(
"(%p) Same sample rate %d = primary %d
\n
"
,
dsb
,
dsb
->
freq
,
dsb
->
device
->
pwfx
->
nSamplesPerSec
);
dsb
->
freq
,
dsb
->
device
->
pwfx
->
nSamplesPerSec
);
cp_fields
(
dsb
,
ibp
,
iAdvance
,
oAdvance
,
size
,
0
,
1
<<
DSOUND_FREQSHIFT
);
cp_fields
(
dsb
,
oAdvance
,
size
,
0
);
return
;
return
;
}
}
...
@@ -379,7 +376,7 @@ static void DSOUND_MixToTemporary(const IDirectSoundBufferImpl *dsb, DWORD tmp_l
...
@@ -379,7 +376,7 @@ static void DSOUND_MixToTemporary(const IDirectSoundBufferImpl *dsb, DWORD tmp_l
DSOUND_secpos_to_bufpos
(
dsb
,
dsb
->
sec_mixpos
,
dsb
->
sec_mixpos
,
&
freqAcc
);
DSOUND_secpos_to_bufpos
(
dsb
,
dsb
->
sec_mixpos
,
dsb
->
sec_mixpos
,
&
freqAcc
);
/* FIXME: Small problem here when we're overwriting buf_mixpos, it then STILL uses old freqAcc, not sure if it matters or not */
/* FIXME: Small problem here when we're overwriting buf_mixpos, it then STILL uses old freqAcc, not sure if it matters or not */
cp_fields
(
dsb
,
ibp
,
iAdvance
,
oAdvance
,
size
,
freqAcc
,
dsb
->
freqAdjust
);
cp_fields
(
dsb
,
oAdvance
,
size
,
freqAcc
);
}
}
/** Apply volume to the given soundbuffer from (primary) position writepos and length len
/** Apply volume to the given soundbuffer from (primary) position writepos and length len
...
...
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