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
dcf8767b
Commit
dcf8767b
authored
Jan 11, 2015
by
Mark Harmstone
Committed by
Alexandre Julliard
Jan 13, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winealsa: Do not destroy remapping info on IsFormatSupported.
parent
b34b2cae
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
33 deletions
+29
-33
mmdevdrv.c
dlls/winealsa.drv/mmdevdrv.c
+29
-33
No files found.
dlls/winealsa.drv/mmdevdrv.c
View file @
dcf8767b
...
...
@@ -1130,11 +1130,11 @@ static int alsa_channel_index(DWORD flag)
return
-
1
;
}
static
BOOL
need_remapping
(
ACImpl
*
This
,
const
WAVEFORMATEX
*
fmt
)
static
BOOL
need_remapping
(
ACImpl
*
This
,
const
WAVEFORMATEX
*
fmt
,
int
*
map
)
{
unsigned
int
i
;
for
(
i
=
0
;
i
<
fmt
->
nChannels
;
++
i
){
if
(
This
->
alsa_channel_
map
[
i
]
!=
i
)
if
(
map
[
i
]
!=
i
)
return
TRUE
;
}
return
FALSE
;
...
...
@@ -1166,8 +1166,10 @@ static DWORD get_channel_mask(unsigned int channels)
return
0
;
}
static
HRESULT
map_channels
(
ACImpl
*
This
,
const
WAVEFORMATEX
*
fmt
)
static
HRESULT
map_channels
(
ACImpl
*
This
,
const
WAVEFORMATEX
*
fmt
,
int
*
alsa_channels
,
int
*
map
)
{
BOOL
need_remap
;
if
(
This
->
dataflow
!=
eCapture
&&
(
fmt
->
wFormatTag
==
WAVE_FORMAT_EXTENSIBLE
||
fmt
->
nChannels
>
2
)
){
WAVEFORMATEXTENSIBLE
*
fmtex
=
(
void
*
)
fmt
;
DWORD
mask
,
flag
=
SPEAKER_FRONT_LEFT
;
...
...
@@ -1179,47 +1181,47 @@ static HRESULT map_channels(ACImpl *This, const WAVEFORMATEX *fmt)
else
mask
=
get_channel_mask
(
fmt
->
nChannels
);
This
->
alsa_channels
=
0
;
*
alsa_channels
=
0
;
while
(
i
<
fmt
->
nChannels
&&
!
(
flag
&
SPEAKER_RESERVED
)){
if
(
mask
&
flag
){
This
->
alsa_channel_
map
[
i
]
=
alsa_channel_index
(
flag
);
map
[
i
]
=
alsa_channel_index
(
flag
);
TRACE
(
"Mapping mmdevapi channel %u (0x%x) to ALSA channel %d
\n
"
,
i
,
flag
,
This
->
alsa_channel_
map
[
i
]);
if
(
This
->
alsa_channel_map
[
i
]
>=
This
->
alsa_channels
)
This
->
alsa_channels
=
This
->
alsa_channel_
map
[
i
]
+
1
;
i
,
flag
,
map
[
i
]);
if
(
map
[
i
]
>=
*
alsa_channels
)
*
alsa_channels
=
map
[
i
]
+
1
;
++
i
;
}
flag
<<=
1
;
}
while
(
i
<
fmt
->
nChannels
){
This
->
alsa_channel_map
[
i
]
=
This
->
alsa_channels
;
map
[
i
]
=
*
alsa_channels
;
TRACE
(
"Mapping mmdevapi channel %u to ALSA channel %d
\n
"
,
i
,
This
->
alsa_channel_
map
[
i
]);
++
This
->
alsa_channels
;
i
,
map
[
i
]);
++
*
alsa_channels
;
++
i
;
}
for
(
i
=
0
;
i
<
fmt
->
nChannels
;
++
i
){
if
(
This
->
alsa_channel_
map
[
i
]
==
-
1
){
This
->
alsa_channel_map
[
i
]
=
This
->
alsa_channels
;
++
This
->
alsa_channels
;
if
(
map
[
i
]
==
-
1
){
map
[
i
]
=
*
alsa_channels
;
++
*
alsa_channels
;
TRACE
(
"Remapping mmdevapi channel %u to ALSA channel %d
\n
"
,
i
,
This
->
alsa_channel_
map
[
i
]);
i
,
map
[
i
]);
}
}
This
->
need_remapping
=
need_remapping
(
This
,
fmt
);
TRACE
(
"need_remapping: %u, alsa_channels: %d
\n
"
,
This
->
need_remapping
,
This
->
alsa_channels
);
need_remap
=
need_remapping
(
This
,
fmt
,
map
);
}
else
{
This
->
need_remapping
=
FALSE
;
This
->
alsa_channels
=
fmt
->
nChannels
;
TRACE
(
"need_remapping: %u, alsa_channels: %d
\n
"
,
This
->
need_remapping
,
This
->
alsa_channels
)
;
*
alsa_channels
=
fmt
->
nChannels
;
need_remap
=
FALSE
;
}
return
S_OK
;
TRACE
(
"need_remapping: %u, alsa_channels: %d
\n
"
,
need_remap
,
*
alsa_channels
);
return
need_remap
?
S_OK
:
S_FALSE
;
}
static
void
silence_buffer
(
ACImpl
*
This
,
BYTE
*
buffer
,
UINT32
frames
)
...
...
@@ -1304,11 +1306,7 @@ static HRESULT WINAPI AudioClient_Initialize(IAudioClient *iface,
dump_fmt
(
fmt
);
if
(
FAILED
(
map_channels
(
This
,
fmt
))){
WARN
(
"map_channels failed
\n
"
);
hr
=
AUDCLNT_E_ENDPOINT_CREATE_FAILED
;
goto
exit
;
}
This
->
need_remapping
=
map_channels
(
This
,
fmt
,
&
This
->
alsa_channels
,
This
->
alsa_channel_map
)
==
S_OK
?
TRUE
:
FALSE
;
if
((
err
=
snd_pcm_hw_params_any
(
This
->
pcm_handle
,
This
->
hw_params
))
<
0
){
WARN
(
"Unable to get hw_params: %d (%s)
\n
"
,
err
,
snd_strerror
(
err
));
...
...
@@ -1623,6 +1621,7 @@ static HRESULT WINAPI AudioClient_IsFormatSupported(IAudioClient *iface,
WAVEFORMATEX
*
closest
=
NULL
;
unsigned
int
max
=
0
,
min
=
0
;
int
err
;
int
alsa_channels
,
alsa_channel_map
[
32
];
TRACE
(
"(%p)->(%x, %p, %p)
\n
"
,
This
,
mode
,
fmt
,
out
);
...
...
@@ -1717,12 +1716,9 @@ static HRESULT WINAPI AudioClient_IsFormatSupported(IAudioClient *iface,
closest
->
nChannels
=
min
;
}
if
(
FAILED
(
map_channels
(
This
,
fmt
))){
hr
=
AUDCLNT_E_DEVICE_INVALIDATED
;
WARN
(
"map_channels failed
\n
"
);
goto
exit
;
}
if
(
This
->
alsa_channels
>
max
){
map_channels
(
This
,
fmt
,
&
alsa_channels
,
alsa_channel_map
);
if
(
alsa_channels
>
max
){
hr
=
S_FALSE
;
closest
->
nChannels
=
max
;
}
...
...
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