Commit Graph

432 Commits

Author SHA1 Message Date
Max Kellermann
98d76627a5 output/alsa: disable events in Cancel()
Don't reactivate the PCM device immediately after Cancel() is
finished; if Cancel() gets called this may mean that new data may take
a while to produce, or no data at all will be produced because the
current song is being stopped.

Once new data is available, Play() will automatically reactivate the
PCM.

This fixes underruns when switching songs manually (closes #264).
2018-04-26 16:41:49 +02:00
Max Kellermann
8a809013f3 output/alsa: reset "active" on error
Use the "active" flag in PrepareSockets() instead of LockHasError().
2018-04-26 16:18:59 +02:00
Max Kellermann
485ed0b156 output/alsa: make the "active" attribute thread-safe 2018-04-26 16:18:52 +02:00
Max Kellermann
7d546f80f9 output/alsa: merge Activate() and UnlockActivate()
Prepare to make the "active" attribute thread-safe.
2018-04-26 16:18:18 +02:00
Max Kellermann
5dfdc15f93 output/alsa: rethrow errors in Drain() 2018-04-26 16:17:14 +02:00
Max Kellermann
a6e5873443 output/alsa: thread-safety documentation for attribute "active" 2018-04-26 15:54:15 +02:00
Max Kellermann
e2cf777538 output/alsa: simplify MultiSocketMonitor::GetEventLoop() calls 2018-04-26 15:54:01 +02:00
Max Kellermann
9c61760713 output/alsa: remove obsolete comment, was moved to Alsa::PeriodBuffer::Allocate() 2018-04-10 15:42:29 +02:00
Christian Kröner
d84cd500bb Fix build with DSD disabled 2018-03-07 22:40:19 +01:00
Christian Kröner
5b456cadc4 Reset sample rate to initial state on OSX output 2018-03-07 22:38:09 +01:00
Christian Kröner
4be80982a4 Fix sample rate sync on Mac output for low rates 2018-03-07 21:32:21 +01:00
Christian Kröner
4d7f1f0c35 Implement Pause() for OSXOutput plugin 2018-03-07 11:59:43 +01:00
Christian Kröner
d3f097c7f1 Honor 'device "system"' setting for OSX output 2018-03-07 11:59:43 +01:00
Christian Kröner
e89c421313 Initial support for DSD over PCM on macOS
From: Christian Kröner <ckroener@gmx.net>

This just copies the necessary bits and pieces from the ALSA plugin and applies them to OSXOutput based on dop config setting. It only changes the OSXOutput plugin as needed for DoP (further changes to support additionally e.g. integer mode or setting the physical device mode require rather a complete rewrite of the output plugin).

Fortunately the Core Audio API is by default bit perfect and supports DoP with minimal changes (setting the sampling rate accordingly after ensuring that the physical mode supports at least 24 bits per channel seems to be enough). This was tested on an Amanero Combo384 device hooked up to a ES9018 DAC.

USAGE (try only on DACs that support DoP):
- Add dop "yes" option to mpdconf
- Be sure to set at least 24bits per channel before playing some DSD file (using Audio-MIDI-Setup)
- Based on the dop setting, MPD will change the sample rate as required and output DoP signal to the DAC
- Hog mode is recommended to ensure that no other program will try to mix some output with the DoP stream (resulting in bad noise)
- Alternatively set the default output device to another device (e.g. the built-in output) to avoid having other audio interfere with DSD playback
2018-02-26 14:55:03 +01:00
Max Kellermann
250b6a3d52 release v0.20.16
-----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCgAuFiEEA5IzWngIOJSkMBxDI26KWMbbRRIFAlp2BjEQHG1heEBtdXNp
 Y3BkLm9yZwAKCRAjbopYxttFEl0HEACEOGoX3a8slWwuPsqdOu+thc73SIMVzqF9
 xzxFbGLyp0MzXTAgU+SLzfbD4/gerglC7TRbGzsvVu7iwxXeKhEL/SJ5RhrCQM3E
 U8jaOeavMWeqX60pdbTz2zw4maKAD7U3fWcYxoh09EBaZa7Mm/j7URPLqrlWT7VD
 iWqdLcC4HZarOxBbq0CY7rQPVsAVZZ5l43MDV6hiInSn0wWo783G6BtYFgvgH8qk
 pZIL0yScQrjyj9D0fgfDC9DBVfHqMqpWW5G2rNhsXTUtpdb9V5tB2B8ZbIUWJfD7
 aVFztCwwmbiBle4UBHfyyDLfZkBZmU/qKc9+I3WUxT4DLbA8gDXZFjb7zU80NMge
 xzbXeO7XvxvSm7groqRh3Vy0nbkBMB9wTwzre3ULhYyhY2vVISb9lSyRtUE9xuR8
 SL2zpdgVcFdTUSKat63ikeU4sbYvssra3ZDRnAyoFF2iVpT2J2B95ZVNfaIYbRSQ
 lidlz8q3Px5GUDe3D0ao3hFk5t1Hg2jXx3nbz/Kk+SwZpsaiCewl6zjptye7R7zD
 e9OMxYrU+/opsynRE5NFuTvkRKUG1kC47/rWgGZWI9Cbv8+lse1NO0c7VzM7o1hH
 Bfk5AhEkv8tLNM+39evXdNQVB0cna5ndSDOkYBcPI78/PUNd+TnrPdfI/W3NCnRl
 I+CWQE3uSQ==
 =+tJ2
 -----END PGP SIGNATURE-----

Merge tag 'v0.20.16'

release v0.20.16
2018-02-03 19:59:29 +01:00
Max Kellermann
ec408ca6a6 output/pulse: fix crash during auto-detection
The PulseOutput needs to be "enabled" before WaitConnection() may be
called.

Closes #207
2018-01-30 10:06:36 +01:00
Max Kellermann
97f670658f util/StringFormat: new utility library 2018-01-24 13:28:28 +01:00
Max Kellermann
bbc5212436 fs/AllocatedPath: make the nullptr_t constructor public 2018-01-17 12:17:41 +01:00
François Revol
5b18b66282 Haiku: fix build
Convert the fill_buffer to a class method, to allow accessing the private method.

Also remove the leftover Wrapper stuff.
2018-01-05 23:10:58 +01:00
Max Kellermann
4a120f8090 Merge branch 'v0.20.x' 2018-01-05 10:10:17 +01:00
Max Kellermann
c2cbb7b8ce output/haiku: remove unimplemented Cancel() method 2018-01-05 10:05:14 +01:00
Max Kellermann
1954e94de2 Merge branch 'work_tag' of git://github.com/loujine/MPD
Closes #181
2018-01-03 11:47:02 +01:00
Max Kellermann
f4a56f839f output/haiku: remove size==0 check from Play()
By API contract, this parameter must not be zero.
2018-01-02 17:45:14 +01:00
Max Kellermann
67a8eedca0 output/ao: round write_size down to a multiple of the frame size 2018-01-02 17:33:33 +01:00
Max Kellermann
be65c7d5d0 config/Block: add method GetPositiveValue()
Adds missing checks to several plugins.
2018-01-02 17:24:34 +01:00
Max Kellermann
46406d6cca output/ao: use class SafeSingleton for libao initialization 2018-01-02 12:13:51 +01:00
loujine
42959982a9 Add basic support for MUSICBRAINZ_WORKID tag 2017-12-30 19:05:21 +00:00
Max Kellermann
a17a481e30 event/BufferedSocket: add "noexcept" 2017-12-20 10:42:17 +01:00
Max Kellermann
8ac73a9eba output/alsa: add attributes "dop" and "allowed_formats" 2017-12-19 11:57:52 +01:00
Max Kellermann
914df18bf9 Main, ...: catch any exception, not just std::runtime_error 2017-12-19 10:56:23 +01:00
Max Kellermann
37c27fa606 output/Interface: convert need_fully_defined_audio_format to flag 2017-12-19 08:41:34 +01:00
Max Kellermann
6246d36fe6 Merge branch 'v0.20.x' 2017-12-16 20:56:06 +01:00
Yue Wang
f1ef9f9d31 OSXOutputPlugin: set the buffer time to be 100ms
[mk: the following text was copied from
https://github.com/MusicPlayerDaemon/MPD/pull/167]

For certain format (hi-res files) and normal buffer size hardware, The
hardware may at once consume most of the buffers. However, in Delay()
function, MPD is supposed to wait for 25 ms after the next try. it
will create a hiccup. The negative impact is much major than
increasing the latency.

I understand larger buffers come at a price. That's why in my earlier
commit last year I significantly reduced it. However, the buffer size
in CoreAudio is set according to the hardware, which is super small
latency. For instance, the system audio of 2015 generation of macbook
pro has maximum buffer size of 4096 samples, which is just 0.09s for
44.1k framerate, or 0.04s for 96k frames --- . compare to the 0.5 sec
latency alsa plugin has, even if we quadruple it, it's still super
tiny.
2017-12-12 10:56:42 +01:00
Yue Wang
7ba7ce3af7 Correctly set the mixer plugin for osx output 2017-12-02 23:29:23 -08:00
Max Kellermann
7d579e7400 lib/alsa/NonBlock: throw exception on error
Avoid another potential deadlock: if no file descriptors are
registered, our non-blocking ALSA code cannot ever work.
2017-11-14 21:08:07 +01:00
Max Kellermann
e0f777d4eb output/alsa: move code to LockCaughtError() 2017-11-14 21:07:59 +01:00
Max Kellermann
febd1ad09c output/alsa: fix deadlock bug
After UnlockActivate() returns, we not only need to check for errors,
but also for more room in the ring buffer.  If we don't check the ring
buffer, it may be drained already, and the cond.wait() call will never
finish.

Closes #151
2017-11-14 21:02:53 +01:00
Max Kellermann
e2c81aa9ea Merge branch 'v0.20.x' 2017-11-14 12:31:13 +01:00
Max Kellermann
014f8cd693 output/httpd: flush encoder after tag
Without the flush, ReadPage() may not return any data, or not all
data.  This may result in incomplete ddata the new "header" page,
corrupting streams with some encoders such as Vorbis.

Fixes #145
2017-11-14 12:00:14 +01:00
Max Kellermann
c582a9faae event/MultiSocketMonitor: add "noexcept" 2017-11-12 17:42:50 +01:00
Max Kellermann
390e830994 {mixer,output}/alsa: migrate from DeferredMonitor to DeferEvent 2017-11-12 17:27:58 +01:00
Max Kellermann
44c60567dd output/alsa: add "allowed_formats" setting
Allows defining a list of supported audio formats, and allows
switching on and off DoP with certain formats.

This is a first rough draft.  The setting syntax and its semantics may
still be redesigned.
2017-11-10 23:05:50 +01:00
Max Kellermann
20199e770c output/shout: use the shout_metadata_t only once
There is no documentation on whether calling shout_metadata_add()
multiple times on one instance is allowed.  To be sure, let's allocate
the object on demand each time in SendTag().
2017-11-10 22:30:53 +01:00
Max Kellermann
4c824e5309 output/shout: simplify shout_tag_to_metadata() 2017-11-10 22:26:25 +01:00
Max Kellermann
981bc85879 output/shout: relax quality and bitrate checks, forward as-is 2017-11-10 22:19:00 +01:00
Max Kellermann
015527d870 output/shout: make "quality" and "bitrate" local variables 2017-11-10 22:17:51 +01:00
Max Kellermann
6464b4b372 encoder/Configured: glue code to initialize PreparedEncoder 2017-11-10 21:54:57 +01:00
Max Kellermann
fef9747fbf output/shout: use MIME type instead of the encoder plugin name
This is more robust, for example it allows using the Shine encoder
plugin instead of LAME.
2017-11-10 21:52:54 +01:00
Max Kellermann
13816c1c7d output/{recorder,httpd,shout}: use std::unique_ptr to manage PreparedEncoder pointer 2017-11-10 21:35:22 +01:00
Max Kellermann
c54a920d13 output/httpd: make enum strictly-typed 2017-11-10 21:25:03 +01:00