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
0759d721
Commit
0759d721
authored
Nov 24, 2016
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Partition: add UpdateEffectiveReplayGainMode()
Move code from replay_gain_get_real_mode().
parent
9b9144f2
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
22 additions
and
23 deletions
+22
-23
Main.cxx
src/Main.cxx
+1
-1
Partition.cxx
src/Partition.cxx
+11
-0
Partition.hxx
src/Partition.hxx
+8
-0
ReplayGainConfig.cxx
src/ReplayGainConfig.cxx
+0
-13
ReplayGainConfig.hxx
src/ReplayGainConfig.hxx
+0
-7
PlayerCommands.cxx
src/command/PlayerCommands.cxx
+2
-2
No files found.
src/Main.cxx
View file @
0759d721
...
...
@@ -517,7 +517,7 @@ try {
glue_state_file_init
();
instance
->
partition
->
outputs
.
SetReplayGainMode
(
replay_gain_get_real_mode
(
instance
->
partition
->
playlist
.
queue
.
random
)
);
instance
->
partition
->
UpdateEffectiveReplayGainMode
(
replay_gain_mode
);
#ifdef ENABLE_DATABASE
if
(
config_get_bool
(
ConfigOption
::
AUTO_UPDATE
,
false
))
{
...
...
src/Partition.cxx
View file @
0759d721
...
...
@@ -42,6 +42,17 @@ Partition::EmitIdle(unsigned mask)
instance
.
EmitIdle
(
mask
);
}
void
Partition
::
UpdateEffectiveReplayGainMode
(
ReplayGainMode
mode
)
{
if
(
mode
==
REPLAY_GAIN_AUTO
)
mode
=
playlist
.
queue
.
random
?
REPLAY_GAIN_TRACK
:
REPLAY_GAIN_ALBUM
;
outputs
.
SetReplayGainMode
(
mode
);
}
#ifdef ENABLE_DATABASE
const
Database
*
...
...
src/Partition.hxx
View file @
0759d721
...
...
@@ -176,6 +176,14 @@ struct Partition final : QueueListener, PlayerListener, MixerListener {
playlist
.
SetConsume
(
new_value
);
}
/**
* Publishes the effective #ReplayGainMode to all subsystems.
* #REPLAY_GAIN_AUTO is substituted.
*
* @param mode the configured mode
*/
void
UpdateEffectiveReplayGainMode
(
ReplayGainMode
mode
);
#ifdef ENABLE_DATABASE
/**
* Returns the global #Database instance. May return nullptr
...
...
src/ReplayGainConfig.cxx
View file @
0759d721
...
...
@@ -131,16 +131,3 @@ void replay_gain_global_init(void)
replay_gain_limit
=
config_get_bool
(
ConfigOption
::
REPLAYGAIN_LIMIT
,
DEFAULT_REPLAYGAIN_LIMIT
);
}
ReplayGainMode
replay_gain_get_real_mode
(
bool
random_mode
)
{
ReplayGainMode
rgm
;
rgm
=
replay_gain_mode
;
if
(
rgm
==
REPLAY_GAIN_AUTO
)
rgm
=
random_mode
?
REPLAY_GAIN_TRACK
:
REPLAY_GAIN_ALBUM
;
return
rgm
;
}
src/ReplayGainConfig.hxx
View file @
0759d721
...
...
@@ -47,11 +47,4 @@ replay_gain_get_mode_string();
bool
replay_gain_set_mode_string
(
const
char
*
p
);
/**
* Returns the "real" mode according to the "auto" setting"
*/
gcc_pure
ReplayGainMode
replay_gain_get_real_mode
(
bool
random_mode
);
#endif
src/command/PlayerCommands.cxx
View file @
0759d721
...
...
@@ -263,7 +263,7 @@ handle_random(Client &client, Request args, gcc_unused Response &r)
{
bool
status
=
args
.
ParseBool
(
0
);
client
.
partition
.
SetRandom
(
status
);
client
.
partition
.
outputs
.
SetReplayGainMode
(
replay_gain_get_real_mode
(
client
.
partition
.
GetRandom
())
);
client
.
partition
.
UpdateEffectiveReplayGainMode
(
replay_gain_mode
);
return
CommandResult
::
OK
;
}
...
...
@@ -338,7 +338,7 @@ handle_replay_gain_mode(Client &client, Request args, Response &r)
return
CommandResult
::
ERROR
;
}
client
.
partition
.
outputs
.
SetReplayGainMode
(
replay_gain_get_real_mode
(
client
.
playlist
.
queue
.
random
)
);
client
.
partition
.
UpdateEffectiveReplayGainMode
(
replay_gain_mode
);
client
.
partition
.
EmitIdle
(
IDLE_OPTIONS
);
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