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
cb8449a6
Commit
cb8449a6
authored
Apr 16, 2013
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MixerInternal: convert to class
parent
62146771
Show whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
108 additions
and
143 deletions
+108
-143
Makefile.am
Makefile.am
+1
-3
MixerAll.cxx
src/MixerAll.cxx
+4
-7
MixerControl.cxx
src/MixerControl.cxx
+11
-11
MixerControl.hxx
src/MixerControl.hxx
+8
-8
MixerInternal.cxx
src/MixerInternal.cxx
+0
-33
MixerInternal.hxx
src/MixerInternal.hxx
+13
-4
MixerPlugin.hxx
src/MixerPlugin.hxx
+7
-7
OutputCommand.cxx
src/OutputCommand.cxx
+1
-2
OutputInit.cxx
src/OutputInit.cxx
+2
-2
ReplayGainFilterPlugin.cxx
src/filter/ReplayGainFilterPlugin.cxx
+3
-3
ReplayGainFilterPlugin.hxx
src/filter/ReplayGainFilterPlugin.hxx
+2
-2
AlsaMixerPlugin.cxx
src/mixer/AlsaMixerPlugin.cxx
+8
-10
OssMixerPlugin.cxx
src/mixer/OssMixerPlugin.cxx
+8
-10
PulseMixerPlugin.cxx
src/mixer/PulseMixerPlugin.cxx
+7
-7
RoarMixerPlugin.cxx
src/mixer/RoarMixerPlugin.cxx
+9
-11
SoftwareMixerPlugin.cxx
src/mixer/SoftwareMixerPlugin.cxx
+9
-11
SoftwareMixerPlugin.hxx
src/mixer/SoftwareMixerPlugin.hxx
+2
-2
WinmmMixerPlugin.cxx
src/mixer/WinmmMixerPlugin.cxx
+7
-7
output_internal.h
src/output_internal.h
+4
-0
read_mixer.cxx
test/read_mixer.cxx
+1
-2
run_filter.cxx
test/run_filter.cxx
+1
-1
No files found.
Makefile.am
View file @
cb8449a6
...
...
@@ -795,7 +795,7 @@ MIXER_API_SRC = \
src/MixerControl.cxx src/MixerControl.hxx
\
src/MixerType.cxx src/MixerType.hxx
\
src/MixerAll.cxx src/MixerAll.hxx
\
src/MixerInternal.
cxx src/MixerInternal.
hxx
src/MixerInternal.hxx
libmixer_plugins_a_SOURCES
=
\
src/mixer/SoftwareMixerPlugin.cxx
\
...
...
@@ -1325,7 +1325,6 @@ test_run_output_SOURCES = test/run_output.cxx \
src/resolver.c
\
src/OutputInit.cxx src/OutputFinish.cxx src/OutputList.cxx
\
src/OutputPlugin.cxx
\
src/MixerInternal.cxx
\
src/MixerControl.cxx
\
src/MixerType.cxx
\
src/FilterPlugin.cxx
\
...
...
@@ -1345,7 +1344,6 @@ test_read_mixer_LDADD = \
$(GLIB_LIBS)
test_read_mixer_SOURCES
=
test
/read_mixer.cxx
\
src/MixerControl.cxx
\
src/MixerInternal.cxx
\
src/FilterPlugin.cxx
\
src/filter/VolumeFilterPlugin.cxx
\
src/fd_util.c
...
...
src/MixerAll.cxx
View file @
cb8449a6
...
...
@@ -40,7 +40,6 @@ static int
output_mixer_get_volume
(
unsigned
i
)
{
struct
audio_output
*
output
;
struct
mixer
*
mixer
;
int
volume
;
GError
*
error
=
NULL
;
...
...
@@ -50,7 +49,7 @@ output_mixer_get_volume(unsigned i)
if
(
!
output
->
enabled
)
return
-
1
;
mixer
=
output
->
mixer
;
Mixer
*
mixer
=
output
->
mixer
;
if
(
mixer
==
NULL
)
return
-
1
;
...
...
@@ -88,7 +87,6 @@ static bool
output_mixer_set_volume
(
unsigned
i
,
unsigned
volume
)
{
struct
audio_output
*
output
;
struct
mixer
*
mixer
;
bool
success
;
GError
*
error
=
NULL
;
...
...
@@ -99,7 +97,7 @@ output_mixer_set_volume(unsigned i, unsigned volume)
if
(
!
output
->
enabled
)
return
false
;
mixer
=
output
->
mixer
;
Mixer
*
mixer
=
output
->
mixer
;
if
(
mixer
==
NULL
)
return
false
;
...
...
@@ -132,7 +130,6 @@ static int
output_mixer_get_software_volume
(
unsigned
i
)
{
struct
audio_output
*
output
;
struct
mixer
*
mixer
;
assert
(
i
<
audio_output_count
());
...
...
@@ -140,8 +137,8 @@ output_mixer_get_software_volume(unsigned i)
if
(
!
output
->
enabled
)
return
-
1
;
mixer
=
output
->
mixer
;
if
(
mixer
==
NULL
||
mixer
->
plugin
!=
&
software_mixer_plugin
)
Mixer
*
mixer
=
output
->
mixer
;
if
(
mixer
==
NULL
||
!
mixer
->
IsPlugin
(
software_mixer_plugin
)
)
return
-
1
;
return
mixer_get_volume
(
mixer
,
NULL
);
...
...
src/MixerControl.cxx
View file @
cb8449a6
...
...
@@ -27,24 +27,24 @@
#undef G_LOG_DOMAIN
#define G_LOG_DOMAIN "mixer"
struct
m
ixer
*
M
ixer
*
mixer_new
(
const
struct
mixer_plugin
*
plugin
,
void
*
ao
,
const
struct
config_param
*
param
,
GError
**
error_r
)
{
struct
m
ixer
*
mixer
;
M
ixer
*
mixer
;
assert
(
plugin
!=
NULL
);
mixer
=
plugin
->
init
(
ao
,
param
,
error_r
);
assert
(
mixer
==
NULL
||
mixer
->
plugin
==
plugin
);
assert
(
mixer
==
NULL
||
mixer
->
IsPlugin
(
*
plugin
)
);
return
mixer
;
}
void
mixer_free
(
struct
m
ixer
*
mixer
)
mixer_free
(
M
ixer
*
mixer
)
{
assert
(
mixer
!=
NULL
);
assert
(
mixer
->
plugin
!=
NULL
);
...
...
@@ -60,7 +60,7 @@ mixer_free(struct mixer *mixer)
}
bool
mixer_open
(
struct
m
ixer
*
mixer
,
GError
**
error_r
)
mixer_open
(
M
ixer
*
mixer
,
GError
**
error_r
)
{
bool
success
;
...
...
@@ -84,7 +84,7 @@ mixer_open(struct mixer *mixer, GError **error_r)
}
static
void
mixer_close_internal
(
struct
m
ixer
*
mixer
)
mixer_close_internal
(
M
ixer
*
mixer
)
{
assert
(
mixer
!=
NULL
);
assert
(
mixer
->
plugin
!=
NULL
);
...
...
@@ -97,7 +97,7 @@ mixer_close_internal(struct mixer *mixer)
}
void
mixer_close
(
struct
m
ixer
*
mixer
)
mixer_close
(
M
ixer
*
mixer
)
{
assert
(
mixer
!=
NULL
);
assert
(
mixer
->
plugin
!=
NULL
);
...
...
@@ -111,7 +111,7 @@ mixer_close(struct mixer *mixer)
}
void
mixer_auto_close
(
struct
m
ixer
*
mixer
)
mixer_auto_close
(
M
ixer
*
mixer
)
{
if
(
!
mixer
->
plugin
->
global
)
mixer_close
(
mixer
);
...
...
@@ -122,7 +122,7 @@ mixer_auto_close(struct mixer *mixer)
* calling this function.
*/
static
void
mixer_failed
(
struct
m
ixer
*
mixer
)
mixer_failed
(
M
ixer
*
mixer
)
{
assert
(
mixer
->
open
);
...
...
@@ -132,7 +132,7 @@ mixer_failed(struct mixer *mixer)
}
int
mixer_get_volume
(
struct
m
ixer
*
mixer
,
GError
**
error_r
)
mixer_get_volume
(
M
ixer
*
mixer
,
GError
**
error_r
)
{
int
volume
;
...
...
@@ -161,7 +161,7 @@ mixer_get_volume(struct mixer *mixer, GError **error_r)
}
bool
mixer_set_volume
(
struct
m
ixer
*
mixer
,
unsigned
volume
,
GError
**
error_r
)
mixer_set_volume
(
M
ixer
*
mixer
,
unsigned
volume
,
GError
**
error_r
)
{
bool
success
;
...
...
src/MixerControl.hxx
View file @
cb8449a6
...
...
@@ -27,7 +27,7 @@
#include "gerror.h"
struct
m
ixer
;
class
M
ixer
;
struct
mixer_plugin
;
struct
config_param
;
...
...
@@ -35,32 +35,32 @@ struct config_param;
extern
"C"
{
#endif
struct
m
ixer
*
M
ixer
*
mixer_new
(
const
struct
mixer_plugin
*
plugin
,
void
*
ao
,
const
struct
config_param
*
param
,
GError
**
error_r
);
void
mixer_free
(
struct
m
ixer
*
mixer
);
mixer_free
(
M
ixer
*
mixer
);
bool
mixer_open
(
struct
m
ixer
*
mixer
,
GError
**
error_r
);
mixer_open
(
M
ixer
*
mixer
,
GError
**
error_r
);
void
mixer_close
(
struct
m
ixer
*
mixer
);
mixer_close
(
M
ixer
*
mixer
);
/**
* Close the mixer unless the plugin's "global" flag is set. This is
* called when the #audio_output is closed.
*/
void
mixer_auto_close
(
struct
m
ixer
*
mixer
);
mixer_auto_close
(
M
ixer
*
mixer
);
int
mixer_get_volume
(
struct
m
ixer
*
mixer
,
GError
**
error_r
);
mixer_get_volume
(
M
ixer
*
mixer
,
GError
**
error_r
);
bool
mixer_set_volume
(
struct
m
ixer
*
mixer
,
unsigned
volume
,
GError
**
error_r
);
mixer_set_volume
(
M
ixer
*
mixer
,
unsigned
volume
,
GError
**
error_r
);
#ifdef __cplusplus
}
...
...
src/MixerInternal.cxx
deleted
100644 → 0
View file @
62146771
/*
* Copyright (C) 2003-2013 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "config.h"
#include "MixerInternal.hxx"
#undef G_LOG_DOMAIN
#define G_LOG_DOMAIN "mixer"
void
mixer_init
(
struct
mixer
*
mixer
,
const
struct
mixer_plugin
*
plugin
)
{
mixer
->
plugin
=
plugin
;
mixer
->
mutex
=
g_mutex_new
();
mixer
->
open
=
false
;
mixer
->
failed
=
false
;
}
src/MixerInternal.hxx
View file @
cb8449a6
...
...
@@ -25,7 +25,8 @@
#include <glib.h>
struct
mixer
{
class
Mixer
{
public
:
const
struct
mixer_plugin
*
plugin
;
/**
...
...
@@ -44,9 +45,17 @@ struct mixer {
* automatically?
*/
bool
failed
;
};
void
mixer_init
(
struct
mixer
*
mixer
,
const
struct
mixer_plugin
*
plugin
);
public
:
Mixer
(
const
mixer_plugin
&
_plugin
)
:
plugin
(
&
_plugin
),
mutex
(
g_mutex_new
()),
open
(
false
),
failed
(
false
)
{}
bool
IsPlugin
(
const
mixer_plugin
&
other
)
const
{
return
plugin
==
&
other
;
}
};
#endif
src/MixerPlugin.hxx
View file @
cb8449a6
...
...
@@ -32,7 +32,7 @@
#include <stdbool.h>
struct
config_param
;
struct
m
ixer
;
class
M
ixer
;
struct
mixer_plugin
{
/**
...
...
@@ -45,13 +45,13 @@ struct mixer_plugin {
* NULL to ignore errors
* @return a mixer object, or NULL on error
*/
struct
m
ixer
*
(
*
init
)(
void
*
ao
,
const
struct
config_param
*
param
,
M
ixer
*
(
*
init
)(
void
*
ao
,
const
struct
config_param
*
param
,
GError
**
error_r
);
/**
* Finish and free mixer data
*/
void
(
*
finish
)(
struct
m
ixer
*
data
);
void
(
*
finish
)(
M
ixer
*
data
);
/**
* Open mixer device
...
...
@@ -60,12 +60,12 @@ struct mixer_plugin {
* NULL to ignore errors
* @return true on success, false on error
*/
bool
(
*
open
)(
struct
m
ixer
*
data
,
GError
**
error_r
);
bool
(
*
open
)(
M
ixer
*
data
,
GError
**
error_r
);
/**
* Close mixer device
*/
void
(
*
close
)(
struct
m
ixer
*
data
);
void
(
*
close
)(
M
ixer
*
data
);
/**
* Reads the current volume.
...
...
@@ -75,7 +75,7 @@ struct mixer_plugin {
* @return the current volume (0..100 including) or -1 if
* unavailable or on error (error_r set, mixer will be closed)
*/
int
(
*
get_volume
)(
struct
m
ixer
*
mixer
,
GError
**
error_r
);
int
(
*
get_volume
)(
M
ixer
*
mixer
,
GError
**
error_r
);
/**
* Sets the volume.
...
...
@@ -85,7 +85,7 @@ struct mixer_plugin {
* @param volume the new volume (0..100 including)
* @return true on success, false on error
*/
bool
(
*
set_volume
)(
struct
m
ixer
*
mixer
,
unsigned
volume
,
bool
(
*
set_volume
)(
M
ixer
*
mixer
,
unsigned
volume
,
GError
**
error_r
);
/**
...
...
src/OutputCommand.cxx
View file @
cb8449a6
...
...
@@ -64,7 +64,6 @@ bool
audio_output_disable_index
(
unsigned
idx
)
{
struct
audio_output
*
ao
;
struct
mixer
*
mixer
;
if
(
idx
>=
audio_output_count
())
return
false
;
...
...
@@ -76,7 +75,7 @@ audio_output_disable_index(unsigned idx)
ao
->
enabled
=
false
;
idle_add
(
IDLE_OUTPUT
);
mixer
=
ao
->
mixer
;
Mixer
*
mixer
=
ao
->
mixer
;
if
(
mixer
!=
NULL
)
{
mixer_close
(
mixer
);
idle_add
(
IDLE_MIXER
);
...
...
src/OutputInit.cxx
View file @
cb8449a6
...
...
@@ -96,14 +96,14 @@ audio_output_mixer_type(const struct config_param *param)
"hardware"
));
}
static
struct
m
ixer
*
static
M
ixer
*
audio_output_load_mixer
(
struct
audio_output
*
ao
,
const
struct
config_param
*
param
,
const
struct
mixer_plugin
*
plugin
,
Filter
&
filter_chain
,
GError
**
error_r
)
{
struct
m
ixer
*
mixer
;
M
ixer
*
mixer
;
switch
(
audio_output_mixer_type
(
param
))
{
case
MIXER_TYPE_NONE
:
...
...
src/filter/ReplayGainFilterPlugin.cxx
View file @
cb8449a6
...
...
@@ -43,7 +43,7 @@ class ReplayGainFilter final : public Filter {
* If set, then this hardware mixer is used for applying
* replay gain, instead of the software volume library.
*/
struct
m
ixer
*
mixer
;
M
ixer
*
mixer
;
/**
* The base volume level for scale=1.0, between 1 and 100
...
...
@@ -80,7 +80,7 @@ public:
replay_gain_info_init
(
&
info
);
}
void
SetMixer
(
struct
m
ixer
*
_mixer
,
unsigned
_base
)
{
void
SetMixer
(
M
ixer
*
_mixer
,
unsigned
_base
)
{
assert
(
_mixer
==
NULL
||
(
_base
>
0
&&
_base
<=
100
));
mixer
=
_mixer
;
...
...
@@ -217,7 +217,7 @@ const struct filter_plugin replay_gain_filter_plugin = {
};
void
replay_gain_filter_set_mixer
(
Filter
*
_filter
,
struct
m
ixer
*
mixer
,
replay_gain_filter_set_mixer
(
Filter
*
_filter
,
M
ixer
*
mixer
,
unsigned
base
)
{
ReplayGainFilter
*
filter
=
(
ReplayGainFilter
*
)
_filter
;
...
...
src/filter/ReplayGainFilterPlugin.hxx
View file @
cb8449a6
...
...
@@ -23,7 +23,7 @@
#include "replay_gain_info.h"
class
Filter
;
struct
m
ixer
;
class
M
ixer
;
/**
* Enables or disables the hardware mixer for applying replay gain.
...
...
@@ -34,7 +34,7 @@ struct mixer;
* (including).
*/
void
replay_gain_filter_set_mixer
(
Filter
*
_filter
,
struct
m
ixer
*
mixer
,
replay_gain_filter_set_mixer
(
Filter
*
_filter
,
M
ixer
*
mixer
,
unsigned
base
);
/**
...
...
src/mixer/AlsaMixerPlugin.cxx
View file @
cb8449a6
...
...
@@ -45,7 +45,7 @@ private:
virtual
void
DispatchSockets
()
override
;
};
class
AlsaMixer
final
:
public
m
ixer
{
class
AlsaMixer
final
:
public
M
ixer
{
const
char
*
device
;
const
char
*
control
;
unsigned
int
index
;
...
...
@@ -59,9 +59,7 @@ class AlsaMixer final : public mixer {
AlsaMixerMonitor
*
monitor
;
public
:
AlsaMixer
()
{
mixer_init
(
this
,
&
alsa_mixer_plugin
);
}
AlsaMixer
()
:
Mixer
(
alsa_mixer_plugin
)
{}
void
Configure
(
const
config_param
*
param
);
bool
Setup
(
GError
**
error_r
);
...
...
@@ -150,7 +148,7 @@ AlsaMixer::Configure(const config_param *param)
VOLUME_MIXER_ALSA_INDEX_DEFAULT
);
}
static
struct
m
ixer
*
static
M
ixer
*
alsa_mixer_init
(
G_GNUC_UNUSED
void
*
ao
,
const
struct
config_param
*
param
,
G_GNUC_UNUSED
GError
**
error_r
)
{
...
...
@@ -161,7 +159,7 @@ alsa_mixer_init(G_GNUC_UNUSED void *ao, const struct config_param *param,
}
static
void
alsa_mixer_finish
(
struct
m
ixer
*
data
)
alsa_mixer_finish
(
M
ixer
*
data
)
{
AlsaMixer
*
am
=
(
AlsaMixer
*
)
data
;
...
...
@@ -254,7 +252,7 @@ AlsaMixer::Open(GError **error_r)
}
static
bool
alsa_mixer_open
(
struct
m
ixer
*
data
,
GError
**
error_r
)
alsa_mixer_open
(
M
ixer
*
data
,
GError
**
error_r
)
{
AlsaMixer
*
am
=
(
AlsaMixer
*
)
data
;
...
...
@@ -273,7 +271,7 @@ AlsaMixer::Close()
}
static
void
alsa_mixer_close
(
struct
m
ixer
*
data
)
alsa_mixer_close
(
M
ixer
*
data
)
{
AlsaMixer
*
am
=
(
AlsaMixer
*
)
data
;
am
->
Close
();
...
...
@@ -319,7 +317,7 @@ AlsaMixer::GetVolume(GError **error_r)
}
static
int
alsa_mixer_get_volume
(
struct
m
ixer
*
mixer
,
GError
**
error_r
)
alsa_mixer_get_volume
(
M
ixer
*
mixer
,
GError
**
error_r
)
{
AlsaMixer
*
am
=
(
AlsaMixer
*
)
mixer
;
return
am
->
GetVolume
(
error_r
);
...
...
@@ -355,7 +353,7 @@ AlsaMixer::SetVolume(unsigned volume, GError **error_r)
}
static
bool
alsa_mixer_set_volume
(
struct
m
ixer
*
mixer
,
unsigned
volume
,
GError
**
error_r
)
alsa_mixer_set_volume
(
M
ixer
*
mixer
,
unsigned
volume
,
GError
**
error_r
)
{
AlsaMixer
*
am
=
(
AlsaMixer
*
)
mixer
;
return
am
->
SetVolume
(
volume
,
error_r
);
...
...
src/mixer/OssMixerPlugin.cxx
View file @
cb8449a6
...
...
@@ -40,7 +40,7 @@
#define VOLUME_MIXER_OSS_DEFAULT "/dev/mixer"
class
OssMixer
:
public
m
ixer
{
class
OssMixer
:
public
M
ixer
{
const
char
*
device
;
const
char
*
control
;
...
...
@@ -48,9 +48,7 @@ class OssMixer : public mixer {
int
volume_control
;
public
:
OssMixer
()
{
mixer_init
(
this
,
&
oss_mixer_plugin
);
}
OssMixer
()
:
Mixer
(
oss_mixer_plugin
)
{}
bool
Configure
(
const
config_param
*
param
,
GError
**
error_r
);
bool
Open
(
GError
**
error_r
);
...
...
@@ -104,7 +102,7 @@ OssMixer::Configure(const config_param *param, GError **error_r)
return
true
;
}
static
struct
m
ixer
*
static
M
ixer
*
oss_mixer_init
(
G_GNUC_UNUSED
void
*
ao
,
const
struct
config_param
*
param
,
GError
**
error_r
)
{
...
...
@@ -119,7 +117,7 @@ oss_mixer_init(G_GNUC_UNUSED void *ao, const struct config_param *param,
}
static
void
oss_mixer_finish
(
struct
m
ixer
*
data
)
oss_mixer_finish
(
M
ixer
*
data
)
{
OssMixer
*
om
=
(
OssMixer
*
)
data
;
...
...
@@ -135,7 +133,7 @@ OssMixer::Close()
}
static
void
oss_mixer_close
(
struct
m
ixer
*
data
)
oss_mixer_close
(
M
ixer
*
data
)
{
OssMixer
*
om
=
(
OssMixer
*
)
data
;
om
->
Close
();
...
...
@@ -176,7 +174,7 @@ OssMixer::Open(GError **error_r)
}
static
bool
oss_mixer_open
(
struct
m
ixer
*
data
,
GError
**
error_r
)
oss_mixer_open
(
M
ixer
*
data
,
GError
**
error_r
)
{
OssMixer
*
om
=
(
OssMixer
*
)
data
;
...
...
@@ -211,7 +209,7 @@ OssMixer::GetVolume(GError **error_r)
}
static
int
oss_mixer_get_volume
(
struct
m
ixer
*
mixer
,
GError
**
error_r
)
oss_mixer_get_volume
(
M
ixer
*
mixer
,
GError
**
error_r
)
{
OssMixer
*
om
=
(
OssMixer
*
)
mixer
;
return
om
->
GetVolume
(
error_r
);
...
...
@@ -240,7 +238,7 @@ OssMixer::SetVolume(unsigned volume, GError **error_r)
}
static
bool
oss_mixer_set_volume
(
struct
m
ixer
*
mixer
,
unsigned
volume
,
GError
**
error_r
)
oss_mixer_set_volume
(
M
ixer
*
mixer
,
unsigned
volume
,
GError
**
error_r
)
{
OssMixer
*
om
=
(
OssMixer
*
)
mixer
;
return
om
->
SetVolume
(
volume
,
error_r
);
...
...
src/mixer/PulseMixerPlugin.cxx
View file @
cb8449a6
...
...
@@ -39,16 +39,16 @@
#undef G_LOG_DOMAIN
#define G_LOG_DOMAIN "pulse_mixer"
struct
PulseMixer
:
m
ixer
{
struct
PulseMixer
final
:
public
M
ixer
{
PulseOutput
*
output
;
bool
online
;
struct
pa_cvolume
volume
;
PulseMixer
(
PulseOutput
*
_output
)
:
output
(
_output
),
online
(
false
)
:
Mixer
(
pulse_mixer_plugin
),
output
(
_output
),
online
(
false
)
{
mixer_init
(
this
,
&
pulse_mixer_plugin
);
}
};
...
...
@@ -152,7 +152,7 @@ pulse_mixer_on_change(PulseMixer *pm,
pulse_mixer_update
(
pm
,
context
,
stream
);
}
static
struct
m
ixer
*
static
M
ixer
*
pulse_mixer_init
(
void
*
ao
,
G_GNUC_UNUSED
const
struct
config_param
*
param
,
GError
**
error_r
)
{
...
...
@@ -172,7 +172,7 @@ pulse_mixer_init(void *ao, G_GNUC_UNUSED const struct config_param *param,
}
static
void
pulse_mixer_finish
(
struct
m
ixer
*
data
)
pulse_mixer_finish
(
M
ixer
*
data
)
{
PulseMixer
*
pm
=
(
PulseMixer
*
)
data
;
...
...
@@ -182,7 +182,7 @@ pulse_mixer_finish(struct mixer *data)
}
static
int
pulse_mixer_get_volume
(
struct
m
ixer
*
mixer
,
G_GNUC_UNUSED
GError
**
error_r
)
pulse_mixer_get_volume
(
M
ixer
*
mixer
,
G_GNUC_UNUSED
GError
**
error_r
)
{
PulseMixer
*
pm
=
(
PulseMixer
*
)
mixer
;
int
ret
;
...
...
@@ -199,7 +199,7 @@ pulse_mixer_get_volume(struct mixer *mixer, G_GNUC_UNUSED GError **error_r)
}
static
bool
pulse_mixer_set_volume
(
struct
m
ixer
*
mixer
,
unsigned
volume
,
GError
**
error_r
)
pulse_mixer_set_volume
(
M
ixer
*
mixer
,
unsigned
volume
,
GError
**
error_r
)
{
PulseMixer
*
pm
=
(
PulseMixer
*
)
mixer
;
struct
pa_cvolume
cvolume
;
...
...
src/mixer/RoarMixerPlugin.cxx
View file @
cb8449a6
...
...
@@ -24,26 +24,24 @@
#include "output_api.h"
#include "output/RoarOutputPlugin.hxx"
struct
RoarMixer
{
struct
RoarMixer
final
:
public
Mixer
{
/** the base mixer class */
struct
mixer
base
;
RoarOutput
*
self
;
RoarMixer
(
RoarOutput
*
_output
)
:
self
(
_output
)
{
mixer_init
(
&
base
,
&
roar_mixer_plugin
);
}
RoarMixer
(
RoarOutput
*
_output
)
:
Mixer
(
roar_mixer_plugin
),
self
(
_output
)
{
}
};
static
struct
m
ixer
*
static
M
ixer
*
roar_mixer_init
(
void
*
ao
,
gcc_unused
const
struct
config_param
*
param
,
gcc_unused
GError
**
error_r
)
{
RoarMixer
*
self
=
new
RoarMixer
((
RoarOutput
*
)
ao
);
return
&
self
->
base
;
return
new
RoarMixer
((
RoarOutput
*
)
ao
);
}
static
void
roar_mixer_finish
(
struct
m
ixer
*
data
)
roar_mixer_finish
(
M
ixer
*
data
)
{
RoarMixer
*
self
=
(
RoarMixer
*
)
data
;
...
...
@@ -51,14 +49,14 @@ roar_mixer_finish(struct mixer *data)
}
static
int
roar_mixer_get_volume
(
struct
m
ixer
*
mixer
,
gcc_unused
GError
**
error_r
)
roar_mixer_get_volume
(
M
ixer
*
mixer
,
gcc_unused
GError
**
error_r
)
{
RoarMixer
*
self
=
(
RoarMixer
*
)
mixer
;
return
roar_output_get_volume
(
self
->
self
);
}
static
bool
roar_mixer_set_volume
(
struct
m
ixer
*
mixer
,
unsigned
volume
,
roar_mixer_set_volume
(
M
ixer
*
mixer
,
unsigned
volume
,
gcc_unused
GError
**
error_r
)
{
RoarMixer
*
self
=
(
RoarMixer
*
)
mixer
;
...
...
src/mixer/SoftwareMixerPlugin.cxx
View file @
cb8449a6
...
...
@@ -29,18 +29,17 @@
#include <assert.h>
#include <math.h>
struct
SoftwareMixer
final
:
public
m
ixer
{
struct
SoftwareMixer
final
:
public
M
ixer
{
Filter
*
filter
;
unsigned
volume
;
SoftwareMixer
()
:
filter
(
filter_new
(
&
volume_filter_plugin
,
nullptr
,
nullptr
)),
:
Mixer
(
software_mixer_plugin
),
filter
(
filter_new
(
&
volume_filter_plugin
,
nullptr
,
nullptr
)),
volume
(
100
)
{
assert
(
filter
!=
nullptr
);
mixer_init
(
this
,
&
software_mixer_plugin
);
}
~
SoftwareMixer
()
{
...
...
@@ -48,7 +47,7 @@ struct SoftwareMixer final : public mixer {
}
};
static
struct
m
ixer
*
static
M
ixer
*
software_mixer_init
(
G_GNUC_UNUSED
void
*
ao
,
G_GNUC_UNUSED
const
struct
config_param
*
param
,
G_GNUC_UNUSED
GError
**
error_r
)
...
...
@@ -57,7 +56,7 @@ software_mixer_init(G_GNUC_UNUSED void *ao,
}
static
void
software_mixer_finish
(
struct
m
ixer
*
data
)
software_mixer_finish
(
M
ixer
*
data
)
{
SoftwareMixer
*
sm
=
(
SoftwareMixer
*
)
data
;
...
...
@@ -65,7 +64,7 @@ software_mixer_finish(struct mixer *data)
}
static
int
software_mixer_get_volume
(
struct
m
ixer
*
mixer
,
G_GNUC_UNUSED
GError
**
error_r
)
software_mixer_get_volume
(
M
ixer
*
mixer
,
G_GNUC_UNUSED
GError
**
error_r
)
{
SoftwareMixer
*
sm
=
(
SoftwareMixer
*
)
mixer
;
...
...
@@ -73,7 +72,7 @@ software_mixer_get_volume(struct mixer *mixer, G_GNUC_UNUSED GError **error_r)
}
static
bool
software_mixer_set_volume
(
struct
m
ixer
*
mixer
,
unsigned
volume
,
software_mixer_set_volume
(
M
ixer
*
mixer
,
unsigned
volume
,
G_GNUC_UNUSED
GError
**
error_r
)
{
SoftwareMixer
*
sm
=
(
SoftwareMixer
*
)
mixer
;
...
...
@@ -103,11 +102,10 @@ const struct mixer_plugin software_mixer_plugin = {
};
Filter
*
software_mixer_get_filter
(
struct
m
ixer
*
mixer
)
software_mixer_get_filter
(
M
ixer
*
mixer
)
{
SoftwareMixer
*
sm
=
(
SoftwareMixer
*
)
mixer
;
assert
(
sm
->
plugin
==
&
software_mixer_plugin
);
assert
(
sm
->
IsPlugin
(
software_mixer_plugin
));
return
sm
->
filter
;
}
src/mixer/SoftwareMixerPlugin.hxx
View file @
cb8449a6
...
...
@@ -20,7 +20,7 @@
#ifndef MPD_SOFTWARE_MIXER_PLUGIN_HXX
#define MPD_SOFTWARE_MIXER_PLUGIN_HXX
struct
m
ixer
;
class
M
ixer
;
class
Filter
;
/**
...
...
@@ -28,6 +28,6 @@ class Filter;
* of this mixer plugin should install this filter.
*/
Filter
*
software_mixer_get_filter
(
struct
m
ixer
*
mixer
);
software_mixer_get_filter
(
M
ixer
*
mixer
);
#endif
src/mixer/WinmmMixerPlugin.cxx
View file @
cb8449a6
...
...
@@ -31,12 +31,12 @@
#undef G_LOG_DOMAIN
#define G_LOG_DOMAIN "winmm_mixer"
struct
WinmmMixer
final
:
public
m
ixer
{
struct
WinmmMixer
final
:
public
M
ixer
{
WinmmOutput
*
output
;
WinmmMixer
(
WinmmOutput
*
_output
)
:
output
(
_output
)
{
mixer_init
(
this
,
&
winmm_mixer_plugin
);
:
Mixer
(
winmm_mixer_plugin
),
output
(
_output
)
{
}
};
...
...
@@ -59,7 +59,7 @@ winmm_volume_encode(int volume)
return
MAKELONG
(
value
,
value
);
}
static
struct
m
ixer
*
static
M
ixer
*
winmm_mixer_init
(
void
*
ao
,
G_GNUC_UNUSED
const
struct
config_param
*
param
,
G_GNUC_UNUSED
GError
**
error_r
)
{
...
...
@@ -69,7 +69,7 @@ winmm_mixer_init(void *ao, G_GNUC_UNUSED const struct config_param *param,
}
static
void
winmm_mixer_finish
(
struct
m
ixer
*
data
)
winmm_mixer_finish
(
M
ixer
*
data
)
{
WinmmMixer
*
wm
=
(
WinmmMixer
*
)
data
;
...
...
@@ -77,7 +77,7 @@ winmm_mixer_finish(struct mixer *data)
}
static
int
winmm_mixer_get_volume
(
struct
m
ixer
*
mixer
,
GError
**
error_r
)
winmm_mixer_get_volume
(
M
ixer
*
mixer
,
GError
**
error_r
)
{
WinmmMixer
*
wm
=
(
WinmmMixer
*
)
mixer
;
DWORD
volume
;
...
...
@@ -94,7 +94,7 @@ winmm_mixer_get_volume(struct mixer *mixer, GError **error_r)
}
static
bool
winmm_mixer_set_volume
(
struct
m
ixer
*
mixer
,
unsigned
volume
,
GError
**
error_r
)
winmm_mixer_set_volume
(
M
ixer
*
mixer
,
unsigned
volume
,
GError
**
error_r
)
{
WinmmMixer
*
wm
=
(
WinmmMixer
*
)
mixer
;
DWORD
value
=
winmm_volume_encode
(
volume
);
...
...
src/output_internal.h
View file @
cb8449a6
...
...
@@ -76,7 +76,11 @@ struct audio_output {
* May be NULL if none is available, or if software volume is
* configured.
*/
#ifdef __cplusplus
class
Mixer
*
mixer
;
#else
struct
mixer
*
mixer
;
#endif
/**
* Will this output receive tags from the decoder? The
...
...
test/read_mixer.cxx
View file @
cb8449a6
...
...
@@ -111,7 +111,6 @@ pcm_volume(G_GNUC_UNUSED void *buffer, G_GNUC_UNUSED size_t length,
int
main
(
int
argc
,
G_GNUC_UNUSED
char
**
argv
)
{
GError
*
error
=
NULL
;
struct
mixer
*
mixer
;
bool
success
;
int
volume
;
...
...
@@ -124,7 +123,7 @@ int main(int argc, G_GNUC_UNUSED char **argv)
main_loop
=
new
EventLoop
(
EventLoop
::
Default
());
mixer
=
mixer_new
(
&
alsa_mixer_plugin
,
NULL
,
NULL
,
&
error
);
Mixer
*
mixer
=
mixer_new
(
&
alsa_mixer_plugin
,
NULL
,
NULL
,
&
error
);
if
(
mixer
==
NULL
)
{
g_printerr
(
"mixer_new() failed: %s
\n
"
,
error
->
message
);
g_error_free
(
error
);
...
...
test/run_filter.cxx
View file @
cb8449a6
...
...
@@ -36,7 +36,7 @@
#include <unistd.h>
bool
mixer_set_volume
(
G_GNUC_UNUSED
struct
m
ixer
*
mixer
,
mixer_set_volume
(
gcc_unused
M
ixer
*
mixer
,
G_GNUC_UNUSED
unsigned
volume
,
G_GNUC_UNUSED
GError
**
error_r
)
{
return
true
;
...
...
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