Commit Graph

157 Commits

Author SHA1 Message Date
Max Kellermann
b1c7649edb output/alsa: non-blocking mode
Use SND_PCM_NONBLOCK, and perform all snd_pcm_writei() calls in the
IOThread.  Use a lockless queue to copy data from the OutputThread to
the IOThread.

This rather major change aims to improve MPD's internal latency.  All
waits are now under MPD's control, instead of blocking inside
libasound2.

As a side effect, an output's filter is now decoupled from the actual
device I/O, which solves a major latency problem with the conversion
filter on slow CPUs and small period buffers.  See:

 https://bugs.musicpd.org/view.php?id=3900
2017-02-09 21:36:18 +01:00
Max Kellermann
8fd9d91974 output/Plugin: pass EventLoop& to init()
Eliminate dependency on io_thread_get().
2017-01-25 22:54:41 +01:00
Max Kellermann
6b968beede output/alsa: convert to class, make attributes private 2017-01-24 23:08:16 +01:00
Max Kellermann
f68dd1bffb output/alsa: make AlsaSetup() an AlsaOutput method 2017-01-24 23:06:33 +01:00
Max Kellermann
f92b71ca99 output/alsa: move code from AlsaSetup() to AlsaSetupSw() 2017-01-24 23:05:29 +01:00
Max Kellermann
2b79fe2d6a output/alsa: move code from AlsaSetup() to AlsaSetupHw() 2017-01-24 22:48:48 +01:00
Max Kellermann
4ad0747c78 output/alsa: explicitly mention all snd_pcm_state() enums
I want a compiler warning when a new state needs to be considered
here.
2017-01-14 20:49:15 +01:00
Max Kellermann
df578c91ad output/alsa: log DoP mode 2017-01-11 22:50:40 +01:00
Max Kellermann
70008c47c9 output/alsa: support DSD_U16 2017-01-11 22:47:21 +01:00
Max Kellermann
8364029db8 output/alsa: move code to PlayRaw() 2017-01-11 21:38:05 +01:00
Max Kellermann
78a73eac53 pcm/Export: add (dummy) method Cancel()
We'll have some code for it soon.
2017-01-11 15:41:28 +01:00
Max Kellermann
9c4df66925 pcm/Export: halve the sample rate for DoP
Move this sample rate fixup from the ALSA output plugin to PcmExport,
where it belongs.
2017-01-11 10:33:23 +01:00
Max Kellermann
c143adba91 pcm/Export: add CalcOutputSampleRate(), CalcInputSampleRate()
Prepare for DSD sample rate fixups.
2017-01-10 23:48:26 +01:00
Max Kellermann
5900253b85 update copyright year 2017-01-03 20:48:59 +01:00
Max Kellermann
35a2a48c47 Merge branch 'v0.19.x' 2016-11-17 22:20:24 +01:00
Max Kellermann
5c3e55b5b1 {input,output}/alsa: fix gcc 7.0 -Wimplicit-fallthrough 2016-11-16 19:50:38 +01:00
Max Kellermann
d9cb85df83 output/Plugin: remove 'Error&' parameters, use C++ exceptions only 2016-11-09 12:36:21 +01:00
Max Kellermann
b35bb1b50c output/alsa: use C++ initializers 2016-11-04 11:31:23 +01:00
Max Kellermann
6341be9cdf output/alsa: migrate from class Error to C++ exceptions 2016-11-04 11:31:23 +01:00
Max Kellermann
93a14a93f9 output/alsa: use Error::FormatPrefix() 2016-11-04 11:31:23 +01:00
Max Kellermann
f6f2a3b366 output/alsa: throw C++ exception on init error 2016-10-28 22:56:27 +02:00
Max Kellermann
92f54f0b59 output/alsa: disable DoP if it fails
See http://bugs.musicpd.org/view.php?id=4496
2016-02-28 10:19:19 +01:00
Max Kellermann
ddce544b53 output/alsa: move the PcmExport::Open() call to Open() 2016-02-28 10:15:54 +01:00
Max Kellermann
21fb7eea82 output/alsa: probe DSD_U32 if DSD_U8 fails
See http://bugs.musicpd.org/view.php?id=4485
2016-02-28 09:59:09 +01:00
Max Kellermann
fd7eb43366 output/alsa: use CamelCase 2016-02-28 09:44:15 +01:00
Max Kellermann
a1add27c4c output/alsa: fix indent 2016-02-28 09:35:57 +01:00
Max Kellermann
fc8194ee1e output/alsa: fix typo 2016-02-28 09:35:55 +01:00
Max Kellermann
8ffcdb73e8 output/alsa: remove option "use_mmap"
MPD does not really take advantage of memory-mapped I/O by generating
data right into the ALSA buffer; using plain snd_pcm_mmap_writei() has
no advantage compared to snd_pcm_writei().  Let's kill this
non-feature.
2016-02-28 09:30:59 +01:00
Max Kellermann
111528e51c output/alsa: add #ifdef ENABLE_DSD
Fixes the --disable-dsd build.

See http://bugs.musicpd.org/view.php?id=4498
2016-02-28 07:29:37 +01:00
Max Kellermann
c9761bf6af output/alsa: pass PcmExport::Params to alsa_setup() 2016-02-27 07:35:35 +01:00
Max Kellermann
4a47265224 output/alsa: pass PcmExport::Params to SetupDop() 2016-02-27 07:34:58 +01:00
Max Kellermann
f0f3017a76 pcm/export: move Open() parameters to struct Params 2016-02-26 18:55:27 +01:00
Max Kellermann
6a53fb33da output/alsa: basic infrastructure for DSD_U16 and DSD_U32 2016-02-26 18:44:58 +01:00
Max Kellermann
1d67aa7bf2 update copyright year to 2016 2016-02-26 17:54:05 +01:00
Max Kellermann
15e432204e pcm/Order: new library to convert from FLAC to ALSA channel order
This new library is integrated in the PcmExport class and (if enabled)
converts MPD's channel order (= FLAC channel order) to ALSA channel
order.

This fixes:
 http://bugs.musicpd.org/view.php?id=3147
and
 http://bugs.musicpd.org/view.php?id=3255
2015-10-27 11:44:23 +01:00
Max Kellermann
4fa5538e2b config/Param: split block-specific attributes to new struct ConfigBlock
The old struct config_param remains only for top-level string options.
2015-01-21 23:56:33 +01:00
Max Kellermann
153f5854e2 output/alsa: move functions into the struct 2015-01-04 19:53:56 +01:00
Max Kellermann
712ed555e6 Copyright year 2015 2015-01-01 19:48:13 +01:00
Max Kellermann
8397196fbb output/alsa: change a few "dsd" to "dop" 2014-09-26 11:07:53 +02:00
Max Kellermann
e5a28bfd8d output/alsa, pcm: rename "DSD over USB" to "DoP"
The standard has been renamed since the early draft that was
implemented in MPD.
2014-08-31 16:12:26 +02:00
Max Kellermann
6e04d66a35 release v0.18.13
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJUAxsyAAoJECNuiljG20USmRAP/2J/+kV5TRfqr7acFKh/aqip
 RAefHTvHpYuAUDOi3WDVSZcmMnaYGKslZhbXhqchbRfR2oMwYhR+5gHIoxOp+EcL
 09UF1fJfUnjg6B2zz6tggIWR53Dwxckg4xEaKtI2Wi3Gz+9Q/CiNlpWLJc0ONA5e
 9gcz8pNK3oN0Em9c1KXahZKArzGdOGeytfSI3PLE+QnRiEyEDz1+StxIuyl72vr4
 ar2EMa9Vdvb7ouNK0g8WqaEOzYyNDXhklIqc+zALQJGThY1xj6OCfQ8JVagJhzwB
 UDuYfX1FylkN8LhF5pNzH1F0ANMozWcqeZlLLph6vuKkVBD7WUX4X1t82bwUlFDB
 ppdA5pPkiXsqYnuhHML4GqL7LlI2wsMxUHK7v+A9+9hfGN9HIoFyOSLBjB1pyI93
 yi8IPOq2a1BJQfQ2c69693ZS7WPxU6vOFKucKrk9PBlr2900SlvpMzIpZr1PMnGV
 hoU8eLHOIW86wi5Ea2ycFbFyI1ZoyrKJmzcVJjPjZUT05jDV6bA2Gi1IG6gIhX1q
 DiBfXUre+GISkLS4r8GcbG1FIXcv7fGjZ6Vols5di8lpYQ5oBu5aw2TEf8zukrHC
 LzPRa2l6Mhe2OI7a/mmTaEYDINgCL//46hOU5mIbmB0XZS8Jf+D1/HBzqKpeqO7f
 idENtbelqQdSsR5UU+R0
 =c2vC
 -----END PGP SIGNATURE-----

Merge tag 'v0.18.13'
2014-08-31 15:03:34 +02:00
Max Kellermann
a4f9d6d98b output/alsa: fix signed/unsigned comparison warning 2014-08-30 00:27:01 +02:00
Max Kellermann
2d096a569a output/alsa: fix coding style 2014-08-26 10:25:59 +02:00
Max Kellermann
e44ea5038e output/alsa: merge Init() into Configure() 2014-08-26 10:22:35 +02:00
Max Kellermann
9d79c72c17 output/alsa: add API documentation 2014-08-26 09:37:30 +02:00
Max Kellermann
a86aaef4d0 output/alsa: support native DSD playback
Translate SampleFormat::DSD to SND_PCM_FORMAT_DSD_U8, which was added
to alsa-lib 1.0.27.1.
2014-08-26 07:11:53 +02:00
Max Kellermann
e463244db3 output/alsa: move alsa_configure() into the class 2014-08-26 07:10:16 +02:00
Max Kellermann
294091ce60 output/alsa: remove obsolete macros 2014-08-26 05:53:15 +02:00
Max Kellermann
0e756e4377 PcmExport: use class ConstBuffer 2014-08-12 22:19:53 +02:00
Max Kellermann
503ed9c331 release v0.18.9
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJTEwdzAAoJECNuiljG20USkFYP/i1PaM7O20e2EPE7ELhffk1I
 PEL6WiuCxfEHP+JbH/RPy/CdyKIqx3TTeaktXzOJmCcU+5fAgbpIwfK689ZjpE7Y
 U+7aPfGudfjYTxM/bigEo+1XAIYWJCJ2IlopN0lRIZSquUm8rfxosqsNzJFrhwsK
 40Ps36XdpYUA3z9dugyJjeKQETkjJa5Y55C1yml5RRUz+yPqyiPelm0dSlx3Ggce
 KpmNZfp8g8/stwb08iw+qk+cNKP75eJwPdFmQrsc91QxP1oW7ERWhiICA0ZtqaNe
 T0Ld5+wZ6uTJSztQiUsWrJYS1yKix5q1Za8tyFr3a9NPI+iIjsALXqU9k7zmZ6Id
 GK0Xr9Noo1o80QeGkd60nJyCQXbEU/V0p9D/QiDVei+IvK6mbxF3y2gPA7wobgrC
 KEDgsJZ+0fjmgdx+eb8ydg0uIwHrk04u0YKukUqA3bkNS/PUEICPqblcg8Spf89I
 RMdjq2HFcpkaIwGvryfHIbTNUbonAziMzmiJ0WQA1FCD3x1WELvBf09GzAsUEoFX
 Be0Co15rODOByo5ryZvSJv5BCr2RuCPwzNF+V26nMaKK7EloQWmbO0rpkRLVRk81
 qo1JmElm6SyeE3kHqVW/NyrPxLtd7VngV+z9hXr95szUjCjMv/MK169r4jumLTex
 RLyPDkhkQLDIijamhjfZ
 =nX0n
 -----END PGP SIGNATURE-----

Merge tag 'release-0.18.9'
2014-03-02 11:46:07 +01:00
Max Kellermann
4657a3bd0f output: move functions into the AudioOutput struct 2014-01-29 08:10:46 +01:00
Max Kellermann
bf803e241f AudioOutput: pass plugin to constructor
Make it "const".
2014-01-29 08:10:18 +01:00
Max Kellermann
c4403c523f AudioOutput: add constructor and destructor 2014-01-28 12:37:58 +01:00
Max Kellermann
815d72065c output: rename struct audio_output to AudioOutput 2014-01-28 11:34:09 +01:00
Max Kellermann
e0dc721324 OutputPlugin: rename struct audio_output_plugin to AudioOutputPlugin 2014-01-28 11:33:15 +01:00
Max Kellermann
68eda78704 Mixer*: move to mixer/ 2014-01-24 16:44:32 +01:00
Max Kellermann
ea5b901bcc output/*: move to output/plugins/ 2014-01-23 23:49:50 +01:00