aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/voice.cpp20
1 files changed, 7 insertions, 13 deletions
diff --git a/core/voice.cpp b/core/voice.cpp
index be72b691..c8810c36 100644
--- a/core/voice.cpp
+++ b/core/voice.cpp
@@ -483,7 +483,7 @@ void Voice::mix(const State vstate, ContextBase *Context, const nanoseconds devi
return;
}
- uint Counter{mFlags.test(VoiceIsFading) ? SamplesToDo : 0};
+ uint Counter{mFlags.test(VoiceIsFading) ? minu(SamplesToDo, 64u) : 0u};
uint OutPos{0u};
/* Check if we're doing a delayed start, and we start in this update. */
@@ -497,21 +497,17 @@ void Voice::mix(const State vstate, ContextBase *Context, const nanoseconds devi
/* Get the number of samples ahead of the current time that output
* should start at. Skip this update if it's beyond the output sample
* count.
+ *
+ * Round the start position to a multiple of 4, which some mixers want.
+ * This makes the start time accurate to 4 samples. This could be made
+ * sample-accurate by forcing non-SIMD functions on the first run.
*/
seconds::rep sampleOffset{duration_cast<seconds>(diff * Device->Frequency).count()};
+ sampleOffset = (sampleOffset+2) & ~seconds::rep{3};
if(sampleOffset >= SamplesToDo)
return;
- /* Round the start position down to a multiple of 4, which some mixers
- * want. This makes the start time accurate to 4 samples. This could be
- * made sample-accurate by forcing non-SIMD functions on the first run.
- *
- * Also ensure any fading completes within this update (though don't go
- * less than 64 samples, or the fade could be too fast).
- */
- OutPos = static_cast<uint>(sampleOffset) & ~3u;
- if(Counter > 0)
- Counter = maxu(Counter-OutPos, 64);
+ OutPos = static_cast<uint>(sampleOffset);
}
if(!Counter)
@@ -536,8 +532,6 @@ void Voice::mix(const State vstate, ContextBase *Context, const nanoseconds devi
}
}
}
- else if(!BufferListItem) [[unlikely]]
- Counter = std::min(Counter, 64u);
std::array<float*,DeviceBase::MixerChannelsMax> SamplePointers;
const al::span<float*> MixingSamples{SamplePointers.data(), mChans.size()};