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
5f396e82
Commit
5f396e82
authored
Nov 24, 2016
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ReplayGainMode: convert to strictly-typed enum
parent
4f229c25
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
29 additions
and
27 deletions
+29
-27
Partition.cxx
src/Partition.cxx
+3
-3
Partition.hxx
src/Partition.hxx
+1
-1
ReplayGainConfig.cxx
src/ReplayGainConfig.cxx
+9
-9
ReplayGainInfo.hxx
src/ReplayGainInfo.hxx
+1
-1
ReplayGainMode.hxx
src/ReplayGainMode.hxx
+7
-5
Bridge.cxx
src/decoder/Bridge.cxx
+3
-3
ReplayGainFilterPlugin.cxx
src/filter/plugins/ReplayGainFilterPlugin.cxx
+4
-4
Internal.hxx
src/output/Internal.hxx
+1
-1
No files found.
src/Partition.cxx
View file @
5f396e82
...
...
@@ -45,10 +45,10 @@ Partition::EmitIdle(unsigned mask)
void
Partition
::
UpdateEffectiveReplayGainMode
(
ReplayGainMode
mode
)
{
if
(
mode
==
R
EPLAY_GAIN_
AUTO
)
if
(
mode
==
R
eplayGainMode
::
AUTO
)
mode
=
playlist
.
queue
.
random
?
R
EPLAY_GAIN_
TRACK
:
R
EPLAY_GAIN_
ALBUM
;
?
R
eplayGainMode
::
TRACK
:
R
eplayGainMode
::
ALBUM
;
outputs
.
SetReplayGainMode
(
mode
);
}
...
...
src/Partition.hxx
View file @
5f396e82
...
...
@@ -178,7 +178,7 @@ struct Partition final : QueueListener, PlayerListener, MixerListener {
/**
* Publishes the effective #ReplayGainMode to all subsystems.
* #R
EPLAY_GAIN_
AUTO is substituted.
* #R
eplayGainMode::
AUTO is substituted.
*
* @param mode the configured mode
*/
...
...
src/ReplayGainConfig.cxx
View file @
5f396e82
...
...
@@ -28,7 +28,7 @@
#include <string.h>
#include <math.h>
ReplayGainMode
replay_gain_mode
=
R
EPLAY_GAIN_
OFF
;
ReplayGainMode
replay_gain_mode
=
R
eplayGainMode
::
OFF
;
static
constexpr
bool
DEFAULT_REPLAYGAIN_LIMIT
=
true
;
...
...
@@ -40,16 +40,16 @@ const char *
replay_gain_get_mode_string
(
void
)
{
switch
(
replay_gain_mode
)
{
case
R
EPLAY_GAIN_
AUTO
:
case
R
eplayGainMode
:
:
AUTO
:
return
"auto"
;
case
R
EPLAY_GAIN_
OFF
:
case
R
eplayGainMode
:
:
OFF
:
return
"off"
;
case
R
EPLAY_GAIN_
TRACK
:
case
R
eplayGainMode
:
:
TRACK
:
return
"track"
;
case
R
EPLAY_GAIN_
ALBUM
:
case
R
eplayGainMode
:
:
ALBUM
:
return
"album"
;
}
...
...
@@ -63,13 +63,13 @@ replay_gain_set_mode_string(const char *p)
assert
(
p
!=
nullptr
);
if
(
strcmp
(
p
,
"off"
)
==
0
)
replay_gain_mode
=
R
EPLAY_GAIN_
OFF
;
replay_gain_mode
=
R
eplayGainMode
::
OFF
;
else
if
(
strcmp
(
p
,
"track"
)
==
0
)
replay_gain_mode
=
R
EPLAY_GAIN_
TRACK
;
replay_gain_mode
=
R
eplayGainMode
::
TRACK
;
else
if
(
strcmp
(
p
,
"album"
)
==
0
)
replay_gain_mode
=
R
EPLAY_GAIN_
ALBUM
;
replay_gain_mode
=
R
eplayGainMode
::
ALBUM
;
else
if
(
strcmp
(
p
,
"auto"
)
==
0
)
replay_gain_mode
=
R
EPLAY_GAIN_
AUTO
;
replay_gain_mode
=
R
eplayGainMode
::
AUTO
;
else
return
false
;
...
...
src/ReplayGainInfo.hxx
View file @
5f396e82
...
...
@@ -50,7 +50,7 @@ struct ReplayGainInfo {
}
const
ReplayGainTuple
&
Get
(
ReplayGainMode
mode
)
const
{
return
mode
==
R
EPLAY_GAIN_
ALBUM
return
mode
==
R
eplayGainMode
::
ALBUM
?
(
album
.
IsDefined
()
?
album
:
track
)
:
(
track
.
IsDefined
()
?
track
:
album
);
}
...
...
src/ReplayGainMode.hxx
View file @
5f396e82
...
...
@@ -20,11 +20,13 @@
#ifndef MPD_REPLAY_GAIN_MODE_HXX
#define MPD_REPLAY_GAIN_MODE_HXX
enum
ReplayGainMode
{
REPLAY_GAIN_AUTO
=
-
2
,
REPLAY_GAIN_OFF
,
REPLAY_GAIN_ALBUM
,
REPLAY_GAIN_TRACK
,
#include <stdint.h>
enum
class
ReplayGainMode
:
uint8_t
{
OFF
,
ALBUM
,
TRACK
,
AUTO
,
};
#endif
src/decoder/Bridge.cxx
View file @
5f396e82
...
...
@@ -592,10 +592,10 @@ DecoderBridge::SubmitReplayGain(const ReplayGainInfo *new_replay_gain_info)
if
(
++
serial
==
0
)
serial
=
1
;
if
(
R
EPLAY_GAIN_
OFF
!=
replay_gain_mode
)
{
if
(
R
eplayGainMode
::
OFF
!=
replay_gain_mode
)
{
ReplayGainMode
rgm
=
replay_gain_mode
;
if
(
rgm
!=
R
EPLAY_GAIN_
ALBUM
)
rgm
=
R
EPLAY_GAIN_
TRACK
;
if
(
rgm
!=
R
eplayGainMode
::
ALBUM
)
rgm
=
R
eplayGainMode
::
TRACK
;
const
auto
&
tuple
=
new_replay_gain_info
->
Get
(
rgm
);
const
auto
scale
=
...
...
src/filter/plugins/ReplayGainFilterPlugin.cxx
View file @
5f396e82
...
...
@@ -50,7 +50,7 @@ class ReplayGainFilter final : public Filter {
*/
const
unsigned
base
;
ReplayGainMode
mode
=
R
EPLAY_GAIN_
OFF
;
ReplayGainMode
mode
=
R
eplayGainMode
::
OFF
;
ReplayGainInfo
info
;
...
...
@@ -72,7 +72,7 @@ public:
ReplayGainFilter
(
const
AudioFormat
&
audio_format
,
Mixer
*
_mixer
,
unsigned
_base
)
:
Filter
(
audio_format
),
mixer
(
_mixer
),
base
(
_base
)
,
mode
(
REPLAY_GAIN_OFF
)
{
mixer
(
_mixer
),
base
(
_base
)
{
info
.
Clear
();
pv
.
Open
(
out_audio_format
.
format
);
...
...
@@ -94,7 +94,7 @@ public:
FormatDebug
(
replay_gain_domain
,
"replay gain mode has changed %d->%d
\n
"
,
mode
,
_mode
);
(
int
)
mode
,
(
int
)
_mode
);
mode
=
_mode
;
Update
();
...
...
@@ -138,7 +138,7 @@ void
ReplayGainFilter
::
Update
()
{
unsigned
volume
=
PCM_VOLUME_1
;
if
(
mode
!=
R
EPLAY_GAIN_
OFF
)
{
if
(
mode
!=
R
eplayGainMode
::
OFF
)
{
const
auto
&
tuple
=
info
.
Get
(
mode
);
float
scale
=
tuple
.
CalculateScale
(
replay_gain_preamp
,
replay_gain_missing_preamp
,
...
...
src/output/Internal.hxx
View file @
5f396e82
...
...
@@ -148,7 +148,7 @@ struct AudioOutput {
*/
bool
woken_for_play
=
false
;
ReplayGainMode
replay_gain_mode
=
R
EPLAY_GAIN_
OFF
;
ReplayGainMode
replay_gain_mode
=
R
eplayGainMode
::
OFF
;
/**
* If not nullptr, the device has failed, and this timer is used
...
...
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