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
454283ec
Commit
454283ec
authored
May 26, 2023
by
Shaun Ren
Committed by
Alexandre Julliard
Jun 09, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sapi: Implement ISpMMSysAudio::Get/SetDeviceId.
parent
682ad1c1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
69 additions
and
6 deletions
+69
-6
Makefile.in
dlls/sapi/Makefile.in
+1
-0
mmaudio.c
dlls/sapi/mmaudio.c
+27
-5
Makefile.in
dlls/sapi/tests/Makefile.in
+1
-1
mmaudio.c
dlls/sapi/tests/mmaudio.c
+40
-0
No files found.
dlls/sapi/Makefile.in
View file @
454283ec
MODULE
=
sapi.dll
MODULE
=
sapi.dll
IMPORTS
=
uuid ole32 user32 advapi32
IMPORTS
=
uuid ole32 user32 advapi32
DELAYIMPORTS
=
winmm
C_SRCS
=
\
C_SRCS
=
\
automation.c
\
automation.c
\
...
...
dlls/sapi/mmaudio.c
View file @
454283ec
...
@@ -47,6 +47,8 @@ struct mmaudio
...
@@ -47,6 +47,8 @@ struct mmaudio
enum
flow_type
flow
;
enum
flow_type
flow
;
ISpObjectToken
*
token
;
ISpObjectToken
*
token
;
UINT
device_id
;
CRITICAL_SECTION
cs
;
};
};
static
inline
struct
mmaudio
*
impl_from_ISpEventSource
(
ISpEventSource
*
iface
)
static
inline
struct
mmaudio
*
impl_from_ISpEventSource
(
ISpEventSource
*
iface
)
...
@@ -356,6 +358,7 @@ static ULONG WINAPI mmsysaudio_Release(ISpMMSysAudio *iface)
...
@@ -356,6 +358,7 @@ static ULONG WINAPI mmsysaudio_Release(ISpMMSysAudio *iface)
if
(
!
ref
)
if
(
!
ref
)
{
{
if
(
This
->
token
)
ISpObjectToken_Release
(
This
->
token
);
if
(
This
->
token
)
ISpObjectToken_Release
(
This
->
token
);
DeleteCriticalSection
(
&
This
->
cs
);
heap_free
(
This
);
heap_free
(
This
);
}
}
...
@@ -531,16 +534,33 @@ static HRESULT WINAPI mmsysaudio_SetBufferNotifySize(ISpMMSysAudio *iface, ULONG
...
@@ -531,16 +534,33 @@ static HRESULT WINAPI mmsysaudio_SetBufferNotifySize(ISpMMSysAudio *iface, ULONG
static
HRESULT
WINAPI
mmsysaudio_GetDeviceId
(
ISpMMSysAudio
*
iface
,
UINT
*
id
)
static
HRESULT
WINAPI
mmsysaudio_GetDeviceId
(
ISpMMSysAudio
*
iface
,
UINT
*
id
)
{
{
FIXME
(
"(%p, %p): stub.
\n
"
,
iface
,
id
);
struct
mmaudio
*
This
=
impl_from_ISpMMSysAudio
(
iface
);
return
E_NOTIMPL
;
TRACE
(
"(%p, %p).
\n
"
,
iface
,
id
);
if
(
!
id
)
return
E_POINTER
;
EnterCriticalSection
(
&
This
->
cs
);
*
id
=
This
->
device_id
;
LeaveCriticalSection
(
&
This
->
cs
);
return
S_OK
;
}
}
static
HRESULT
WINAPI
mmsysaudio_SetDeviceId
(
ISpMMSysAudio
*
iface
,
UINT
id
)
static
HRESULT
WINAPI
mmsysaudio_SetDeviceId
(
ISpMMSysAudio
*
iface
,
UINT
id
)
{
{
FIXME
(
"(%p, %u): stub.
\n
"
,
iface
,
id
);
struct
mmaudio
*
This
=
impl_from_ISpMMSysAudio
(
iface
);
return
E_NOTIMPL
;
TRACE
(
"(%p, %u).
\n
"
,
iface
,
id
);
if
(
id
!=
WAVE_MAPPER
&&
id
>=
waveOutGetNumDevs
())
return
E_INVALIDARG
;
EnterCriticalSection
(
&
This
->
cs
);
This
->
device_id
=
id
;
LeaveCriticalSection
(
&
This
->
cs
);
return
S_OK
;
}
}
static
HRESULT
WINAPI
mmsysaudio_GetMMHandle
(
ISpMMSysAudio
*
iface
,
void
**
handle
)
static
HRESULT
WINAPI
mmsysaudio_GetMMHandle
(
ISpMMSysAudio
*
iface
,
void
**
handle
)
...
@@ -620,9 +640,11 @@ static HRESULT mmaudio_create(IUnknown *outer, REFIID iid, void **obj, enum flow
...
@@ -620,9 +640,11 @@ static HRESULT mmaudio_create(IUnknown *outer, REFIID iid, void **obj, enum flow
This
->
flow
=
flow
;
This
->
flow
=
flow
;
This
->
token
=
NULL
;
This
->
token
=
NULL
;
This
->
device_id
=
WAVE_MAPPER
;
hr
=
ISpMMSysAudio_QueryInterface
(
&
This
->
ISpMMSysAudio_iface
,
iid
,
obj
);
InitializeCriticalSection
(
&
This
->
cs
);
hr
=
ISpMMSysAudio_QueryInterface
(
&
This
->
ISpMMSysAudio_iface
,
iid
,
obj
);
ISpMMSysAudio_Release
(
&
This
->
ISpMMSysAudio_iface
);
ISpMMSysAudio_Release
(
&
This
->
ISpMMSysAudio_iface
);
return
hr
;
return
hr
;
}
}
...
...
dlls/sapi/tests/Makefile.in
View file @
454283ec
TESTDLL
=
sapi.dll
TESTDLL
=
sapi.dll
IMPORTS
=
ole32 user32 advapi32
IMPORTS
=
ole32 user32 advapi32
winmm
C_SRCS
=
\
C_SRCS
=
\
automation.c
\
automation.c
\
...
...
dlls/sapi/tests/mmaudio.c
View file @
454283ec
...
@@ -60,9 +60,49 @@ static void test_interfaces(void)
...
@@ -60,9 +60,49 @@ static void test_interfaces(void)
ISpObjectWithToken_Release
(
obj_with_token
);
ISpObjectWithToken_Release
(
obj_with_token
);
}
}
static
void
test_device_id
(
void
)
{
ISpMMSysAudio
*
mmaudio
;
UINT
id
,
num_devs
;
HRESULT
hr
;
hr
=
CoCreateInstance
(
&
CLSID_SpMMAudioOut
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID_ISpMMSysAudio
,
(
void
**
)
&
mmaudio
);
ok
(
hr
==
S_OK
,
"failed to create SpMMAudioOut instance: %#lx.
\n
"
,
hr
);
id
=
0xdeadbeef
;
hr
=
ISpMMSysAudio_GetDeviceId
(
mmaudio
,
&
id
);
ok
(
hr
==
S_OK
,
"got %#lx.
\n
"
,
hr
);
ok
(
id
==
WAVE_MAPPER
,
"got %#x.
\n
"
,
id
);
hr
=
ISpMMSysAudio_SetDeviceId
(
mmaudio
,
WAVE_MAPPER
);
ok
(
hr
==
S_OK
,
"got %#lx.
\n
"
,
hr
);
num_devs
=
waveOutGetNumDevs
();
if
(
num_devs
==
0
)
{
skip
(
"no wave out devices.
\n
"
);
ISpMMSysAudio_Release
(
mmaudio
);
return
;
}
hr
=
ISpMMSysAudio_SetDeviceId
(
mmaudio
,
num_devs
);
ok
(
hr
==
E_INVALIDARG
,
"got %#lx.
\n
"
,
hr
);
hr
=
ISpMMSysAudio_SetDeviceId
(
mmaudio
,
0
);
ok
(
hr
==
S_OK
||
broken
(
hr
==
S_FALSE
)
/* Windows */
,
"got %#lx.
\n
"
,
hr
);
id
=
0xdeadbeef
;
hr
=
ISpMMSysAudio_GetDeviceId
(
mmaudio
,
&
id
);
ok
(
hr
==
S_OK
,
"got %#lx.
\n
"
,
hr
);
ok
(
id
==
0
,
"got %u.
\n
"
,
id
);
ISpMMSysAudio_Release
(
mmaudio
);
}
START_TEST
(
mmaudio
)
START_TEST
(
mmaudio
)
{
{
CoInitialize
(
NULL
);
CoInitialize
(
NULL
);
test_interfaces
();
test_interfaces
();
test_device_id
();
CoUninitialize
();
CoUninitialize
();
}
}
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