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
3472208c
Commit
3472208c
authored
Dec 03, 2016
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ReplayGainGlobal: move replay_gain_mode to struct Partition
parent
fc30e1d5
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
30 additions
and
27 deletions
+30
-27
Main.cxx
src/Main.cxx
+11
-2
Partition.cxx
src/Partition.cxx
+3
-1
Partition.hxx
src/Partition.hxx
+9
-3
ReplayGainGlobal.cxx
src/ReplayGainGlobal.cxx
+1
-12
ReplayGainGlobal.hxx
src/ReplayGainGlobal.hxx
+0
-3
PlayerCommands.cxx
src/command/PlayerCommands.cxx
+6
-6
No files found.
src/Main.cxx
View file @
3472208c
...
@@ -57,6 +57,7 @@
...
@@ -57,6 +57,7 @@
#include "config/ConfigOption.hxx"
#include "config/ConfigOption.hxx"
#include "config/ConfigError.hxx"
#include "config/ConfigError.hxx"
#include "Stats.hxx"
#include "Stats.hxx"
#include "util/RuntimeError.hxx"
#ifdef ENABLE_DAEMON
#ifdef ENABLE_DAEMON
#include "unix/Daemon.hxx"
#include "unix/Daemon.hxx"
...
@@ -331,6 +332,16 @@ initialize_decoder_and_player(void)
...
@@ -331,6 +332,16 @@ initialize_decoder_and_player(void)
buffered_chunks
,
buffered_chunks
,
buffered_before_play
,
buffered_before_play
,
replay_gain_config
);
replay_gain_config
);
try
{
param
=
config_get_param
(
ConfigOption
::
REPLAYGAIN
);
if
(
param
!=
nullptr
)
instance
->
partition
->
replay_gain_mode
=
FromString
(
param
->
value
.
c_str
());
}
catch
(...)
{
std
::
throw_with_nested
(
FormatRuntimeError
(
"Failed to parse line %i"
,
param
->
line
));
}
}
}
void
void
...
@@ -519,8 +530,6 @@ try {
...
@@ -519,8 +530,6 @@ try {
glue_state_file_init
();
glue_state_file_init
();
instance
->
partition
->
UpdateEffectiveReplayGainMode
(
replay_gain_mode
);
#ifdef ENABLE_DATABASE
#ifdef ENABLE_DATABASE
if
(
config_get_bool
(
ConfigOption
::
AUTO_UPDATE
,
false
))
{
if
(
config_get_bool
(
ConfigOption
::
AUTO_UPDATE
,
false
))
{
#ifdef ENABLE_INOTIFY
#ifdef ENABLE_INOTIFY
...
...
src/Partition.cxx
View file @
3472208c
...
@@ -36,6 +36,7 @@ Partition::Partition(Instance &_instance,
...
@@ -36,6 +36,7 @@ Partition::Partition(Instance &_instance,
pc
(
*
this
,
outputs
,
buffer_chunks
,
buffered_before_play
,
pc
(
*
this
,
outputs
,
buffer_chunks
,
buffered_before_play
,
replay_gain_config
)
replay_gain_config
)
{
{
UpdateEffectiveReplayGainMode
();
}
}
void
void
...
@@ -45,8 +46,9 @@ Partition::EmitIdle(unsigned mask)
...
@@ -45,8 +46,9 @@ Partition::EmitIdle(unsigned mask)
}
}
void
void
Partition
::
UpdateEffectiveReplayGainMode
(
ReplayGainMode
mode
)
Partition
::
UpdateEffectiveReplayGainMode
()
{
{
auto
mode
=
replay_gain_mode
;
if
(
mode
==
ReplayGainMode
::
AUTO
)
if
(
mode
==
ReplayGainMode
::
AUTO
)
mode
=
playlist
.
queue
.
random
mode
=
playlist
.
queue
.
random
?
ReplayGainMode
::
TRACK
?
ReplayGainMode
::
TRACK
...
...
src/Partition.hxx
View file @
3472208c
...
@@ -27,6 +27,7 @@
...
@@ -27,6 +27,7 @@
#include "mixer/Listener.hxx"
#include "mixer/Listener.hxx"
#include "player/Control.hxx"
#include "player/Control.hxx"
#include "player/Listener.hxx"
#include "player/Listener.hxx"
#include "ReplayGainMode.hxx"
#include "Chrono.hxx"
#include "Chrono.hxx"
#include "Compiler.h"
#include "Compiler.h"
...
@@ -52,6 +53,8 @@ struct Partition final : QueueListener, PlayerListener, MixerListener {
...
@@ -52,6 +53,8 @@ struct Partition final : QueueListener, PlayerListener, MixerListener {
PlayerControl
pc
;
PlayerControl
pc
;
ReplayGainMode
replay_gain_mode
=
ReplayGainMode
::
OFF
;
Partition
(
Instance
&
_instance
,
Partition
(
Instance
&
_instance
,
unsigned
max_length
,
unsigned
max_length
,
unsigned
buffer_chunks
,
unsigned
buffer_chunks
,
...
@@ -177,13 +180,16 @@ struct Partition final : QueueListener, PlayerListener, MixerListener {
...
@@ -177,13 +180,16 @@ struct Partition final : QueueListener, PlayerListener, MixerListener {
playlist
.
SetConsume
(
new_value
);
playlist
.
SetConsume
(
new_value
);
}
}
void
SetReplayGainMode
(
ReplayGainMode
mode
)
{
replay_gain_mode
=
mode
;
UpdateEffectiveReplayGainMode
();
}
/**
/**
* Publishes the effective #ReplayGainMode to all subsystems.
* Publishes the effective #ReplayGainMode to all subsystems.
* #ReplayGainMode::AUTO is substituted.
* #ReplayGainMode::AUTO is substituted.
*
* @param mode the configured mode
*/
*/
void
UpdateEffectiveReplayGainMode
(
ReplayGainMode
mode
);
void
UpdateEffectiveReplayGainMode
();
#ifdef ENABLE_DATABASE
#ifdef ENABLE_DATABASE
/**
/**
...
...
src/ReplayGainGlobal.cxx
View file @
3472208c
...
@@ -28,7 +28,6 @@
...
@@ -28,7 +28,6 @@
#include <stdlib.h>
#include <stdlib.h>
#include <math.h>
#include <math.h>
ReplayGainMode
replay_gain_mode
=
ReplayGainMode
::
OFF
;
ReplayGainConfig
replay_gain_config
;
ReplayGainConfig
replay_gain_config
;
static
float
static
float
...
@@ -60,17 +59,7 @@ ParsePreamp(const ConfigParam &p)
...
@@ -60,17 +59,7 @@ ParsePreamp(const ConfigParam &p)
void
replay_gain_global_init
(
void
)
void
replay_gain_global_init
(
void
)
{
{
const
auto
*
param
=
config_get_param
(
ConfigOption
::
REPLAYGAIN
);
const
auto
*
param
=
config_get_param
(
ConfigOption
::
REPLAYGAIN_PREAMP
);
try
{
if
(
param
!=
nullptr
)
replay_gain_mode
=
FromString
(
param
->
value
.
c_str
());
}
catch
(...)
{
std
::
throw_with_nested
(
FormatRuntimeError
(
"Failed to parse line %i"
,
param
->
line
));
}
param
=
config_get_param
(
ConfigOption
::
REPLAYGAIN_PREAMP
);
if
(
param
)
if
(
param
)
replay_gain_config
.
preamp
=
ParsePreamp
(
*
param
);
replay_gain_config
.
preamp
=
ParsePreamp
(
*
param
);
...
...
src/ReplayGainGlobal.hxx
View file @
3472208c
...
@@ -21,12 +21,9 @@
...
@@ -21,12 +21,9 @@
#define MPD_REPLAY_GAIN_GLOBAL_HXX
#define MPD_REPLAY_GAIN_GLOBAL_HXX
#include "check.h"
#include "check.h"
#include "ReplayGainMode.hxx"
struct
ReplayGainConfig
;
struct
ReplayGainConfig
;
extern
ReplayGainMode
replay_gain_mode
;
extern
ReplayGainConfig
replay_gain_config
;
extern
ReplayGainConfig
replay_gain_config
;
void
void
...
...
src/command/PlayerCommands.cxx
View file @
3472208c
...
@@ -30,7 +30,6 @@
...
@@ -30,7 +30,6 @@
#include "Instance.hxx"
#include "Instance.hxx"
#include "Idle.hxx"
#include "Idle.hxx"
#include "AudioFormat.hxx"
#include "AudioFormat.hxx"
#include "ReplayGainGlobal.hxx"
#include "util/ScopeExit.hxx"
#include "util/ScopeExit.hxx"
#ifdef ENABLE_DATABASE
#ifdef ENABLE_DATABASE
...
@@ -263,7 +262,7 @@ handle_random(Client &client, Request args, gcc_unused Response &r)
...
@@ -263,7 +262,7 @@ handle_random(Client &client, Request args, gcc_unused Response &r)
{
{
bool
status
=
args
.
ParseBool
(
0
);
bool
status
=
args
.
ParseBool
(
0
);
client
.
partition
.
SetRandom
(
status
);
client
.
partition
.
SetRandom
(
status
);
client
.
partition
.
UpdateEffectiveReplayGainMode
(
replay_gain_mode
);
client
.
partition
.
UpdateEffectiveReplayGainMode
();
return
CommandResult
::
OK
;
return
CommandResult
::
OK
;
}
}
...
@@ -333,16 +332,17 @@ handle_mixrampdelay(Client &client, Request args, gcc_unused Response &r)
...
@@ -333,16 +332,17 @@ handle_mixrampdelay(Client &client, Request args, gcc_unused Response &r)
CommandResult
CommandResult
handle_replay_gain_mode
(
Client
&
client
,
Request
args
,
Response
&
)
handle_replay_gain_mode
(
Client
&
client
,
Request
args
,
Response
&
)
{
{
replay_gain
_mode
=
FromString
(
args
.
front
());
auto
new
_mode
=
FromString
(
args
.
front
());
client
.
partition
.
UpdateEffectiveReplayGainMode
(
replay_gain
_mode
);
client
.
partition
.
SetReplayGainMode
(
new
_mode
);
client
.
partition
.
EmitIdle
(
IDLE_OPTIONS
);
client
.
partition
.
EmitIdle
(
IDLE_OPTIONS
);
return
CommandResult
::
OK
;
return
CommandResult
::
OK
;
}
}
CommandResult
CommandResult
handle_replay_gain_status
(
gcc_unused
Client
&
client
,
gcc_unused
Request
args
,
handle_replay_gain_status
(
Client
&
client
,
gcc_unused
Request
args
,
Response
&
r
)
Response
&
r
)
{
{
r
.
Format
(
"replay_gain_mode: %s
\n
"
,
ToString
(
replay_gain_mode
));
r
.
Format
(
"replay_gain_mode: %s
\n
"
,
ToString
(
client
.
partition
.
replay_gain_mode
));
return
CommandResult
::
OK
;
return
CommandResult
::
OK
;
}
}
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