Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
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
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
Show 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,
...
@@ -287,8 +287,9 @@ vlc_AudioSessionEvents_OnSimpleVolumeChanged(IAudioSessionEvents *this,
msg_Dbg
(
aout
,
"simple volume changed: %f, muting %sabled"
,
vol
,
msg_Dbg
(
aout
,
"simple volume changed: %f, muting %sabled"
,
vol
,
mute
?
"en"
:
"dis"
);
mute
?
"en"
:
"dis"
);
aout_VolumeReport
(
aout
,
cbrtf
(
vol
));
EnterCriticalSection
(
&
sys
->
lock
);
aout_MuteReport
(
aout
,
mute
==
TRUE
);
WakeConditionVariable
(
&
sys
->
work
);
/* implicit state: vol & mute */
LeaveCriticalSection
(
&
sys
->
lock
);
(
void
)
ctx
;
(
void
)
ctx
;
return
S_OK
;
return
S_OK
;
}
}
...
@@ -772,24 +773,7 @@ static HRESULT MMSession(audio_output_t *aout, IMMDeviceEnumerator *it)
...
@@ -772,24 +773,7 @@ static HRESULT MMSession(audio_output_t *aout, IMMDeviceEnumerator *it)
hr
=
IAudioSessionManager_GetSimpleAudioVolume
(
manager
,
guid
,
FALSE
,
hr
=
IAudioSessionManager_GetSimpleAudioVolume
(
manager
,
guid
,
FALSE
,
&
volume
);
&
volume
);
if
(
SUCCEEDED
(
hr
))
if
(
FAILED
(
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
msg_Err
(
aout
,
"cannot get simple volume (error 0x%lx)"
,
hr
);
msg_Err
(
aout
,
"cannot get simple volume (error 0x%lx)"
,
hr
);
}
}
else
else
...
@@ -802,32 +786,54 @@ static HRESULT MMSession(audio_output_t *aout, IMMDeviceEnumerator *it)
...
@@ -802,32 +786,54 @@ static HRESULT MMSession(audio_output_t *aout, IMMDeviceEnumerator *it)
/* Main loop (adjust volume as long as device is unchanged) */
/* Main loop (adjust volume as long as device is unchanged) */
while
(
sys
->
device
==
NULL
)
while
(
sys
->
device
==
NULL
)
{
{
if
(
volume
!=
NULL
&&
sys
->
volume
>=
0
.
f
)
if
(
volume
!=
NULL
)
{
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
);
level
=
sys
->
volume
;
if
(
level
>=
0
.
f
)
{
{
if
(
sys
->
volume
>
1
.
f
)
if
(
level
>
1
.
f
)
sys
->
volume
=
1
.
f
;
level
=
1
.
f
;
hr
=
ISimpleAudioVolume_SetMasterVolume
(
volume
,
sys
->
volume
,
NULL
);
hr
=
ISimpleAudioVolume_SetMasterVolume
(
volume
,
level
,
NULL
);
if
(
FAILED
(
hr
))
if
(
FAILED
(
hr
))
msg_Err
(
aout
,
"cannot set master volume (error 0x%lx)"
,
hr
);
msg_Err
(
aout
,
"cannot set master volume (error 0x%lx)"
,
sys
->
volume
=
-
1
.
f
;
hr
)
;
}
}
sys
->
volume
=
-
1
.
f
;
if
(
volume
!=
NULL
&&
sys
->
mute
>=
0
)
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
)
{
{
hr
=
ISimpleAudioVolume_SetMute
(
volume
,
mute
=
sys
->
mute
?
TRUE
:
FALSE
;
sys
->
mute
?
TRUE
:
FALSE
,
NULL
);
hr
=
ISimpleAudioVolume_SetMute
(
volume
,
mute
,
NULL
);
if
(
FAILED
(
hr
))
if
(
FAILED
(
hr
))
msg_Err
(
aout
,
"cannot set mute (error 0x%lx)"
,
hr
);
msg_Err
(
aout
,
"cannot set mute (error 0x%lx)"
,
hr
);
}
sys
->
mute
=
-
1
;
sys
->
mute
=
-
1
;
}
}
SleepConditionVariableCS
(
&
sys
->
work
,
&
sys
->
lock
,
INFINITE
);
SleepConditionVariableCS
(
&
sys
->
work
,
&
sys
->
lock
,
INFINITE
);
}
}
LeaveCriticalSection
(
&
sys
->
lock
);
if
(
manager
!=
NULL
)
if
(
manager
!=
NULL
)
{
{
/* Deregister callbacks *without* the lock */
/* Deregister session control */
if
(
volume
!=
NULL
)
if
(
volume
!=
NULL
)
ISimpleAudioVolume_Release
(
volume
);
ISimpleAudioVolume_Release
(
volume
);
...
@@ -841,6 +847,7 @@ static HRESULT MMSession(audio_output_t *aout, IMMDeviceEnumerator *it)
...
@@ -841,6 +847,7 @@ static HRESULT MMSession(audio_output_t *aout, IMMDeviceEnumerator *it)
IAudioSessionManager_Release
(
manager
);
IAudioSessionManager_Release
(
manager
);
}
}
EnterCriticalSection
(
&
sys
->
lock
);
IMMDevice_Release
(
sys
->
dev
);
IMMDevice_Release
(
sys
->
dev
);
sys
->
dev
=
NULL
;
sys
->
dev
=
NULL
;
return
S_OK
;
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