Commit Graph

1325 Commits

Author SHA1 Message Date
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
eb771eaf0d output/Thread: re-lock the mutex after flush error
Fixes deadlock due to mutex double lock.
2018-01-29 22:30:56 +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
Max Kellermann
8649ea3d6f thread/Thread: use BoundMethod 2018-01-07 17:20:26 +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
79b0f97a3f output/Interface: clarify Play() API documentation 2018-01-05 08:35:40 +01:00
Max Kellermann
e3ef3e8d71 output/Control: unlock mutex during expensive operations 2018-01-04 10:36:18 +01:00
Max Kellermann
7574dfd339 output/Control: move code from FinishDestroy() to destructor 2018-01-04 10:34:27 +01:00
Max Kellermann
a5b93008f5 output/Filtered: remove redundant nullptr assignments from Setup() 2018-01-04 10:32:10 +01:00
Max Kellermann
0227af5bb7 output/Filtered: remove BeginDestroy()
All it does is "sometimes" close the mixer, but that is also done in
the destructor.
2018-01-04 10:29:27 +01:00
Max Kellermann
ef71df60f6 output/Multiple: use std::unique_ptr<FilteredAudioOutput> 2018-01-04 10:14:26 +01:00
Max Kellermann
f52b3b4e04 output/Multiple: dispose the AudioOutputControl instances
Fixes shutdown memory leak.
2018-01-04 10:11:23 +01:00
Max Kellermann
7e4e32cfe0 output/Filtered: eliminate FinishDestroy()
This is implicitly done by the destructor.
2018-01-04 10:05:31 +01:00
Max Kellermann
9f8649884b output/Control: dispose the FilteredAudioOutput
Fixes shutdown memory leak.
2018-01-04 10:01:34 +01:00
Max Kellermann
f1ee4caddd output/Init: fix configuration option name in error message 2018-01-04 09:57:28 +01:00
Max Kellermann
051b8fbb31 output/Thread: add "noexcept" 2018-01-04 09:54:35 +01:00
Max Kellermann
b0ea32f660 output/Control: remove unused method StopThread() 2018-01-04 09:20:22 +01:00
Max Kellermann
8322ae5a4c output/Control: use class ScopeUnlock() 2018-01-04 08:41:19 +01:00
Max Kellermann
98a7c62d7a player/Thread: don't send silence if decoder is slow
The output plugin shall decide whether to insert silence or do nothing
at all.  The ALSA output plugin has already implemented this.
Inserting silence is not necessary or helpful for some plugins, and
may even hurt them (e.g. "recorder").
2018-01-03 17:36:41 +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
6d0d8cf9cf filter/Filter: add virtual method Flush()
This will be used by filters which have internal buffers which need to
be flushed at the end, e.g. the "soxr" resampler.
2018-01-02 23:15:51 +01:00
Max Kellermann
5ede02aed8 filter/FilterConfig: rename to LoadChain.cxx 2018-01-02 23:09:36 +01:00
Max Kellermann
b0199245d5 output/Thread: move code to method InternalDrain() 2018-01-02 18:03:48 +01:00
Max Kellermann
b93e3b2cf6 output/Thread: move code to method InternalCloseError() 2018-01-02 18:02:14 +01:00
Max Kellermann
ae7fcf4c6b output/Thread: move common code to method Failure() 2018-01-02 18:00:20 +01:00
Max Kellermann
1607754771 output/Thread: update "last_error" after filter/play errors 2018-01-02 17:59:37 +01:00
Max Kellermann
028f659c40 output/Thread: move error handling code into the catch block 2018-01-02 17:48:14 +01:00
Max Kellermann
8dfdacf128 output/Thread: AudioOutput::Play() must not return zero 2018-01-02 17:47:46 +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
Max Kellermann
d2358b42b6 output/Source: drop the "_instance" suffix from variable names 2018-01-02 09:59:22 +01:00
Max Kellermann
551ac56a33 Filter/Internal: split header 2018-01-01 18:48:34 +01:00
loujine
42959982a9 Add basic support for MUSICBRAINZ_WORKID tag 2017-12-30 19:05:21 +00:00
Max Kellermann
c40354bbcb player/Outputs: abstract interface wrapping class MultipleOutputs 2017-12-29 16:39:05 +01:00
Max Kellermann
c04aafb4e3 output/Multiple: add "noexcept" 2017-12-29 16:29:49 +01:00
Max Kellermann
edef62df86 filter/Internal: return std::unique_ptr<Filter> 2017-12-27 11:56:05 +01:00
Max Kellermann
e2621d5e44 filter/Plugin: return std::unique_ptr<PreparedFilter> 2017-12-27 11:39:01 +01:00
Max Kellermann
03cf6591c0 output/Source: convert prepared_filter to reference 2017-12-27 11:21:43 +01:00
Max Kellermann
25fa3ccade MusicChunk, player/Thread: use std::unique_ptr<Tag> 2017-12-20 15:02:14 +01: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
86a06a7acc output/Interface: add "attributes" map
These attributes are printed in the "outputs" response, and the new
command "outputset" allows setting new values.

No attributes are currently implemented.
2017-12-19 11:57:52 +01:00
Max Kellermann
39dc83bd82 output/Print: print the plugin name 2017-12-19 11:52:10 +01:00
Max Kellermann
503063cddc output/Print: use %u for the index 2017-12-19 11:52:09 +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
edee8a3446 Compiler.h: add gcc_returns_nonnull, gcc_returns_twice 2017-12-18 23:00:13 +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
Max Kellermann
fbc4bb29dc Merge branch 'v0.20.x' 2017-12-03 16:22:08 +01:00
Max Kellermann
de90d401d2 MusicChunk: add magic value IGNORE_REPLAY_GAIN
This fixes spurious replay gain logs when the player inserts silence
chunks, because those silence chunks had no replay gain attached,
resetting the ReplayGainFilter state, flipping it forth and back.
2017-12-03 11:39:12 +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
Max Kellermann
83f8eeec44 output/httpd: migrate from DeferredMonitor to DeferEvent 2017-11-10 21:18:00 +01:00
Max Kellermann
b83fbad6a1 output/httpd: use C++11 initializers 2017-11-10 21:15:57 +01:00
Max Kellermann
0ff4350352 event/ServerSocket: pass UniqueSocketDescriptor by value
Passing it by value is actually smaller (32 bit) than the rvalue
reference (64 bit pointer), and it ensures that the object is consumed
after the call returns, no matter how the methods are implemented.
2017-11-10 20:43:14 +01:00
Max Kellermann
5fd2b7cc79 event/SocketMonitor: eliminate Read(), Write()
Migrate callers to GetSocket().Read(), GetSocket.Write(), which is the
same.
2017-11-10 20:37:52 +01:00
Max Kellermann
59a8836924 event/SocketMonitor: add "noexcept" 2017-11-10 20:20:07 +01:00
Max Kellermann
49784513b1 util/{Const,Writable}Buffer, ...: rename IsEmpty() to empty(), imitating STL 2017-11-10 19:24:33 +01:00
Max Kellermann
523051132d Merge branch 'v0.20.x' 2017-11-05 17:48:41 +01:00
cathugger
b111a8fe8d output/Thread: ensure pending tags are flushed in all cases
Fixes hanging playback with soxr resampler.

Closes #139, #141
2017-11-05 17:42:32 +01:00
Max Kellermann
55e6629fb4 output/Control: catch and log StartThread() exceptions 2017-10-30 08:39:44 +01:00
Max Kellermann
e2a74051dc lib/alsa/HwSetup: return effective parameters 2017-10-26 12:13:00 +02:00
Max Kellermann
b7e035b6f3 output/alsa: move AlsaSetupHw() to lib/alsa/HwSetup.cxx 2017-10-26 11:15:01 +02:00
Max Kellermann
890f1f5928 lib/alsa/Format: move HAVE_ALSA_DSD* definitions from the Alsa output plugin 2017-10-26 09:39:18 +02:00
Max Kellermann
b30c37eb79 output/alsa: move functions to lib/alsa/Format.hxx 2017-10-26 09:30:45 +02:00
Max Kellermann
b08cb148ae output/alsa: move class PeriodBuffer to lib/alsa/PeriodBuffer.hxx 2017-10-26 09:27:36 +02:00
Max Kellermann
6657801fb1 output/alsa: pass SampleFormat& to AlsaSetupFormat() 2017-10-26 08:46:28 +02:00
Max Kellermann
a199366157 output/alsa: remove period_time adjust loop
This loop was introduced in commit
24c1f46353, but -EPIPE is not a possible
error condition for snd_pcm_hw_params().  This code does not appear to
make sense.  Problems with a wrong period_time should be caught before
that by snd_pcm_hw_params_set_period_time_near().

This commit removes the last "goto" in MPD!  Yay!
2017-10-26 08:40:59 +02:00
Max Kellermann
ddabe1a6df output/alsa: add "noexcept" 2017-10-26 08:18:05 +02:00
Max Kellermann
e7b47ce335 output/alsa: in_frame_size is a debug-only variable 2017-10-26 08:17:21 +02:00
Max Kellermann
5ce93d6fa8 output/sndio: refuse to build with libroarsndio
RoarAudio's sndio emulation has been a source for annoyances.  First,
their headers turned out to be broken with C++, due to their use of
the "new" keyword.  Then they used a preprocessor macro to rename
"sio_hdl" to something else, effectively disallowing the use of
forward declarations.  Enough is enough, and I'm removing support for
it.

RoarAudio users should better use the RoarAudio output plugin.
2017-09-19 19:38:43 +02:00
Max Kellermann
735eabb066 output/sndio: move #include below guard 2017-09-19 18:59:04 +02:00
Max Kellermann
412ff762bb output/sndio: use forward declarations 2017-09-19 18:58:13 +02:00
Max Kellermann
44bbf42a9f Merge branch 'v0.20.x' 2017-09-19 18:58:02 +02:00
Max Kellermann
75c740fe2b output/sndio: fix indent 2017-09-19 18:50:35 +02:00