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
1a8ef3cd
Commit
1a8ef3cd
authored
Jan 05, 2013
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
filter/ReplayGain: add method _set_mode()
Push the new mode to the filter instead of accessing global variables through replay_gain_get_real_mode().
parent
7be33eba
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
56 additions
and
20 deletions
+56
-20
Main.cxx
src/Main.cxx
+2
-0
OutputAll.cxx
src/OutputAll.cxx
+7
-0
OutputControl.cxx
src/OutputControl.cxx
+9
-0
OutputControl.hxx
src/OutputControl.hxx
+6
-0
PlayerCommands.cxx
src/PlayerCommands.cxx
+4
-0
ReplayGainConfig.cxx
src/ReplayGainConfig.cxx
+3
-2
replay_gain_filter_plugin.c
src/filter/replay_gain_filter_plugin.c
+17
-11
replay_gain_filter_plugin.h
src/filter/replay_gain_filter_plugin.h
+3
-0
output_all.h
src/output_all.h
+4
-0
replay_gain_config.h
src/replay_gain_config.h
+1
-1
run_filter.c
test/run_filter.c
+0
-3
run_output.cxx
test/run_output.cxx
+0
-3
No files found.
src/Main.cxx
View file @
1a8ef3cd
...
...
@@ -480,6 +480,8 @@ int mpd_main(int argc, char *argv[])
return
EXIT_FAILURE
;
}
audio_output_all_set_replay_gain_mode
(
replay_gain_get_real_mode
(
g_playlist
.
queue
.
random
));
success
=
config_get_bool
(
CONF_AUTO_UPDATE
,
false
);
#ifdef ENABLE_INOTIFY
if
(
success
&&
mapper_has_music_directory
())
...
...
src/OutputAll.cxx
View file @
1a8ef3cd
...
...
@@ -273,6 +273,13 @@ audio_output_all_update(void)
return
ret
;
}
void
audio_output_all_set_replay_gain_mode
(
enum
replay_gain_mode
mode
)
{
for
(
unsigned
i
=
0
;
i
<
num_audio_outputs
;
++
i
)
audio_output_set_replay_gain_mode
(
audio_outputs
[
i
],
mode
);
}
bool
audio_output_all_play
(
struct
music_chunk
*
chunk
,
GError
**
error_r
)
{
...
...
src/OutputControl.cxx
View file @
1a8ef3cd
...
...
@@ -27,6 +27,7 @@ extern "C" {
#include "mixer_control.h"
#include "mixer_plugin.h"
#include "notify.h"
#include "filter/replay_gain_filter_plugin.h"
}
#include "filter_plugin.h"
...
...
@@ -96,6 +97,14 @@ ao_lock_command(struct audio_output *ao, enum audio_output_command cmd)
}
void
audio_output_set_replay_gain_mode
(
struct
audio_output
*
ao
,
enum
replay_gain_mode
mode
)
{
if
(
ao
->
replay_gain_filter
!=
NULL
)
replay_gain_filter_set_mode
(
ao
->
replay_gain_filter
,
mode
);
}
void
audio_output_enable
(
struct
audio_output
*
ao
)
{
if
(
ao
->
thread
==
NULL
)
{
...
...
src/OutputControl.hxx
View file @
1a8ef3cd
...
...
@@ -20,6 +20,8 @@
#ifndef MPD_OUTPUT_CONTROL_HXX
#define MPD_OUTPUT_CONTROL_HXX
#include "replay_gain_info.h"
#include <glib.h>
#include <stddef.h>
...
...
@@ -36,6 +38,10 @@ audio_output_quark(void)
return
g_quark_from_static_string
(
"audio_output"
);
}
void
audio_output_set_replay_gain_mode
(
struct
audio_output
*
ao
,
enum
replay_gain_mode
mode
);
/**
* Enables the device.
*/
...
...
src/PlayerCommands.cxx
View file @
1a8ef3cd
...
...
@@ -31,6 +31,7 @@ extern "C" {
#include "audio_format.h"
#include "volume.h"
#include "replay_gain_config.h"
#include "output_all.h"
}
#include "PlayerControl.hxx"
...
...
@@ -280,6 +281,7 @@ handle_random(Client *client, G_GNUC_UNUSED int argc, char *argv[])
return
COMMAND_RETURN_ERROR
;
playlist_set_random
(
&
client
->
playlist
,
client
->
player_control
,
status
);
audio_output_all_set_replay_gain_mode
(
replay_gain_get_real_mode
(
client
->
playlist
.
queue
.
random
));
return
COMMAND_RETURN_OK
;
}
...
...
@@ -386,6 +388,8 @@ handle_replay_gain_mode(Client *client,
return
COMMAND_RETURN_ERROR
;
}
audio_output_all_set_replay_gain_mode
(
replay_gain_get_real_mode
(
client
->
playlist
.
queue
.
random
));
return
COMMAND_RETURN_OK
;
}
...
...
src/ReplayGainConfig.cxx
View file @
1a8ef3cd
...
...
@@ -136,14 +136,15 @@ void replay_gain_global_init(void)
replay_gain_limit
=
config_get_bool
(
CONF_REPLAYGAIN_LIMIT
,
DEFAULT_REPLAYGAIN_LIMIT
);
}
enum
replay_gain_mode
replay_gain_get_real_mode
(
void
)
enum
replay_gain_mode
replay_gain_get_real_mode
(
bool
random_mode
)
{
enum
replay_gain_mode
rgm
;
rgm
=
replay_gain_mode
;
if
(
rgm
==
REPLAY_GAIN_AUTO
)
rgm
=
g_playlist
.
queue
.
random
?
REPLAY_GAIN_TRACK
:
REPLAY_GAIN_ALBUM
;
rgm
=
random_mode
?
REPLAY_GAIN_TRACK
:
REPLAY_GAIN_ALBUM
;
return
rgm
;
}
src/filter/replay_gain_filter_plugin.c
View file @
1a8ef3cd
...
...
@@ -119,7 +119,7 @@ replay_gain_filter_init(G_GNUC_UNUSED const struct config_param *param,
filter_init
(
&
filter
->
filter
,
&
replay_gain_filter_plugin
);
filter
->
mixer
=
NULL
;
filter
->
mode
=
replay_gain_get_real_mode
()
;
filter
->
mode
=
REPLAY_GAIN_OFF
;
replay_gain_info_init
(
&
filter
->
info
);
filter
->
volume
=
PCM_VOLUME_1
;
...
...
@@ -164,16 +164,6 @@ replay_gain_filter_filter(struct filter *_filter,
(
struct
replay_gain_filter
*
)
_filter
;
bool
success
;
void
*
dest
;
enum
replay_gain_mode
rg_mode
;
/* check if the mode has been changed since the last call */
rg_mode
=
replay_gain_get_real_mode
();
if
(
filter
->
mode
!=
rg_mode
)
{
g_debug
(
"replay gain mode has changed %d->%d
\n
"
,
filter
->
mode
,
rg_mode
);
filter
->
mode
=
rg_mode
;
replay_gain_filter_update
(
filter
);
}
*
dest_size_r
=
src_size
;
...
...
@@ -243,3 +233,19 @@ replay_gain_filter_set_info(struct filter *_filter,
replay_gain_filter_update
(
filter
);
}
void
replay_gain_filter_set_mode
(
struct
filter
*
_filter
,
enum
replay_gain_mode
mode
)
{
struct
replay_gain_filter
*
filter
=
(
struct
replay_gain_filter
*
)
_filter
;
if
(
mode
==
filter
->
mode
)
/* no change */
return
;
g_debug
(
"replay gain mode has changed %d->%d
\n
"
,
filter
->
mode
,
mode
);
filter
->
mode
=
mode
;
replay_gain_filter_update
(
filter
);
}
src/filter/replay_gain_filter_plugin.h
View file @
1a8ef3cd
...
...
@@ -47,4 +47,7 @@ void
replay_gain_filter_set_info
(
struct
filter
*
filter
,
const
struct
replay_gain_info
*
info
);
void
replay_gain_filter_set_mode
(
struct
filter
*
filter
,
enum
replay_gain_mode
mode
);
#endif
src/output_all.h
View file @
1a8ef3cd
...
...
@@ -26,6 +26,7 @@
#ifndef OUTPUT_ALL_H
#define OUTPUT_ALL_H
#include "replay_gain_info.h"
#include "gerror.h"
#include <stdbool.h>
...
...
@@ -102,6 +103,9 @@ audio_output_all_close(void);
void
audio_output_all_release
(
void
);
void
audio_output_all_set_replay_gain_mode
(
enum
replay_gain_mode
mode
);
/**
* Enqueue a #music_chunk object for playing, i.e. pushes it to a
* #music_pipe.
...
...
src/replay_gain_config.h
View file @
1a8ef3cd
...
...
@@ -50,6 +50,6 @@ replay_gain_set_mode_string(const char *p);
* Returns the "real" mode according to the "auto" setting"
*/
enum
replay_gain_mode
replay_gain_get_real_mode
(
void
);
replay_gain_get_real_mode
(
bool
random_mode
);
#endif
test/run_filter.c
View file @
1a8ef3cd
...
...
@@ -25,7 +25,6 @@
#include "pcm_volume.h"
#include "idle.h"
#include "mixer_control.h"
#include "Playlist.hxx"
#include "stdbin.h"
#include <glib.h>
...
...
@@ -35,8 +34,6 @@
#include <errno.h>
#include <unistd.h>
struct
playlist
g_playlist
;
void
idle_add
(
G_GNUC_UNUSED
unsigned
flags
)
{
...
...
test/run_output.cxx
View file @
1a8ef3cd
...
...
@@ -32,7 +32,6 @@ extern "C" {
#include "idle.h"
}
#include "Playlist.hxx"
#include "PlayerControl.hxx"
#include "stdbin.h"
...
...
@@ -43,8 +42,6 @@ extern "C" {
#include <unistd.h>
#include <stdlib.h>
struct
playlist
g_playlist
;
void
idle_add
(
G_GNUC_UNUSED
unsigned
flags
)
{
...
...
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