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
716bdc36
Commit
716bdc36
authored
Jan 21, 2014
by
Chase Geigle
Committed by
Max Kellermann
Jan 21, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pcm/SoxrResampler: Add configurable quality levels
parent
4f120f37
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
111 additions
and
4 deletions
+111
-4
user.xml
doc/user.xml
+38
-1
ConfiguredResampler.cxx
src/pcm/ConfiguredResampler.cxx
+2
-2
SoxrResampler.cxx
src/pcm/SoxrResampler.cxx
+68
-1
SoxrResampler.hxx
src/pcm/SoxrResampler.hxx
+3
-0
No files found.
doc/user.xml
View file @
716bdc36
...
...
@@ -700,10 +700,47 @@ systemctl start mpd.socket</programlisting>
<row>
<entry>
"
<parameter>
soxr very high
</parameter>
"
</entry>
<entry>
Use libsoxr with "Very High Quality" setting.
</entry>
</row>
<row>
<entry>
"
<parameter>
soxr high
</parameter>
" or
"
<parameter>
soxr
</parameter>
"
</entry>
<entry>
Use libsoxr.
Use libsoxr with "High Quality" setting.
</entry>
</row>
<row>
<entry>
"
<parameter>
soxr medium
</parameter>
"
</entry>
<entry>
Use libsoxr with "Medium Quality" setting.
</entry>
</row>
<row>
<entry>
"
<parameter>
soxr low
</parameter>
"
</entry>
<entry>
Use libsoxr with "Low Quality" setting.
</entry>
</row>
<row>
<entry>
"
<parameter>
soxr quick
</parameter>
"
</entry>
<entry>
Use libsoxr with "Quick" setting.
</entry>
</row>
...
...
src/pcm/ConfiguredResampler.cxx
View file @
716bdc36
...
...
@@ -59,9 +59,9 @@ pcm_resampler_global_init(Error &error)
return
true
;
#ifdef HAVE_SOXR
if
(
strcmp
(
converter
,
"soxr"
)
==
0
)
{
if
(
memcmp
(
converter
,
"soxr"
,
4
)
==
0
)
{
selected_resampler
=
SelectedResampler
::
SOXR
;
return
true
;
return
pcm_resample_soxr_global_init
(
converter
,
error
)
;
}
#endif
...
...
src/pcm/SoxrResampler.cxx
View file @
716bdc36
...
...
@@ -31,6 +31,72 @@
static
constexpr
Domain
soxr_domain
(
"soxr"
);
static
unsigned
long
soxr_quality_recipe
=
SOXR_HQ
;
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"
;
}
gcc_unreachable
();
}
static
bool
soxr_parse_converter
(
const
char
*
converter
)
{
assert
(
converter
!=
nullptr
);
assert
(
memcmp
(
converter
,
"soxr"
,
4
)
==
0
);
if
(
converter
[
4
]
==
'\0'
)
return
true
;
if
(
converter
[
4
]
!=
' '
)
return
false
;
// converter example is "soxr very high", we want the "very high" part
const
char
*
quality
=
converter
+
5
;
if
(
strcmp
(
quality
,
"very high"
)
==
0
)
soxr_quality_recipe
=
SOXR_VHQ
;
else
if
(
strcmp
(
quality
,
"high"
)
==
0
)
soxr_quality_recipe
=
SOXR_HQ
;
else
if
(
strcmp
(
quality
,
"medium"
)
==
0
)
soxr_quality_recipe
=
SOXR_MQ
;
else
if
(
strcmp
(
quality
,
"low"
)
==
0
)
soxr_quality_recipe
=
SOXR_LQ
;
else
if
(
strcmp
(
quality
,
"quick"
)
==
0
)
soxr_quality_recipe
=
SOXR_QQ
;
else
return
false
;
return
true
;
}
bool
pcm_resample_soxr_global_init
(
const
char
*
converter
,
Error
&
error
)
{
if
(
!
soxr_parse_converter
(
converter
))
{
error
.
Format
(
soxr_domain
,
"unknown samplerate converter '%s'"
,
converter
);
return
false
;
}
FormatDebug
(
soxr_domain
,
"soxr converter '%s'"
,
soxr_quality_name
(
soxr_quality_recipe
));
return
true
;
}
AudioFormat
SoxrPcmResampler
::
Open
(
AudioFormat
&
af
,
unsigned
new_sample_rate
,
Error
&
error
)
...
...
@@ -39,9 +105,10 @@ SoxrPcmResampler::Open(AudioFormat &af, unsigned new_sample_rate,
assert
(
audio_valid_sample_rate
(
new_sample_rate
));
soxr_error_t
e
;
soxr_quality_spec_t
quality
=
soxr_quality_spec
(
soxr_quality_recipe
,
0
);
soxr
=
soxr_create
(
af
.
sample_rate
,
new_sample_rate
,
af
.
channels
,
&
e
,
nullptr
,
nullptr
,
nullptr
);
nullptr
,
&
quality
,
nullptr
);
if
(
soxr
==
nullptr
)
{
error
.
Format
(
soxr_domain
,
"soxr initialization has failed: %s"
,
e
);
...
...
src/pcm/SoxrResampler.hxx
View file @
716bdc36
...
...
@@ -44,4 +44,7 @@ public:
Error
&
error
)
override
;
};
bool
pcm_resample_soxr_global_init
(
const
char
*
converter
,
Error
&
error
);
#endif
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