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
aaad7959
Commit
aaad7959
authored
Apr 02, 2024
by
Paul Gofman
Committed by
Alexandre Julliard
Apr 11, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mmdevapi: Implement SAC_IsAudioObjectFormatSupported().
parent
ba50573f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
66 additions
and
22 deletions
+66
-22
spatialaudio.c
dlls/mmdevapi/spatialaudio.c
+45
-22
spatialaudio.c
dlls/mmdevapi/tests/spatialaudio.c
+21
-0
No files found.
dlls/mmdevapi/spatialaudio.c
View file @
aaad7959
...
@@ -49,6 +49,36 @@ static UINT32 AudioObjectType_to_index(AudioObjectType type)
...
@@ -49,6 +49,36 @@ static UINT32 AudioObjectType_to_index(AudioObjectType type)
return
o
-
2
;
return
o
-
2
;
}
}
static
const
char
*
debugstr_fmtex
(
const
WAVEFORMATEX
*
fmt
)
{
static
char
buf
[
2048
];
if
(
!
fmt
)
{
strcpy
(
buf
,
"(null)"
);
}
else
if
(
fmt
->
wFormatTag
==
WAVE_FORMAT_EXTENSIBLE
)
{
const
WAVEFORMATEXTENSIBLE
*
fmtex
=
(
const
WAVEFORMATEXTENSIBLE
*
)
fmt
;
snprintf
(
buf
,
sizeof
(
buf
),
"tag: 0x%x (%s), ch: %u (mask: 0x%lx), rate: %lu, depth: %u"
,
fmt
->
wFormatTag
,
debugstr_guid
(
&
fmtex
->
SubFormat
),
fmt
->
nChannels
,
fmtex
->
dwChannelMask
,
fmt
->
nSamplesPerSec
,
fmt
->
wBitsPerSample
);
}
else
{
snprintf
(
buf
,
sizeof
(
buf
),
"tag: 0x%x, ch: %u, rate: %lu, depth: %u"
,
fmt
->
wFormatTag
,
fmt
->
nChannels
,
fmt
->
nSamplesPerSec
,
fmt
->
wBitsPerSample
);
}
return
buf
;
}
static
BOOL
formats_equal
(
const
WAVEFORMATEX
*
fmt1
,
const
WAVEFORMATEX
*
fmt2
)
{
return
!
memcmp
(
fmt1
,
fmt2
,
sizeof
(
*
fmt1
))
&&
!
memcmp
(
fmt1
+
1
,
fmt2
+
1
,
fmt1
->
cbSize
);
}
typedef
struct
SpatialAudioImpl
SpatialAudioImpl
;
typedef
struct
SpatialAudioImpl
SpatialAudioImpl
;
typedef
struct
SpatialAudioStreamImpl
SpatialAudioStreamImpl
;
typedef
struct
SpatialAudioStreamImpl
SpatialAudioStreamImpl
;
typedef
struct
SpatialAudioObjectImpl
SpatialAudioObjectImpl
;
typedef
struct
SpatialAudioObjectImpl
SpatialAudioObjectImpl
;
...
@@ -610,9 +640,20 @@ static HRESULT WINAPI SAC_GetMaxFrameCount(ISpatialAudioClient *iface,
...
@@ -610,9 +640,20 @@ static HRESULT WINAPI SAC_GetMaxFrameCount(ISpatialAudioClient *iface,
static
HRESULT
WINAPI
SAC_IsAudioObjectFormatSupported
(
ISpatialAudioClient
*
iface
,
static
HRESULT
WINAPI
SAC_IsAudioObjectFormatSupported
(
ISpatialAudioClient
*
iface
,
const
WAVEFORMATEX
*
format
)
const
WAVEFORMATEX
*
format
)
{
{
SpatialAudioImpl
*
This
=
impl_from_ISpatialAudioClient
(
iface
);
SpatialAudioImpl
*
sac
=
impl_from_ISpatialAudioClient
(
iface
);
FIXME
(
"(%p)->(%p)
\n
"
,
This
,
format
);
return
E_NOTIMPL
;
TRACE
(
"sac %p, format %s.
\n
"
,
sac
,
debugstr_fmtex
(
format
));
if
(
!
format
)
return
E_POINTER
;
if
(
!
formats_equal
(
&
sac
->
object_fmtex
.
Format
,
format
))
{
FIXME
(
"Reporting format %s as unsupported.
\n
"
,
debugstr_fmtex
(
format
));
return
E_INVALIDARG
;
}
return
S_OK
;
}
}
static
HRESULT
WINAPI
SAC_IsSpatialAudioStreamAvailable
(
ISpatialAudioClient
*
iface
,
static
HRESULT
WINAPI
SAC_IsSpatialAudioStreamAvailable
(
ISpatialAudioClient
*
iface
,
...
@@ -630,23 +671,6 @@ static WAVEFORMATEX *clone_fmtex(const WAVEFORMATEX *src)
...
@@ -630,23 +671,6 @@ static WAVEFORMATEX *clone_fmtex(const WAVEFORMATEX *src)
return
r
;
return
r
;
}
}
static
const
char
*
debugstr_fmtex
(
const
WAVEFORMATEX
*
fmt
)
{
static
char
buf
[
2048
];
if
(
fmt
->
wFormatTag
==
WAVE_FORMAT_EXTENSIBLE
){
const
WAVEFORMATEXTENSIBLE
*
fmtex
=
(
const
WAVEFORMATEXTENSIBLE
*
)
fmt
;
snprintf
(
buf
,
sizeof
(
buf
),
"tag: 0x%x (%s), ch: %u (mask: 0x%lx), rate: %lu, depth: %u"
,
fmt
->
wFormatTag
,
debugstr_guid
(
&
fmtex
->
SubFormat
),
fmt
->
nChannels
,
fmtex
->
dwChannelMask
,
fmt
->
nSamplesPerSec
,
fmt
->
wBitsPerSample
);
}
else
{
snprintf
(
buf
,
sizeof
(
buf
),
"tag: 0x%x, ch: %u, rate: %lu, depth: %u"
,
fmt
->
wFormatTag
,
fmt
->
nChannels
,
fmt
->
nSamplesPerSec
,
fmt
->
wBitsPerSample
);
}
return
buf
;
}
static
void
static_mask_to_channels
(
AudioObjectType
static_mask
,
WORD
*
count
,
DWORD
*
mask
,
UINT32
*
map
)
static
void
static_mask_to_channels
(
AudioObjectType
static_mask
,
WORD
*
count
,
DWORD
*
mask
,
UINT32
*
map
)
{
{
UINT32
out_chan
=
0
,
map_idx
=
0
;
UINT32
out_chan
=
0
,
map_idx
=
0
;
...
@@ -776,8 +800,7 @@ static HRESULT WINAPI SAC_ActivateSpatialAudioStream(ISpatialAudioClient *iface,
...
@@ -776,8 +800,7 @@ static HRESULT WINAPI SAC_ActivateSpatialAudioStream(ISpatialAudioClient *iface,
return
E_INVALIDARG
;
return
E_INVALIDARG
;
}
}
if
(
!
params
->
ObjectFormat
||
if
(
!
(
params
->
ObjectFormat
&&
formats_equal
(
params
->
ObjectFormat
,
&
This
->
object_fmtex
.
Format
)))
{
memcmp
(
params
->
ObjectFormat
,
&
This
->
object_fmtex
.
Format
,
sizeof
(
*
params
->
ObjectFormat
)
+
params
->
ObjectFormat
->
cbSize
)){
*
stream
=
NULL
;
*
stream
=
NULL
;
return
AUDCLNT_E_UNSUPPORTED_FORMAT
;
return
AUDCLNT_E_UNSUPPORTED_FORMAT
;
}
}
...
...
dlls/mmdevapi/tests/spatialaudio.c
View file @
aaad7959
...
@@ -64,6 +64,27 @@ static void test_formats(void)
...
@@ -64,6 +64,27 @@ static void test_formats(void)
ok
(
fmt
->
nAvgBytesPerSec
==
192000
,
"Wrong avg bytes per sec, expected 192000 got %lu
\n
"
,
fmt
->
nAvgBytesPerSec
);
ok
(
fmt
->
nAvgBytesPerSec
==
192000
,
"Wrong avg bytes per sec, expected 192000 got %lu
\n
"
,
fmt
->
nAvgBytesPerSec
);
ok
(
fmt
->
cbSize
==
0
,
"Wrong cbSize for simple format, expected 0, got %hu
\n
"
,
fmt
->
cbSize
);
ok
(
fmt
->
cbSize
==
0
,
"Wrong cbSize for simple format, expected 0, got %hu
\n
"
,
fmt
->
cbSize
);
hr
=
ISpatialAudioClient_IsAudioObjectFormatSupported
(
sac
,
NULL
);
ok
(
hr
==
E_POINTER
,
"Got %#lx.
\n
"
,
hr
);
memcpy
(
&
format
,
fmt
,
sizeof
(
format
));
hr
=
ISpatialAudioClient_IsAudioObjectFormatSupported
(
sac
,
&
format
);
ok
(
hr
==
S_OK
,
"Got %#lx.
\n
"
,
hr
);
format
.
nBlockAlign
*=
2
;
hr
=
ISpatialAudioClient_IsAudioObjectFormatSupported
(
sac
,
&
format
);
todo_wine
ok
(
hr
==
S_OK
,
"Got %#lx.
\n
"
,
hr
);
memcpy
(
&
format
,
fmt
,
sizeof
(
format
));
format
.
wBitsPerSample
*=
2
;
hr
=
ISpatialAudioClient_IsAudioObjectFormatSupported
(
sac
,
&
format
);
ok
(
hr
==
E_INVALIDARG
,
"Got %#lx.
\n
"
,
hr
);
memcpy
(
&
format
,
fmt
,
sizeof
(
format
));
format
.
nChannels
=
2
;
hr
=
ISpatialAudioClient_IsAudioObjectFormatSupported
(
sac
,
&
format
);
ok
(
hr
==
E_INVALIDARG
,
"Got %#lx.
\n
"
,
hr
);
memcpy
(
&
format
,
fmt
,
sizeof
(
format
));
memcpy
(
&
format
,
fmt
,
sizeof
(
format
));
IAudioFormatEnumerator_Release
(
afe
);
IAudioFormatEnumerator_Release
(
afe
);
...
...
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