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
842a97aa
Commit
842a97aa
authored
Jul 26, 2011
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
LibVLC: fix volume scale and make documentation more explicit
parent
cb96c1cd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
12 deletions
+12
-12
include/vlc/libvlc_media_player.h
include/vlc/libvlc_media_player.h
+5
-4
src/control/audio.c
src/control/audio.c
+7
-8
No files found.
include/vlc/libvlc_media_player.h
View file @
842a97aa
...
...
@@ -1403,18 +1403,19 @@ LIBVLC_API int libvlc_audio_get_mute( libvlc_media_player_t *p_mi );
LIBVLC_API
void
libvlc_audio_set_mute
(
libvlc_media_player_t
*
p_mi
,
int
status
);
/**
* Get current
audio level
.
* Get current
software audio volume
.
*
* \param p_mi media player
* \return the audio level (int)
* \return the software volume in percents
* (0 = mute, 100 = nominal / 0dB)
*/
LIBVLC_API
int
libvlc_audio_get_volume
(
libvlc_media_player_t
*
p_mi
);
/**
* Set current
audio level
.
* Set current
software audio volume
.
*
* \param p_mi media player
* \param i_volume the volume
(int
)
* \param i_volume the volume
in percents (0 = mute, 100 = 0dB
)
* \return 0 if the volume was set, -1 if it was out of range
*/
LIBVLC_API
int
libvlc_audio_set_volume
(
libvlc_media_player_t
*
p_mi
,
int
i_volume
);
...
...
src/control/audio.c
View file @
842a97aa
...
...
@@ -327,29 +327,28 @@ void libvlc_audio_set_mute( libvlc_media_player_t *mp, int mute )
}
/*****************************************************************************
* libvlc_audio_get_volume : Get the current volume
(range 0-200 %)
* libvlc_audio_get_volume : Get the current volume
*****************************************************************************/
int
libvlc_audio_get_volume
(
libvlc_media_player_t
*
mp
)
{
audio_volume_t
i_
volume
=
aout_VolumeGet
(
mp
);
unsigned
volume
=
aout_VolumeGet
(
mp
);
return
(
i_volume
*
200
+
AOUT_VOLUME_MAX
/
2
)
/
AOUT_VOLUME_MAX
;
return
(
volume
*
100
+
AOUT_VOLUME_DEFAULT
/
2
)
/
AOUT_VOLUME_DEFAULT
;
}
/*****************************************************************************
* libvlc_audio_set_volume : Set the current volume
*****************************************************************************/
int
libvlc_audio_set_volume
(
libvlc_media_player_t
*
mp
,
int
i_
volume
)
int
libvlc_audio_set_volume
(
libvlc_media_player_t
*
mp
,
int
volume
)
{
if
(
i_volume
<
0
||
i_volume
>
200
)
volume
=
(
volume
*
AOUT_VOLUME_DEFAULT
+
50
)
/
100
;
if
(
volume
<
0
||
volume
>
AOUT_VOLUME_MAX
)
{
libvlc_printerr
(
"Volume out of range"
);
return
-
1
;
}
i_volume
=
(
i_volume
*
AOUT_VOLUME_MAX
+
100
)
/
200
;
aout_VolumeSet
(
mp
,
i_volume
);
aout_VolumeSet
(
mp
,
volume
);
return
0
;
}
...
...
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