diff options
-rw-r--r-- | NEWS | 6 | ||||
-rw-r--r-- | src/command/CommandListBuilder.cxx | 1 | ||||
-rw-r--r-- | src/notify.hxx | 2 | ||||
-rw-r--r-- | src/output/OutputThread.cxx | 11 | ||||
-rw-r--r-- | src/thread/PosixCond.hxx | 17 | ||||
-rw-r--r-- | src/thread/PosixMutex.hxx | 17 | ||||
-rw-r--r-- | test/test_protocol.cxx | 2 |
7 files changed, 48 insertions, 8 deletions
@@ -71,6 +71,12 @@ ver 0.19 (not yet released) * install systemd unit for socket activation * Android port +ver 0.18.15 (not yet released) +* command + - list: reset used size after the list has been processed +* fix MixRamp +* work around build failure on NetBSD + ver 0.18.14 (2014/09/11) * protocol - fix range parser bug on certain 32 bit architectures diff --git a/src/command/CommandListBuilder.cxx b/src/command/CommandListBuilder.cxx index 1dcbf2946..477c246ff 100644 --- a/src/command/CommandListBuilder.cxx +++ b/src/command/CommandListBuilder.cxx @@ -27,6 +27,7 @@ void CommandListBuilder::Reset() { list.clear(); + size = 0; mode = Mode::DISABLED; } diff --git a/src/notify.hxx b/src/notify.hxx index ebd12e5c6..3e62a0103 100644 --- a/src/notify.hxx +++ b/src/notify.hxx @@ -28,7 +28,7 @@ struct notify { Cond cond; bool pending; -#if !defined(WIN32) && !defined(__BIONIC__) +#if !defined(WIN32) && !defined(__NetBSD__) && !defined(__BIONIC__) constexpr #endif notify():pending(false) {} diff --git a/src/output/OutputThread.cxx b/src/output/OutputThread.cxx index 98e43cffd..e46425097 100644 --- a/src/output/OutputThread.cxx +++ b/src/output/OutputThread.cxx @@ -371,11 +371,20 @@ ao_filter_chunk(AudioOutput *ao, const MusicChunk *chunk) if (data.size > other_data.size) data.size = other_data.size; + float mix_ratio = chunk->mix_ratio; + if (mix_ratio >= 0) + /* reverse the mix ratio (because the + arguments to pcm_mix() are reversed), but + only if the mix ratio is non-negative; a + negative mix ratio is a MixRamp special + case */ + mix_ratio = 1.0 - mix_ratio; + void *dest = ao->cross_fade_buffer.Get(other_data.size); memcpy(dest, other_data.data, other_data.size); if (!pcm_mix(ao->cross_fade_dither, dest, data.data, data.size, ao->in_audio_format.format, - 1.0 - chunk->mix_ratio)) { + mix_ratio)) { FormatError(output_domain, "Cannot cross-fade format %s", sample_format_to_string(ao->in_audio_format.format)); diff --git a/src/thread/PosixCond.hxx b/src/thread/PosixCond.hxx index e0d6623dd..b3fe204e1 100644 --- a/src/thread/PosixCond.hxx +++ b/src/thread/PosixCond.hxx @@ -41,10 +41,21 @@ class PosixCond { pthread_cond_t cond; public: -#ifndef __BIONIC__ - constexpr +#if defined(__NetBSD__) || defined(__BIONIC__) + /* NetBSD's PTHREAD_COND_INITIALIZER is not compatible with + "constexpr" */ + PosixCond() { + pthread_cond_init(&cond, nullptr); + } + + ~PosixCond() { + pthread_cond_destroy(&cond); + } +#else + /* optimized constexpr constructor for sane POSIX + implementations */ + constexpr PosixCond():cond(PTHREAD_COND_INITIALIZER) {} #endif - PosixCond():cond(PTHREAD_COND_INITIALIZER) {} PosixCond(const PosixCond &other) = delete; PosixCond &operator=(const PosixCond &other) = delete; diff --git a/src/thread/PosixMutex.hxx b/src/thread/PosixMutex.hxx index 9d1674dd4..5805158d5 100644 --- a/src/thread/PosixMutex.hxx +++ b/src/thread/PosixMutex.hxx @@ -41,10 +41,21 @@ class PosixMutex { pthread_mutex_t mutex; public: -#ifndef __BIONIC__ - constexpr +#if defined(__NetBSD__) || defined(__BIONIC__) + /* NetBSD's PTHREAD_MUTEX_INITIALIZER is not compatible with + "constexpr" */ + PosixMutex() { + pthread_mutex_init(&mutex, nullptr); + } + + ~PosixMutex() { + pthread_mutex_destroy(&mutex); + } +#else + /* optimized constexpr constructor for sane POSIX + implementations */ + constexpr PosixMutex():mutex(PTHREAD_MUTEX_INITIALIZER) {} #endif - PosixMutex():mutex(PTHREAD_MUTEX_INITIALIZER) {} PosixMutex(const PosixMutex &other) = delete; PosixMutex &operator=(const PosixMutex &other) = delete; diff --git a/test/test_protocol.cxx b/test/test_protocol.cxx index d7ea7cd87..e80e4fe6d 100644 --- a/test/test_protocol.cxx +++ b/test/test_protocol.cxx @@ -8,6 +8,8 @@ #include <cppunit/ui/text/TestRunner.h> #include <cppunit/extensions/HelperMacros.h> +#include <unistd.h> + static enum ack last_error = ack(-1); void |