Skip to content

Commit 8dd6bf8

Browse files
tstennercboulay
authored andcommitted
Fix a bug introduced in ffe3b09 preventing older builds from connecting to outlets ("received test-pattern samples do not match the specification")
1 parent 422fb90 commit 8dd6bf8

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/sample.cpp

+4-3
Original file line numberDiff line numberDiff line change
@@ -288,10 +288,11 @@ void sample::load(eos::portable_iarchive &ar, const uint32_t archive_version) {
288288
}
289289

290290
template <typename T> void test_pattern(T *data, uint32_t num_channels, int offset) {
291-
const int mod = std::is_integral<T>::value ? (int)std::numeric_limits<T>::max() : 1;
292291
for (std::size_t k = 0; k < num_channels; k++) {
293-
data[k] = static_cast<T>((k + static_cast<std::size_t>(offset)) % mod);
294-
if (k % 2 == 1) data[k] = -data[k];
292+
std::size_t val = k + static_cast<std::size_t>(offset);
293+
if(std::is_integral<T>::value)
294+
val %= static_cast<std::size_t>(std::numeric_limits<T>::max());
295+
data[k] = ( k % 2 == 0) ? static_cast<T>(val) : -static_cast<T>(val);
295296
}
296297
}
297298

0 commit comments

Comments
 (0)