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
8e9dcb66
Commit
8e9dcb66
authored
Jan 16, 2003
by
Francois Gouget
Committed by
Alexandre Julliard
Jan 16, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use the same 8/16bit conversion routines as in pcmconverter.c.
Reorder the two ifs in the first part of cp_fields to simplify the code.
parent
336d8fe2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
43 deletions
+28
-43
mixer.c
dlls/dsound/mixer.c
+28
-43
No files found.
dlls/dsound/mixer.c
View file @
8e9dcb66
...
@@ -117,61 +117,46 @@ void DSOUND_CheckEvent(IDirectSoundBufferImpl *dsb, int len)
...
@@ -117,61 +117,46 @@ void DSOUND_CheckEvent(IDirectSoundBufferImpl *dsb, int len)
}
}
}
}
/* WAV format info can be found at:
*/
/* WAV format info can be found at:
/* */
*
/* http://www.cwi.nl/ftp/audio/AudioFormats.part2 */
* http://www.cwi.nl/ftp/audio/AudioFormats.part2
/* ftp://ftp.cwi.nl/pub/audio/RIFF-format */
* ftp://ftp.cwi.nl/pub/audio/RIFF-format
/* */
*
/* Import points to remember: */
* Import points to remember:
/* */
* 8-bit WAV is unsigned
/* 8-bit WAV is unsigned */
* 16-bit WAV is signed
/* 16-bit WAV is signed
*/
*/
/* Use the same formulas as pcmconverter.c */
static
inline
INT16
cvtU8toS16
(
BYTE
b
yte
)
static
inline
INT16
cvtU8toS16
(
BYTE
b
)
{
{
INT16
s
=
(
byte
-
128
)
<<
8
;
return
(
short
)((
b
+
(
b
<<
8
))
-
32768
);
return
s
;
}
}
static
inline
BYTE
cvtS16toU8
(
INT16
word
)
static
inline
BYTE
cvtS16toU8
(
INT16
s
)
{
{
BYTE
b
=
(
word
+
32768
)
>>
8
;
return
(
s
>>
8
)
^
(
unsigned
char
)
0x80
;
return
b
;
}
}
static
inline
void
cp_fields
(
const
IDirectSoundBufferImpl
*
dsb
,
BYTE
*
ibuf
,
BYTE
*
obuf
)
static
inline
void
cp_fields
(
const
IDirectSoundBufferImpl
*
dsb
,
BYTE
*
ibuf
,
BYTE
*
obuf
)
{
{
INT
fl
=
0
,
fr
=
0
;
INT
fl
,
fr
;
if
(
dsb
->
wfx
.
nChannels
==
2
)
{
if
(
dsb
->
wfx
.
wBitsPerSample
==
8
)
{
if
(
dsb
->
wfx
.
wBitsPerSample
==
8
)
{
if
(
dsound
->
wfx
.
wBitsPerSample
==
8
&&
dsound
->
wfx
.
nChannels
==
dsb
->
wfx
.
nChannels
)
{
/* avoid needless 8->16->8 conversion */
/* avoid needless 8->16->8 conversion */
if
(
(
dsound
->
wfx
.
wBitsPerSample
==
8
)
&&
(
dsound
->
wfx
.
nChannels
==
2
)
)
{
*
obuf
=*
ibuf
;
*
obuf
=*
ibuf
;
if
(
dsb
->
wfx
.
nChannels
==
2
)
*
(
obuf
+
1
)
=*
(
ibuf
+
1
);
*
(
obuf
+
1
)
=*
(
ibuf
+
1
);
return
;
return
;
}
fl
=
cvtU8toS16
(
*
ibuf
);
fr
=
cvtU8toS16
(
*
(
ibuf
+
1
));
}
else
if
(
dsb
->
wfx
.
wBitsPerSample
==
16
)
{
fl
=
*
((
INT16
*
)
ibuf
);
fr
=
*
(((
INT16
*
)
ibuf
)
+
1
);
}
}
else
if
(
dsb
->
wfx
.
nChannels
==
1
)
{
if
(
dsb
->
wfx
.
wBitsPerSample
==
8
)
{
/* avoid needless 8->16->8 conversion */
if
(
(
dsound
->
wfx
.
wBitsPerSample
==
8
)
&&
(
dsound
->
wfx
.
nChannels
==
1
)
)
{
*
obuf
=*
ibuf
;
return
;
}
fl
=
cvtU8toS16
(
*
ibuf
);
fr
=
fl
;
}
else
if
(
dsb
->
wfx
.
wBitsPerSample
==
16
)
{
fl
=
*
((
INT16
*
)
ibuf
);
fr
=
fl
;
}
}
fl
=
cvtU8toS16
(
*
ibuf
);
fr
=
(
dsb
->
wfx
.
nChannels
==
2
?
cvtU8toS16
(
*
(
ibuf
+
1
))
:
fl
);
}
else
{
fl
=
*
((
INT16
*
)
ibuf
);
fr
=
(
dsb
->
wfx
.
nChannels
==
2
?
*
(((
INT16
*
)
ibuf
)
+
1
)
:
fl
);
}
}
if
(
dsound
->
wfx
.
nChannels
==
2
)
{
if
(
dsound
->
wfx
.
nChannels
==
2
)
{
if
(
dsound
->
wfx
.
wBitsPerSample
==
8
)
{
if
(
dsound
->
wfx
.
wBitsPerSample
==
8
)
{
*
obuf
=
cvtS16toU8
(
fl
);
*
obuf
=
cvtS16toU8
(
fl
);
...
...
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