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
506c716c
Commit
506c716c
authored
Apr 16, 2013
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mixer/Software: convert to a class
parent
9f625b0a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
20 deletions
+22
-20
SoftwareMixerPlugin.cxx
src/mixer/SoftwareMixerPlugin.cxx
+22
-20
No files found.
src/mixer/SoftwareMixerPlugin.cxx
View file @
506c716c
...
...
@@ -22,19 +22,30 @@
#include "MixerInternal.hxx"
#include "FilterPlugin.hxx"
#include "FilterRegistry.hxx"
#include "FilterInternal.hxx"
#include "filter/VolumeFilterPlugin.hxx"
#include "pcm/PcmVolume.hxx"
#include <assert.h>
#include <math.h>
struct
software_mixer
{
/** the base mixer class */
struct
mixer
base
;
struct
SoftwareMixer
final
:
public
mixer
{
Filter
*
filter
;
unsigned
volume
;
SoftwareMixer
()
:
filter
(
filter_new
(
&
volume_filter_plugin
,
nullptr
,
nullptr
)),
volume
(
100
)
{
assert
(
filter
!=
nullptr
);
mixer_init
(
this
,
&
software_mixer_plugin
);
}
~
SoftwareMixer
()
{
delete
filter
;
}
};
static
struct
mixer
*
...
...
@@ -42,30 +53,21 @@ software_mixer_init(G_GNUC_UNUSED void *ao,
G_GNUC_UNUSED
const
struct
config_param
*
param
,
G_GNUC_UNUSED
GError
**
error_r
)
{
struct
software_mixer
*
sm
=
g_new
(
struct
software_mixer
,
1
);
mixer_init
(
&
sm
->
base
,
&
software_mixer_plugin
);
sm
->
filter
=
filter_new
(
&
volume_filter_plugin
,
NULL
,
NULL
);
assert
(
sm
->
filter
!=
NULL
);
sm
->
volume
=
100
;
return
&
sm
->
base
;
return
new
SoftwareMixer
();
}
static
void
software_mixer_finish
(
struct
mixer
*
data
)
{
struct
software_mixer
*
sm
=
(
struct
software_m
ixer
*
)
data
;
SoftwareMixer
*
sm
=
(
SoftwareM
ixer
*
)
data
;
g_free
(
sm
)
;
delete
sm
;
}
static
int
software_mixer_get_volume
(
struct
mixer
*
mixer
,
G_GNUC_UNUSED
GError
**
error_r
)
{
struct
software_mixer
*
sm
=
(
struct
software_m
ixer
*
)
mixer
;
SoftwareMixer
*
sm
=
(
SoftwareM
ixer
*
)
mixer
;
return
sm
->
volume
;
}
...
...
@@ -74,7 +76,7 @@ static bool
software_mixer_set_volume
(
struct
mixer
*
mixer
,
unsigned
volume
,
G_GNUC_UNUSED
GError
**
error_r
)
{
struct
software_mixer
*
sm
=
(
struct
software_m
ixer
*
)
mixer
;
SoftwareMixer
*
sm
=
(
SoftwareM
ixer
*
)
mixer
;
assert
(
volume
<=
100
);
...
...
@@ -103,9 +105,9 @@ const struct mixer_plugin software_mixer_plugin = {
Filter
*
software_mixer_get_filter
(
struct
mixer
*
mixer
)
{
struct
software_mixer
*
sm
=
(
struct
software_m
ixer
*
)
mixer
;
SoftwareMixer
*
sm
=
(
SoftwareM
ixer
*
)
mixer
;
assert
(
sm
->
base
.
plugin
==
&
software_mixer_plugin
);
assert
(
sm
->
plugin
==
&
software_mixer_plugin
);
return
sm
->
filter
;
}
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