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
76f655db
Commit
76f655db
authored
Jan 05, 2012
by
Jörg Höhle
Committed by
Alexandre Julliard
Jan 06, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winealsa: Unify the checks for wBitsPerSample.
parent
afe7bc06
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
85 deletions
+38
-85
mmdevdrv.c
dlls/winealsa.drv/mmdevdrv.c
+38
-85
No files found.
dlls/winealsa.drv/mmdevdrv.c
View file @
76f655db
...
@@ -718,6 +718,38 @@ static WAVEFORMATEX *clone_format(const WAVEFORMATEX *fmt)
...
@@ -718,6 +718,38 @@ static WAVEFORMATEX *clone_format(const WAVEFORMATEX *fmt)
return
ret
;
return
ret
;
}
}
static
snd_pcm_format_t
alsa_format
(
const
WAVEFORMATEX
*
fmt
)
{
snd_pcm_format_t
format
=
SND_PCM_FORMAT_UNKNOWN
;
const
WAVEFORMATEXTENSIBLE
*
fmtex
=
(
const
WAVEFORMATEXTENSIBLE
*
)
fmt
;
if
(
fmt
->
wFormatTag
==
WAVE_FORMAT_PCM
||
(
fmt
->
wFormatTag
==
WAVE_FORMAT_EXTENSIBLE
&&
IsEqualGUID
(
&
fmtex
->
SubFormat
,
&
KSDATAFORMAT_SUBTYPE_PCM
))){
if
(
fmt
->
wBitsPerSample
==
8
)
format
=
SND_PCM_FORMAT_U8
;
else
if
(
fmt
->
wBitsPerSample
==
16
)
format
=
SND_PCM_FORMAT_S16_LE
;
else
if
(
fmt
->
wBitsPerSample
==
24
)
format
=
SND_PCM_FORMAT_S24_3LE
;
else
if
(
fmt
->
wBitsPerSample
==
32
)
format
=
SND_PCM_FORMAT_S32_LE
;
else
WARN
(
"Unsupported bit depth: %u
\n
"
,
fmt
->
wBitsPerSample
);
}
else
if
(
fmt
->
wFormatTag
==
WAVE_FORMAT_IEEE_FLOAT
||
(
fmt
->
wFormatTag
==
WAVE_FORMAT_EXTENSIBLE
&&
IsEqualGUID
(
&
fmtex
->
SubFormat
,
&
KSDATAFORMAT_SUBTYPE_IEEE_FLOAT
))){
if
(
fmt
->
wBitsPerSample
==
32
)
format
=
SND_PCM_FORMAT_FLOAT_LE
;
else
if
(
fmt
->
wBitsPerSample
==
64
)
format
=
SND_PCM_FORMAT_FLOAT64_LE
;
else
WARN
(
"Unsupported float size: %u
\n
"
,
fmt
->
wBitsPerSample
);
}
else
WARN
(
"Unknown wave format: %04x
\n
"
,
fmt
->
wFormatTag
);
return
format
;
}
static
void
session_init_vols
(
AudioSession
*
session
,
UINT
channels
)
static
void
session_init_vols
(
AudioSession
*
session
,
UINT
channels
)
{
{
if
(
session
->
channel_count
<
channels
){
if
(
session
->
channel_count
<
channels
){
...
@@ -808,7 +840,6 @@ static HRESULT WINAPI AudioClient_Initialize(IAudioClient *iface,
...
@@ -808,7 +840,6 @@ static HRESULT WINAPI AudioClient_Initialize(IAudioClient *iface,
ACImpl
*
This
=
impl_from_IAudioClient
(
iface
);
ACImpl
*
This
=
impl_from_IAudioClient
(
iface
);
snd_pcm_sw_params_t
*
sw_params
=
NULL
;
snd_pcm_sw_params_t
*
sw_params
=
NULL
;
snd_pcm_format_t
format
;
snd_pcm_format_t
format
;
const
WAVEFORMATEXTENSIBLE
*
fmtex
=
(
const
WAVEFORMATEXTENSIBLE
*
)
fmt
;
unsigned
int
rate
,
alsa_period_us
;
unsigned
int
rate
,
alsa_period_us
;
int
err
,
i
;
int
err
,
i
;
HRESULT
hr
=
S_OK
;
HRESULT
hr
=
S_OK
;
...
@@ -878,36 +909,8 @@ static HRESULT WINAPI AudioClient_Initialize(IAudioClient *iface,
...
@@ -878,36 +909,8 @@ static HRESULT WINAPI AudioClient_Initialize(IAudioClient *iface,
goto
exit
;
goto
exit
;
}
}
if
(
fmt
->
wFormatTag
==
WAVE_FORMAT_PCM
||
format
=
alsa_format
(
fmt
);
(
fmt
->
wFormatTag
==
WAVE_FORMAT_EXTENSIBLE
&&
if
(
format
==
SND_PCM_FORMAT_UNKNOWN
){
IsEqualGUID
(
&
fmtex
->
SubFormat
,
&
KSDATAFORMAT_SUBTYPE_PCM
))){
if
(
fmt
->
wBitsPerSample
==
8
)
format
=
SND_PCM_FORMAT_U8
;
else
if
(
fmt
->
wBitsPerSample
==
16
)
format
=
SND_PCM_FORMAT_S16_LE
;
else
if
(
fmt
->
wBitsPerSample
==
24
)
format
=
SND_PCM_FORMAT_S24_3LE
;
else
if
(
fmt
->
wBitsPerSample
==
32
)
format
=
SND_PCM_FORMAT_S32_LE
;
else
{
WARN
(
"Unsupported bit depth: %u
\n
"
,
fmt
->
wBitsPerSample
);
hr
=
AUDCLNT_E_UNSUPPORTED_FORMAT
;
goto
exit
;
}
}
else
if
(
fmt
->
wFormatTag
==
WAVE_FORMAT_IEEE_FLOAT
||
(
fmt
->
wFormatTag
==
WAVE_FORMAT_EXTENSIBLE
&&
IsEqualGUID
(
&
fmtex
->
SubFormat
,
&
KSDATAFORMAT_SUBTYPE_IEEE_FLOAT
))){
if
(
fmt
->
wBitsPerSample
==
32
)
format
=
SND_PCM_FORMAT_FLOAT_LE
;
else
if
(
fmt
->
wBitsPerSample
==
64
)
format
=
SND_PCM_FORMAT_FLOAT64_LE
;
else
{
WARN
(
"Unsupported float size: %u
\n
"
,
fmt
->
wBitsPerSample
);
hr
=
AUDCLNT_E_UNSUPPORTED_FORMAT
;
goto
exit
;
}
}
else
{
WARN
(
"Unknown wave format: %04x
\n
"
,
fmt
->
wFormatTag
);
hr
=
AUDCLNT_E_UNSUPPORTED_FORMAT
;
hr
=
AUDCLNT_E_UNSUPPORTED_FORMAT
;
goto
exit
;
goto
exit
;
}
}
...
@@ -1205,6 +1208,7 @@ static HRESULT WINAPI AudioClient_IsFormatSupported(IAudioClient *iface,
...
@@ -1205,6 +1208,7 @@ static HRESULT WINAPI AudioClient_IsFormatSupported(IAudioClient *iface,
{
{
ACImpl
*
This
=
impl_from_IAudioClient
(
iface
);
ACImpl
*
This
=
impl_from_IAudioClient
(
iface
);
snd_pcm_format_mask_t
*
formats
=
NULL
;
snd_pcm_format_mask_t
*
formats
=
NULL
;
snd_pcm_format_t
format
;
HRESULT
hr
=
S_OK
;
HRESULT
hr
=
S_OK
;
WAVEFORMATEX
*
closest
=
NULL
;
WAVEFORMATEX
*
closest
=
NULL
;
const
WAVEFORMATEXTENSIBLE
*
fmtex
=
(
const
WAVEFORMATEXTENSIBLE
*
)
fmt
;
const
WAVEFORMATEXTENSIBLE
*
fmtex
=
(
const
WAVEFORMATEXTENSIBLE
*
)
fmt
;
...
@@ -1246,60 +1250,9 @@ static HRESULT WINAPI AudioClient_IsFormatSupported(IAudioClient *iface,
...
@@ -1246,60 +1250,9 @@ static HRESULT WINAPI AudioClient_IsFormatSupported(IAudioClient *iface,
}
}
snd_pcm_hw_params_get_format_mask
(
This
->
hw_params
,
formats
);
snd_pcm_hw_params_get_format_mask
(
This
->
hw_params
,
formats
);
format
=
alsa_format
(
fmt
);
if
(
fmt
->
wFormatTag
==
WAVE_FORMAT_PCM
||
if
(
format
==
SND_PCM_FORMAT_UNKNOWN
||
(
fmt
->
wFormatTag
==
WAVE_FORMAT_EXTENSIBLE
&&
!
snd_pcm_format_mask_test
(
formats
,
format
)){
IsEqualGUID
(
&
fmtex
->
SubFormat
,
&
KSDATAFORMAT_SUBTYPE_PCM
))){
switch
(
fmt
->
wBitsPerSample
){
case
8
:
if
(
!
snd_pcm_format_mask_test
(
formats
,
SND_PCM_FORMAT_U8
)){
hr
=
AUDCLNT_E_UNSUPPORTED_FORMAT
;
goto
exit
;
}
break
;
case
16
:
if
(
!
snd_pcm_format_mask_test
(
formats
,
SND_PCM_FORMAT_S16_LE
)){
hr
=
AUDCLNT_E_UNSUPPORTED_FORMAT
;
goto
exit
;
}
break
;
case
24
:
if
(
!
snd_pcm_format_mask_test
(
formats
,
SND_PCM_FORMAT_S24_3LE
)){
hr
=
AUDCLNT_E_UNSUPPORTED_FORMAT
;
goto
exit
;
}
break
;
case
32
:
if
(
!
snd_pcm_format_mask_test
(
formats
,
SND_PCM_FORMAT_S32_LE
)){
hr
=
AUDCLNT_E_UNSUPPORTED_FORMAT
;
goto
exit
;
}
break
;
default:
hr
=
AUDCLNT_E_UNSUPPORTED_FORMAT
;
goto
exit
;
}
}
else
if
(
fmt
->
wFormatTag
==
WAVE_FORMAT_IEEE_FLOAT
||
(
fmt
->
wFormatTag
==
WAVE_FORMAT_EXTENSIBLE
&&
IsEqualGUID
(
&
fmtex
->
SubFormat
,
&
KSDATAFORMAT_SUBTYPE_IEEE_FLOAT
))){
switch
(
fmt
->
wBitsPerSample
){
case
32
:
if
(
!
snd_pcm_format_mask_test
(
formats
,
SND_PCM_FORMAT_FLOAT_LE
)){
hr
=
AUDCLNT_E_UNSUPPORTED_FORMAT
;
goto
exit
;
}
break
;
case
64
:
if
(
!
snd_pcm_format_mask_test
(
formats
,
SND_PCM_FORMAT_FLOAT64_LE
)){
hr
=
AUDCLNT_E_UNSUPPORTED_FORMAT
;
goto
exit
;
}
break
;
default:
hr
=
AUDCLNT_E_UNSUPPORTED_FORMAT
;
goto
exit
;
}
}
else
{
hr
=
AUDCLNT_E_UNSUPPORTED_FORMAT
;
hr
=
AUDCLNT_E_UNSUPPORTED_FORMAT
;
goto
exit
;
goto
exit
;
}
}
...
...
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