Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-2-2
Commits
15e0df6c
Commit
15e0df6c
authored
Mar 01, 2014
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mmdevice: merge volume/mute update code and fix initial volume
parent
9577406b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
35 deletions
+42
-35
modules/audio_output/mmdevice.c
modules/audio_output/mmdevice.c
+42
-35
No files found.
modules/audio_output/mmdevice.c
View file @
15e0df6c
...
...
@@ -287,8 +287,9 @@ vlc_AudioSessionEvents_OnSimpleVolumeChanged(IAudioSessionEvents *this,
msg_Dbg
(
aout
,
"simple volume changed: %f, muting %sabled"
,
vol
,
mute
?
"en"
:
"dis"
);
aout_VolumeReport
(
aout
,
cbrtf
(
vol
));
aout_MuteReport
(
aout
,
mute
==
TRUE
);
EnterCriticalSection
(
&
sys
->
lock
);
WakeConditionVariable
(
&
sys
->
work
);
/* implicit state: vol & mute */
LeaveCriticalSection
(
&
sys
->
lock
);
(
void
)
ctx
;
return
S_OK
;
}
...
...
@@ -772,24 +773,7 @@ static HRESULT MMSession(audio_output_t *aout, IMMDeviceEnumerator *it)
hr
=
IAudioSessionManager_GetSimpleAudioVolume
(
manager
,
guid
,
FALSE
,
&
volume
);
if
(
SUCCEEDED
(
hr
))
{
/* Get current values _after_ registering for notification */
BOOL
mute
;
float
level
;
hr
=
ISimpleAudioVolume_GetMute
(
volume
,
&
mute
);
if
(
SUCCEEDED
(
hr
))
aout_MuteReport
(
aout
,
mute
!=
FALSE
);
else
msg_Err
(
aout
,
"cannot get mute (error 0x%lx)"
,
hr
);
hr
=
ISimpleAudioVolume_GetMasterVolume
(
volume
,
&
level
);
if
(
SUCCEEDED
(
hr
))
aout_VolumeReport
(
aout
,
level
);
else
msg_Err
(
aout
,
"cannot get mute (error 0x%lx)"
,
hr
);
}
else
if
(
FAILED
(
hr
))
msg_Err
(
aout
,
"cannot get simple volume (error 0x%lx)"
,
hr
);
}
else
...
...
@@ -802,32 +786,54 @@ static HRESULT MMSession(audio_output_t *aout, IMMDeviceEnumerator *it)
/* Main loop (adjust volume as long as device is unchanged) */
while
(
sys
->
device
==
NULL
)
{
if
(
volume
!=
NULL
&&
sys
->
volume
>=
0
.
f
)
if
(
volume
!=
NULL
)
{
if
(
sys
->
volume
>
1
.
f
)
sys
->
volume
=
1
.
f
;
float
level
;
hr
=
ISimpleAudioVolume_GetMasterVolume
(
volume
,
&
level
);
if
(
SUCCEEDED
(
hr
))
aout_VolumeReport
(
aout
,
cbrtf
(
level
));
else
msg_Err
(
aout
,
"cannot get master volume (error 0x%lx)"
,
hr
);
hr
=
ISimpleAudioVolume_SetMasterVolume
(
volume
,
sys
->
volume
,
NULL
);
if
(
FAILED
(
hr
))
msg_Err
(
aout
,
"cannot set master volume (error 0x%lx)"
,
hr
);
level
=
sys
->
volume
;
if
(
level
>=
0
.
f
)
{
if
(
level
>
1
.
f
)
level
=
1
.
f
;
hr
=
ISimpleAudioVolume_SetMasterVolume
(
volume
,
level
,
NULL
);
if
(
FAILED
(
hr
))
msg_Err
(
aout
,
"cannot set master volume (error 0x%lx)"
,
hr
);
}
sys
->
volume
=
-
1
.
f
;
}
if
(
volume
!=
NULL
&&
sys
->
mute
>=
0
)
{
hr
=
ISimpleAudioVolume_SetMute
(
volume
,
sys
->
mute
?
TRUE
:
FALSE
,
NULL
);
if
(
FAILED
(
hr
))
msg_Err
(
aout
,
"cannot set mute (error 0x%lx)"
,
hr
);
BOOL
mute
;
hr
=
ISimpleAudioVolume_GetMute
(
volume
,
&
mute
);
if
(
SUCCEEDED
(
hr
))
aout_MuteReport
(
aout
,
mute
!=
FALSE
);
else
msg_Err
(
aout
,
"cannot get mute (error 0x%lx)"
,
hr
);
if
(
sys
->
mute
>=
0
)
{
mute
=
sys
->
mute
?
TRUE
:
FALSE
;
hr
=
ISimpleAudioVolume_SetMute
(
volume
,
mute
,
NULL
);
if
(
FAILED
(
hr
))
msg_Err
(
aout
,
"cannot set mute (error 0x%lx)"
,
hr
);
}
sys
->
mute
=
-
1
;
}
SleepConditionVariableCS
(
&
sys
->
work
,
&
sys
->
lock
,
INFINITE
);
}
LeaveCriticalSection
(
&
sys
->
lock
);
if
(
manager
!=
NULL
)
{
/* Deregister session control */
{
/* Deregister callbacks *without* the lock */
if
(
volume
!=
NULL
)
ISimpleAudioVolume_Release
(
volume
);
...
...
@@ -841,6 +847,7 @@ static HRESULT MMSession(audio_output_t *aout, IMMDeviceEnumerator *it)
IAudioSessionManager_Release
(
manager
);
}
EnterCriticalSection
(
&
sys
->
lock
);
IMMDevice_Release
(
sys
->
dev
);
sys
->
dev
=
NULL
;
return
S_OK
;
...
...
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