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
16944b53
Commit
16944b53
authored
Jan 25, 2015
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pcm/SoxrResampler: move quality recipe names to table
parent
72e44d59
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
24 deletions
+22
-24
SoxrResampler.cxx
src/pcm/SoxrResampler.cxx
+22
-24
No files found.
src/pcm/SoxrResampler.cxx
View file @
16944b53
...
...
@@ -43,23 +43,28 @@ static constexpr unsigned long SOXR_INVALID_RECIPE = -1;
static
soxr_quality_spec_t
soxr_quality
;
static
soxr_runtime_spec_t
soxr_runtime
;
static
constexpr
struct
{
unsigned
long
recipe
;
const
char
*
name
;
}
soxr_quality_table
[]
=
{
{
SOXR_VHQ
,
"very high"
},
{
SOXR_HQ
,
"high"
},
{
SOXR_MQ
,
"medium"
},
{
SOXR_LQ
,
"low"
},
{
SOXR_QQ
,
"quick"
},
{
SOXR_INVALID_RECIPE
,
nullptr
}
};
gcc_const
static
const
char
*
soxr_quality_name
(
unsigned
long
recipe
)
{
switch
(
recipe
)
{
case
SOXR_VHQ
:
return
"Very High Quality"
;
case
SOXR_HQ
:
return
"High Quality"
;
case
SOXR_MQ
:
return
"Medium Quality"
;
case
SOXR_LQ
:
return
"Low Quality"
;
case
SOXR_QQ
:
return
"Quick"
;
}
for
(
const
auto
*
i
=
soxr_quality_table
;;
++
i
)
{
assert
(
i
->
name
!=
nullptr
);
gcc_unreachable
();
if
(
i
->
recipe
==
recipe
)
return
i
->
name
;
}
}
gcc_pure
...
...
@@ -69,17 +74,10 @@ soxr_parse_quality(const char *quality)
if
(
quality
==
nullptr
)
return
SOXR_DEFAULT_RECIPE
;
if
(
strcmp
(
quality
,
"very high"
)
==
0
)
return
SOXR_VHQ
;
else
if
(
strcmp
(
quality
,
"high"
)
==
0
)
return
SOXR_HQ
;
else
if
(
strcmp
(
quality
,
"medium"
)
==
0
)
return
SOXR_MQ
;
else
if
(
strcmp
(
quality
,
"low"
)
==
0
)
return
SOXR_LQ
;
else
if
(
strcmp
(
quality
,
"quick"
)
==
0
)
return
SOXR_QQ
;
else
for
(
const
auto
*
i
=
soxr_quality_table
;
i
->
name
!=
nullptr
;
++
i
)
if
(
strcmp
(
i
->
name
,
"very high"
)
==
0
)
return
i
->
recipe
;
return
SOXR_INVALID_RECIPE
;
}
...
...
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