Changed the signature of the pan/width/position snippets
This commit is contained in:
parent
ef5a2fa546
commit
d74777280a
2 changed files with 25 additions and 17 deletions
|
|
@ -751,21 +751,21 @@ namespace _internals {
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
inline void snippetPan(const T*& pan, T*& left, T*& right)
|
inline void snippetPan(T pan, T& left, T& right)
|
||||||
{
|
{
|
||||||
T p = ((*pan++) + T{1.0}) * T{0.5};
|
pan = (pan + T{1.0}) * T{0.5};
|
||||||
p = clamp<T>(p, 0, 1);
|
pan = clamp<T>(pan, 0, 1);
|
||||||
*left++ *= panLookup(p);
|
left *= panLookup(pan);
|
||||||
*right++ *= panLookup(1 - p);
|
right *= panLookup(1 - pan);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
inline void snippetWidth(const T*& width, T*& mid, T*& side)
|
inline void snippetWidth(const T& width, T& mid, T& side)
|
||||||
{
|
{
|
||||||
T w = std::abs(*width) * T{0.5};
|
T w = std::abs(width) * T{0.5};
|
||||||
w = clamp<T>(w, 0, 1);
|
w = clamp<T>(w, 0, 1);
|
||||||
*mid++ *= panLookup(w);
|
mid *= panLookup(w);
|
||||||
*side++ *= *width++ > 0 ? panLookup(1 - w) : -panLookup(1 - w);
|
side *= width > 0 ? panLookup(1 - w) : -panLookup(1 - w);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -789,8 +789,10 @@ void pan(absl::Span<const T> panEnvelope, absl::Span<T> leftBuffer, absl::Span<T
|
||||||
auto* left = leftBuffer.begin();
|
auto* left = leftBuffer.begin();
|
||||||
auto* right = rightBuffer.begin();
|
auto* right = rightBuffer.begin();
|
||||||
auto* sentinel = pan + min(panEnvelope.size(), leftBuffer.size(), rightBuffer.size());
|
auto* sentinel = pan + min(panEnvelope.size(), leftBuffer.size(), rightBuffer.size());
|
||||||
while (pan < sentinel)
|
while (pan < sentinel) {
|
||||||
_internals::snippetPan(pan, left, right);
|
_internals::snippetPan(*pan, *left, *right);
|
||||||
|
incrementAll(pan, left, right);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
|
|
@ -805,8 +807,10 @@ void width(absl::Span<const T> widthEnvelope, absl::Span<T> midBuffer, absl::Spa
|
||||||
auto* mid = midBuffer.begin();
|
auto* mid = midBuffer.begin();
|
||||||
auto* side = sideBuffer.begin();
|
auto* side = sideBuffer.begin();
|
||||||
auto* sentinel = width + min(widthEnvelope.size(), midBuffer.size(), sideBuffer.size());
|
auto* sentinel = width + min(widthEnvelope.size(), midBuffer.size(), sideBuffer.size());
|
||||||
while (width < sentinel)
|
while (width < sentinel) {
|
||||||
_internals::snippetWidth(width, mid, side);
|
_internals::snippetWidth(*width, *mid, *side);
|
||||||
|
incrementAll(width, mid, side);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -594,8 +594,10 @@ void sfz::pan<float, true>(absl::Span<const float> panEnvelope, absl::Span<float
|
||||||
auto* sentinel = pan + min(panEnvelope.size(), leftBuffer.size(), rightBuffer.size());
|
auto* sentinel = pan + min(panEnvelope.size(), leftBuffer.size(), rightBuffer.size());
|
||||||
const auto* lastAligned = prevAligned(sentinel);
|
const auto* lastAligned = prevAligned(sentinel);
|
||||||
|
|
||||||
while (unaligned(pan, left, right) && pan < lastAligned)
|
while (unaligned(pan, left, right) && pan < lastAligned) {
|
||||||
_internals::snippetPan(pan, left, right);
|
_internals::snippetPan(*pan, *left, *right);
|
||||||
|
incrementAll(pan, left, right);
|
||||||
|
}
|
||||||
|
|
||||||
const auto mmOne = _mm_set_ps1(1.0f);
|
const auto mmOne = _mm_set_ps1(1.0f);
|
||||||
const auto mmPiFour = _mm_set_ps1(piFour<float>);
|
const auto mmPiFour = _mm_set_ps1(piFour<float>);
|
||||||
|
|
@ -613,8 +615,10 @@ void sfz::pan<float, true>(absl::Span<const float> panEnvelope, absl::Span<float
|
||||||
incrementAll<TypeAlignment>(pan, left, right);
|
incrementAll<TypeAlignment>(pan, left, right);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (pan < sentinel)
|
while (pan < sentinel){
|
||||||
_internals::snippetPan(pan, left, right);
|
_internals::snippetPan(*pan, *left, *right);
|
||||||
|
incrementAll(pan, left, right);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue