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
c4e30797
Commit
c4e30797
authored
Jan 06, 2015
by
Mark Harmstone
Committed by
Alexandre Julliard
Jan 07, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dsound: Parse speaker config.
parent
d999fd0d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
53 additions
and
7 deletions
+53
-7
dsound.c
dlls/dsound/dsound.c
+28
-0
dsound_private.h
dlls/dsound/dsound_private.h
+5
-0
primary.c
dlls/dsound/primary.c
+20
-7
No files found.
dlls/dsound/dsound.c
View file @
c4e30797
...
...
@@ -23,6 +23,7 @@
#include <assert.h>
#include <stdarg.h>
#include <stdio.h>
#include <math.h>
#define COBJMACROS
#define NONAMELESSSTRUCT
...
...
@@ -585,6 +586,31 @@ HRESULT WINAPI DirectSoundCreate8(
return
hr
;
}
void
DSOUND_ParseSpeakerConfig
(
DirectSoundDevice
*
device
)
{
switch
(
DSSPEAKER_CONFIG
(
device
->
speaker_config
))
{
case
DSSPEAKER_MONO
:
device
->
speaker_angles
[
0
]
=
M_PI
/
180
.
0
f
*
0
.
0
f
;
device
->
speaker_num
[
0
]
=
0
;
device
->
num_speakers
=
1
;
device
->
lfe_channel
=
-
1
;
break
;
case
DSSPEAKER_STEREO
:
case
DSSPEAKER_HEADPHONE
:
device
->
speaker_angles
[
0
]
=
M_PI
/
180
.
0
f
*
-
90
.
0
f
;
device
->
speaker_angles
[
1
]
=
M_PI
/
180
.
0
f
*
90
.
0
f
;
device
->
speaker_num
[
0
]
=
0
;
/* Left */
device
->
speaker_num
[
1
]
=
1
;
/* Right */
device
->
num_speakers
=
2
;
device
->
lfe_channel
=
-
1
;
break
;
default:
WARN
(
"unknown speaker_config %u
\n
"
,
device
->
speaker_config
);
}
}
/*******************************************************************************
* DirectSoundDevice
*/
...
...
@@ -605,6 +631,8 @@ static HRESULT DirectSoundDevice_Create(DirectSoundDevice ** ppDevice)
device
->
state
=
STATE_STOPPED
;
device
->
speaker_config
=
DSSPEAKER_COMBINED
(
DSSPEAKER_STEREO
,
DSSPEAKER_GEOMETRY_WIDE
);
DSOUND_ParseSpeakerConfig
(
device
);
/* 3D listener initial parameters */
device
->
ds3dl
.
dwSize
=
sizeof
(
DS3DLISTENER
);
device
->
ds3dl
.
vPosition
.
x
=
0
.
0
;
...
...
dlls/dsound/dsound_private.h
View file @
c4e30797
...
...
@@ -78,6 +78,10 @@ struct DirectSoundDevice
CRITICAL_SECTION
mixlock
;
IDirectSoundBufferImpl
*
primary
;
DWORD
speaker_config
;
float
speaker_angles
[
DS_MAX_CHANNELS
];
int
speaker_num
[
DS_MAX_CHANNELS
];
int
num_speakers
;
int
lfe_channel
;
float
*
mix_buffer
,
*
tmp_buffer
;
DWORD
tmp_buffer_len
,
mix_buffer_len
;
...
...
@@ -199,6 +203,7 @@ HRESULT IKsPrivatePropertySetImpl_Create(REFIID riid, void **ppv) DECLSPEC_HIDDE
HRESULT
DSOUND_Create
(
REFIID
riid
,
void
**
ppv
)
DECLSPEC_HIDDEN
;
HRESULT
DSOUND_Create8
(
REFIID
riid
,
void
**
ppv
)
DECLSPEC_HIDDEN
;
HRESULT
IDirectSoundImpl_Create
(
IUnknown
*
outer_unk
,
REFIID
riid
,
void
**
ppv
,
BOOL
has_ds8
)
DECLSPEC_HIDDEN
;
void
DSOUND_ParseSpeakerConfig
(
DirectSoundDevice
*
device
)
DECLSPEC_HIDDEN
;
/* primary.c */
...
...
dlls/dsound/primary.c
View file @
c4e30797
...
...
@@ -58,6 +58,21 @@ static DWORD DSOUND_fraglen(DirectSoundDevice *device)
return
ret
;
}
static
DWORD
speaker_config_to_channel_mask
(
DWORD
speaker_config
)
{
switch
(
DSSPEAKER_CONFIG
(
speaker_config
))
{
case
DSSPEAKER_MONO
:
return
SPEAKER_FRONT_LEFT
;
case
DSSPEAKER_STEREO
:
case
DSSPEAKER_HEADPHONE
:
return
SPEAKER_FRONT_LEFT
|
SPEAKER_FRONT_RIGHT
;
}
WARN
(
"unknown speaker_config %u
\n
"
,
speaker_config
);
return
SPEAKER_FRONT_LEFT
|
SPEAKER_FRONT_RIGHT
;
}
static
HRESULT
DSOUND_WaveFormat
(
DirectSoundDevice
*
device
,
IAudioClient
*
client
,
BOOL
forcewave
,
WAVEFORMATEX
**
wfx
)
{
...
...
@@ -72,15 +87,11 @@ static HRESULT DSOUND_WaveFormat(DirectSoundDevice *device, IAudioClient *client
if
(
FAILED
(
hr
))
return
hr
;
if
(
mixwfe
->
Format
.
nChannels
>
2
)
{
static
int
once
;
if
(
!
once
++
)
FIXME
(
"Limiting channels to 2 due to lack of multichannel support
\n
"
);
mixwfe
->
Format
.
nChannels
=
2
;
if
(
mixwfe
->
Format
.
nChannels
>
device
->
num_speakers
)
{
mixwfe
->
Format
.
nChannels
=
device
->
num_speakers
;
mixwfe
->
Format
.
nBlockAlign
=
mixwfe
->
Format
.
nChannels
*
mixwfe
->
Format
.
wBitsPerSample
/
8
;
mixwfe
->
Format
.
nAvgBytesPerSec
=
mixwfe
->
Format
.
nSamplesPerSec
*
mixwfe
->
Format
.
nBlockAlign
;
mixwfe
->
dwChannelMask
=
SPEAKER_FRONT_LEFT
|
SPEAKER_FRONT_RIGHT
;
mixwfe
->
dwChannelMask
=
speaker_config_to_channel_mask
(
device
->
speaker_config
)
;
}
if
(
!
IsEqualGUID
(
&
mixwfe
->
SubFormat
,
&
KSDATAFORMAT_SUBTYPE_IEEE_FLOAT
))
{
...
...
@@ -226,6 +237,8 @@ HRESULT DSOUND_ReopenDevice(DirectSoundDevice *device, BOOL forcewave)
device
->
speaker_config
=
DSOUND_FindSpeakerConfig
(
device
->
mmdevice
);
DSOUND_ParseSpeakerConfig
(
device
);
hres
=
DSOUND_WaveFormat
(
device
,
device
->
client
,
forcewave
,
&
wfx
);
if
(
FAILED
(
hres
))
{
IAudioClient_Release
(
device
->
client
);
...
...
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