Merge branch 'v0.23.x'

This commit is contained in:
Max Kellermann 2021-12-06 21:32:48 +01:00
commit b6ba17a865
6 changed files with 58 additions and 14 deletions

View File

@ -79,7 +79,7 @@
# This setting sets the address for the daemon to listen on. Careful attention # This setting sets the address for the daemon to listen on. Careful attention
# should be paid if this is assigned to anything other than the default, any. # should be paid if this is assigned to anything other than the default, any.
# This setting can deny access to control of the daemon. Not effective if # This setting can deny access to control of the daemon. Not effective if
# systemd socket activiation is in use. # systemd socket activation is in use.
# #
# For network # For network
#bind_to_address "any" #bind_to_address "any"
@ -185,7 +185,7 @@
# cache_directory "~/.local/share/mpd/cache" # cache_directory "~/.local/share/mpd/cache"
#} #}
# #
# An example of database config for a sattelite setup # An example of database config for a satellite setup
# #
#music_directory "nfs://fileserver.local/srv/mp3" #music_directory "nfs://fileserver.local/srv/mp3"
#database { #database {

View File

@ -479,7 +479,7 @@ Querying :program:`MPD`'s status
current song in seconds, but with higher resolution. current song in seconds, but with higher resolution.
- ``duration`` [#since_0_20]_: Duration of the current song in seconds. - ``duration`` [#since_0_20]_: Duration of the current song in seconds.
- ``bitrate``: instantaneous bitrate in kbps - ``bitrate``: instantaneous bitrate in kbps
- ``xfade``: ``crossfade`` in seconds - ``xfade``: ``crossfade`` in seconds (see :ref:`crossfading`)
- ``mixrampdb``: ``mixramp`` threshold in dB - ``mixrampdb``: ``mixramp`` threshold in dB
- ``mixrampdelay``: ``mixrampdelay`` in seconds - ``mixrampdelay``: ``mixrampdelay`` in seconds
- ``audio``: The format emitted by the decoder plugin during - ``audio``: The format emitted by the decoder plugin during
@ -519,17 +519,19 @@ Playback options
.. _command_crossfade: .. _command_crossfade:
:command:`crossfade {SECONDS}` :command:`crossfade {SECONDS}`
Sets crossfading between songs. Sets crossfading between songs. See :ref:`crossfading`.
.. _command_mixrampdb: .. _command_mixrampdb:
:command:`mixrampdb {deciBels}` :command:`mixrampdb {deciBels}`
Sets the threshold at which songs will be overlapped. Like crossfading but doesn't fade the track volume, just overlaps. The songs need to have MixRamp tags added by an external tool. 0dB is the normalized maximum volume so use negative values, I prefer -17dB. In the absence of mixramp tags crossfading will be used. See http://sourceforge.net/projects/mixramp Sets the threshold at which songs will be overlapped.
See :ref:`mixramp`.
.. _command_mixrampdelay: .. _command_mixrampdelay:
:command:`mixrampdelay {SECONDS}` :command:`mixrampdelay {SECONDS}`
Additional time subtracted from the overlap calculated by mixrampdb. A value of "nan" disables MixRamp overlapping and falls back to crossfading. Additional time subtracted from the overlap calculated by mixrampdb. A value of "nan" disables MixRamp overlapping and falls back to crossfading.
See :ref:`mixramp`.
.. _command_random: .. _command_random:

View File

@ -622,6 +622,51 @@ enabled by setting ``volume_normalization`` to ``yes``. It supports
16 bit PCM only. 16 bit PCM only.
.. _crossfading:
Cross-Fading
------------
If ``crossfade`` is set to a positive number, then adjacent songs are
cross-faded by this number of seconds. This is a run-time setting
:ref:`which can be controlled by clients <command_crossfade>`,
e.g. with :program:`mpc`::
mpc crossfade 10
mpc crossfade 0
Zero means cross-fading is disabled.
Cross-fading is only possible if both songs have the same audio
format. At the cost of quality loss and higher CPU usage, you can
make sure this is always given by configuring
:ref:`audio_output_format`.
.. _mixramp:
MixRamp
^^^^^^^
MixRamp tags describe the loudness levels at start and end of a song
and can be used by MPD to find the best time to begin cross-fading.
MPD enables MixRamp if:
- Cross-fade is enabled
- :ref:`mixrampdelay <command_mixrampdelay>` is set to a positive
value, e.g.::
mpc mixrampdelay 1
- :ref:`mixrampdb <command_mixrampdb>` is set to a reasonable value,
e.g.::
mpc mixrampdb -17
- both songs have MixRamp tags
- both songs have the same audio format (or :ref:`audio_output_format`
is configured)
The `MixRamp <http://sourceforge.net/projects/mixramp>`__ tool can be
used to add MixRamp tags to your song files.
Client Connections Client Connections
------------------ ------------------

View File

@ -48,15 +48,14 @@ LocateFileUri(const char *uri, const Client *client
/* this path was relative to the music /* this path was relative to the music
directory */ directory */
// TODO: don't use suffix.data() (ok for now because we know it's null-terminated) // TODO: don't use suffix.data() (ok for now because we know it's null-terminated)
return LocatedUri(LocatedUri::Type::RELATIVE, return {LocatedUri::Type::RELATIVE, suffix.data()};
suffix.data());
} }
#endif #endif
if (client != nullptr) if (client != nullptr)
client->AllowFile(path); client->AllowFile(path);
return LocatedUri(LocatedUri::Type::PATH, uri, std::move(path)); return {LocatedUri::Type::PATH, uri, std::move(path)};
} }
static LocatedUri static LocatedUri
@ -90,8 +89,7 @@ LocateAbsoluteUri(UriPluginKind kind, const char *uri
const auto suffix = storage->MapToRelativeUTF8(uri); const auto suffix = storage->MapToRelativeUTF8(uri);
if (suffix.data() != nullptr) if (suffix.data() != nullptr)
// TODO: don't use suffix.data() (ok for now because we know it's null-terminated) // TODO: don't use suffix.data() (ok for now because we know it's null-terminated)
return LocatedUri(LocatedUri::Type::RELATIVE, return {LocatedUri::Type::RELATIVE, suffix.data()};
suffix.data());
} }
if (kind == UriPluginKind::STORAGE && if (kind == UriPluginKind::STORAGE &&
@ -99,7 +97,7 @@ LocateAbsoluteUri(UriPluginKind kind, const char *uri
throw std::invalid_argument("Unsupported URI scheme"); throw std::invalid_argument("Unsupported URI scheme");
#endif #endif
return LocatedUri(LocatedUri::Type::ABSOLUTE, uri); return {LocatedUri::Type::ABSOLUTE, uri};
} }
LocatedUri LocatedUri

View File

@ -60,7 +60,7 @@ CurlUnescape(CURL *curl, StringView src) noexcept
int outlength; int outlength;
CurlString tmp(curl_easy_unescape(curl, src.data, src.size, CurlString tmp(curl_easy_unescape(curl, src.data, src.size,
&outlength)); &outlength));
return std::string(tmp.c_str(), outlength); return {tmp.c_str(), size_t(outlength)};
} }
std::string std::string

View File

@ -140,8 +140,7 @@ LibsampleratePcmResampler::Resample2(ConstBuffer<float> src)
throw FormatRuntimeError("libsamplerate has failed: %s", throw FormatRuntimeError("libsamplerate has failed: %s",
src_strerror(result)); src_strerror(result));
return ConstBuffer<float>(data.data_out, return {data.data_out, size_t(data.output_frames_gen * channels)};
data.output_frames_gen * channels);
} }
ConstBuffer<void> ConstBuffer<void>