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
a418fa26
Commit
a418fa26
authored
May 16, 2012
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wasapi: volume setting support
parent
cbdadbfb
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
3 deletions
+38
-3
modules/audio_output/wasapi.c
modules/audio_output/wasapi.c
+38
-3
No files found.
modules/audio_output/wasapi.c
View file @
a418fa26
...
@@ -51,6 +51,10 @@ struct aout_sys_t
...
@@ -51,6 +51,10 @@ struct aout_sys_t
IAudioClient
*
client
;
IAudioClient
*
client
;
IAudioRenderClient
*
render
;
IAudioRenderClient
*
render
;
IAudioClock
*
clock
;
IAudioClock
*
clock
;
union
{
ISimpleAudioVolume
*
simple
;
}
volume
;
UINT32
frames
;
/**< Total buffer size (frames) */
UINT32
frames
;
/**< Total buffer size (frames) */
HANDLE
ready
;
/**< Semaphore from MTA thread */
HANDLE
ready
;
/**< Semaphore from MTA thread */
HANDLE
done
;
/**< Semaphore to MTA thread */
HANDLE
done
;
/**< Semaphore to MTA thread */
...
@@ -154,12 +158,36 @@ static void Flush(audio_output_t *aout, bool wait)
...
@@ -154,12 +158,36 @@ static void Flush(audio_output_t *aout, bool wait)
CoUninitialize
();
CoUninitialize
();
}
}
/*static int
VolumeSet(audio_output_t *aout, float vol, bool mute)
static
int
Simple
VolumeSet
(
audio_output_t
*
aout
,
float
vol
,
bool
mute
)
{
{
aout_sys_t
*
sys
=
aout
->
sys
;
aout_sys_t
*
sys
=
aout
->
sys
;
HRESULT
hr
;
if
(
vol
>
1
.)
vol
=
1
.;
/* NOTE: better change volume while muted (if mute is toggled) */
CoInitializeEx
(
NULL
,
COINIT_MULTITHREADED
);
if
(
mute
)
{
hr
=
ISimpleAudioVolume_SetMute
(
sys
->
volume
.
simple
,
true
,
NULL
);
if
(
FAILED
(
hr
))
msg_Warn
(
aout
,
"cannot mute session (error 0x%lx)"
,
hr
);
}
hr
=
ISimpleAudioVolume_SetMasterVolume
(
sys
->
volume
.
simple
,
vol
,
NULL
);
if
(
FAILED
(
hr
))
msg_Warn
(
aout
,
"cannot set session volume (error 0x%lx)"
,
hr
);
if
(
mute
)
{
hr
=
ISimpleAudioVolume_SetMute
(
sys
->
volume
.
simple
,
false
,
NULL
);
if
(
FAILED
(
hr
))
msg_Warn
(
aout
,
"cannot unmute session (error 0x%lx)"
,
hr
);
}
CoUninitialize
();
return
0
;
return
0
;
}
*/
}
static
void
vlc_ToWave
(
WAVEFORMATEXTENSIBLE
*
restrict
wf
,
static
void
vlc_ToWave
(
WAVEFORMATEXTENSIBLE
*
restrict
wf
,
audio_sample_format_t
*
restrict
audio
)
audio_sample_format_t
*
restrict
audio
)
...
@@ -257,6 +285,12 @@ static void MTAThread(void *data)
...
@@ -257,6 +285,12 @@ static void MTAThread(void *data)
if
(
FAILED
(
hr
))
if
(
FAILED
(
hr
))
msg_Warn
(
aout
,
"cannot get audio clock (error 0x%lx)"
,
hr
);
msg_Warn
(
aout
,
"cannot get audio clock (error 0x%lx)"
,
hr
);
/*if (AOUT_FMT_LINEAR(&format) && !exclusive)*/
{
hr
=
IAudioClient_GetService
(
sys
->
client
,
&
IID_ISimpleAudioVolume
,
(
void
**
)
&
sys
->
volume
.
simple
);
}
/* do nothing until the audio session terminates */
/* do nothing until the audio session terminates */
ReleaseSemaphore
(
sys
->
ready
,
1
,
NULL
);
ReleaseSemaphore
(
sys
->
ready
,
1
,
NULL
);
WaitForSingleObject
(
sys
->
done
,
INFINITE
);
WaitForSingleObject
(
sys
->
done
,
INFINITE
);
...
@@ -394,7 +428,8 @@ static int Open(vlc_object_t *obj)
...
@@ -394,7 +428,8 @@ static int Open(vlc_object_t *obj)
aout
->
pf_play
=
Play
;
aout
->
pf_play
=
Play
;
aout
->
pf_pause
=
Pause
;
aout
->
pf_pause
=
Pause
;
aout
->
pf_flush
=
Flush
;
aout
->
pf_flush
=
Flush
;
aout_VolumeNoneInit
(
aout
);
/*if (AOUT_FMT_LINEAR(&format) && !exclusive)*/
aout_VolumeHardInit
(
aout
,
SimpleVolumeSet
,
false
);
CoUninitialize
();
CoUninitialize
();
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
error:
error:
...
...
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