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
406b0403
Commit
406b0403
authored
Mar 02, 2009
by
Viliam Mateicka
Committed by
Max Kellermann
Mar 02, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mixer: adding code to optionally disable all hw mixers
parent
2f438e5d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
3 deletions
+33
-3
mixer_api.c
src/mixer_api.c
+28
-3
mixer_api.h
src/mixer_api.h
+2
-0
volume.c
src/volume.c
+3
-0
No files found.
src/mixer_api.c
View file @
406b0403
...
@@ -19,13 +19,30 @@
...
@@ -19,13 +19,30 @@
#include <stdio.h>
#include <stdio.h>
#include <assert.h>
#include <assert.h>
#include <glib.h>
#include "mixer_api.h"
#include "mixer_api.h"
#undef G_LOG_DOMAIN
#define G_LOG_DOMAIN "mixer"
static
bool
mixers_enabled
=
true
;
void
mixer_disable_all
(
void
)
{
g_debug
(
"mixer api is disabled
\n
"
);
mixers_enabled
=
false
;
}
struct
mixer
*
struct
mixer
*
mixer_new
(
const
struct
mixer_plugin
*
plugin
,
const
struct
config_param
*
param
)
mixer_new
(
const
struct
mixer_plugin
*
plugin
,
const
struct
config_param
*
param
)
{
{
struct
mixer
*
mixer
;
struct
mixer
*
mixer
;
//mixers are disabled (by using software volume)
if
(
!
mixers_enabled
)
{
return
NULL
;
}
assert
(
plugin
!=
NULL
);
assert
(
plugin
!=
NULL
);
mixer
=
plugin
->
init
(
param
);
mixer
=
plugin
->
init
(
param
);
...
@@ -38,7 +55,9 @@ mixer_new(const struct mixer_plugin *plugin, const struct config_param *param)
...
@@ -38,7 +55,9 @@ mixer_new(const struct mixer_plugin *plugin, const struct config_param *param)
void
void
mixer_free
(
struct
mixer
*
mixer
)
mixer_free
(
struct
mixer
*
mixer
)
{
{
assert
(
mixer
!=
NULL
);
if
(
!
mixer
)
{
return
;
}
assert
(
mixer
->
plugin
!=
NULL
);
assert
(
mixer
->
plugin
!=
NULL
);
mixer
->
plugin
->
finish
(
mixer
);
mixer
->
plugin
->
finish
(
mixer
);
...
@@ -46,12 +65,18 @@ mixer_free(struct mixer *mixer)
...
@@ -46,12 +65,18 @@ mixer_free(struct mixer *mixer)
bool
mixer_open
(
struct
mixer
*
mixer
)
bool
mixer_open
(
struct
mixer
*
mixer
)
{
{
assert
(
mixer
!=
NULL
&&
mixer
->
plugin
!=
NULL
);
if
(
!
mixer
)
{
return
false
;
}
assert
(
mixer
->
plugin
!=
NULL
);
return
mixer
->
plugin
->
open
(
mixer
);
return
mixer
->
plugin
->
open
(
mixer
);
}
}
void
mixer_close
(
struct
mixer
*
mixer
)
void
mixer_close
(
struct
mixer
*
mixer
)
{
{
assert
(
mixer
!=
NULL
&&
mixer
->
plugin
!=
NULL
);
if
(
!
mixer
)
{
return
;
}
assert
(
mixer
->
plugin
!=
NULL
);
mixer
->
plugin
->
close
(
mixer
);
mixer
->
plugin
->
close
(
mixer
);
}
}
src/mixer_api.h
View file @
406b0403
...
@@ -99,4 +99,6 @@ mixer_set_volume(struct mixer *mixer, unsigned volume)
...
@@ -99,4 +99,6 @@ mixer_set_volume(struct mixer *mixer, unsigned volume)
return
mixer
->
plugin
->
set_volume
(
mixer
,
volume
);
return
mixer
->
plugin
->
set_volume
(
mixer
,
volume
);
}
}
void
mixer_disable_all
(
void
);
#endif
#endif
src/volume.c
View file @
406b0403
...
@@ -24,6 +24,7 @@
...
@@ -24,6 +24,7 @@
#include "config.h"
#include "config.h"
#include "audio.h"
#include "audio.h"
#include "output_all.h"
#include "output_all.h"
#include "mixer_api.h"
#include <glib.h>
#include <glib.h>
...
@@ -140,8 +141,10 @@ void volume_init(void)
...
@@ -140,8 +141,10 @@ void volume_init(void)
if
(
param
)
{
if
(
param
)
{
if
(
strcmp
(
param
->
value
,
VOLUME_MIXER_SOFTWARE
)
==
0
)
{
if
(
strcmp
(
param
->
value
,
VOLUME_MIXER_SOFTWARE
)
==
0
)
{
volume_mixer_type
=
VOLUME_MIXER_TYPE_SOFTWARE
;
volume_mixer_type
=
VOLUME_MIXER_TYPE_SOFTWARE
;
mixer_disable_all
();
}
else
if
(
strcmp
(
param
->
value
,
VOLUME_MIXER_DISABLED
)
==
0
)
{
}
else
if
(
strcmp
(
param
->
value
,
VOLUME_MIXER_DISABLED
)
==
0
)
{
volume_mixer_type
=
VOLUME_MIXER_TYPE_DISABLED
;
volume_mixer_type
=
VOLUME_MIXER_TYPE_DISABLED
;
mixer_disable_all
();
}
else
if
(
strcmp
(
param
->
value
,
VOLUME_MIXER_HARDWARE
)
==
0
)
{
}
else
if
(
strcmp
(
param
->
value
,
VOLUME_MIXER_HARDWARE
)
==
0
)
{
//nothing to do
//nothing to do
}
else
{
}
else
{
...
...
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