Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
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
Иван Мажукин
mpd
Commits
da8095db
Commit
da8095db
authored
Jul 06, 2009
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mixer_all: added mixer_all_set_software_volume()
The special-purpose function is used for saving/restore the software volume control to the state file.
parent
5d74b1ef
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
73 additions
and
0 deletions
+73
-0
mixer_all.c
src/mixer_all.c
+57
-0
mixer_all.h
src/mixer_all.h
+16
-0
No files found.
src/mixer_all.c
View file @
da8095db
...
...
@@ -22,6 +22,9 @@
#include "output_all.h"
#include "output_plugin.h"
#include "output_internal.h"
#include "pcm_volume.h"
#include "mixer_api.h"
#include "mixer_list.h"
#include <glib.h>
...
...
@@ -103,3 +106,57 @@ mixer_all_set_volume(unsigned volume)
return
success
;
}
static
int
output_mixer_get_software_volume
(
unsigned
i
)
{
struct
audio_output
*
output
;
struct
mixer
*
mixer
;
assert
(
i
<
audio_output_count
());
output
=
audio_output_get
(
i
);
if
(
!
output
->
enabled
)
return
-
1
;
mixer
=
output
->
mixer
;
if
(
mixer
==
NULL
||
mixer
->
plugin
!=
&
software_mixer_plugin
)
return
-
1
;
return
mixer_get_volume
(
mixer
);
}
int
mixer_all_get_software_volume
(
void
)
{
unsigned
count
=
audio_output_count
(),
ok
=
0
;
int
volume
,
total
=
0
;
for
(
unsigned
i
=
0
;
i
<
count
;
i
++
)
{
volume
=
output_mixer_get_software_volume
(
i
);
if
(
volume
>=
0
)
{
total
+=
volume
;
++
ok
;
}
}
if
(
ok
==
0
)
return
-
1
;
return
total
/
ok
;
}
void
mixer_all_set_software_volume
(
unsigned
volume
)
{
unsigned
count
=
audio_output_count
();
assert
(
volume
<=
PCM_VOLUME_1
);
for
(
unsigned
i
=
0
;
i
<
count
;
i
++
)
{
struct
audio_output
*
output
=
audio_output_get
(
i
);
if
(
output
->
mixer
!=
NULL
&&
output
->
mixer
->
plugin
==
&
software_mixer_plugin
)
mixer_set_volume
(
output
->
mixer
,
volume
);
}
}
src/mixer_all.h
View file @
da8095db
...
...
@@ -43,4 +43,20 @@ mixer_all_get_volume(void);
bool
mixer_all_set_volume
(
unsigned
volume
);
/**
* Similar to mixer_all_get_volume(), but gets the volume only for
* software mixers. See #software_mixer_plugin. This function fails
* if no software mixer is configured.
*/
int
mixer_all_get_software_volume
(
void
);
/**
* Similar to mixer_all_set_volume(), but sets the volume only for
* software mixers. See #software_mixer_plugin. This function cannot
* fail, because the underlying software mixers cannot fail either.
*/
void
mixer_all_set_software_volume
(
unsigned
volume
);
#endif
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