Skip to content

armgit / nota

Public Imported from GitHub
0

Nota — a free DAW for macOS, Windows and Linux. No subscription, no account — just open it and make music.

(fix) Windows arm64 build: load NEON gain vectors from memory instead of brace-init

Egor Khindikaynenad5b38242ced
diff --git a/src/native/nota.engine/src/dsp/math/AudioBufferUtils.h b/src/native/nota.engine/src/dsp/math/AudioBufferUtils.h
index a78e0d6d..11be1eeb 100644
--- a/src/native/nota.engine/src/dsp/math/AudioBufferUtils.h
+++ b/src/native/nota.engine/src/dsp/math/AudioBufferUtils.h
@@ -31,7 +31,9 @@ inline void scaleStereoMeter(float* scratch, int32_t frames, float gl, float gr,
int32_t i = 0;
#if defined(NOTA_SIMD_NEON)
- const float32x4_t vgains = {gl, gr, gl, gr};
+ // Loaded from memory: MSVC ARM64 has no brace-init for NEON vector types.
+ alignas(16) const float gainArr[4] = {gl, gr, gl, gr};
+ const float32x4_t vgains = vld1q_f32(gainArr);
for (; i + 4 <= frames; i += 4) {
float32x4_t s0 = vmulq_f32(vld1q_f32(scratch + i * 2), vgains);
float32x4_t s1 = vmulq_f32(vld1q_f32(scratch + i * 2 + 4), vgains);
@@ -81,7 +83,9 @@ inline void addStereoScaledMeterMap(float* dest, const float* src, int32_t frame
int32_t i = 0;
#if defined(NOTA_SIMD_NEON)
- const float32x4_t vgains = {gl, gr, gl, gr};
+ // Loaded from memory: MSVC ARM64 has no brace-init for NEON vector types.
+ alignas(16) const float gainArr[4] = {gl, gr, gl, gr};
+ const float32x4_t vgains = vld1q_f32(gainArr);
for (; i + 4 <= frames; i += 4) {
float32x4_t s0 = vmulq_f32(vld1q_f32(src + i * 2), vgains);
float32x4_t s1 = vmulq_f32(vld1q_f32(src + i * 2 + 4), vgains);
diff --git a/src/native/nota.engine/src/dsp/math/SimdAudio.h b/src/native/nota.engine/src/dsp/math/SimdAudio.h
index 03ff57e8..17c577ba 100644
--- a/src/native/nota.engine/src/dsp/math/SimdAudio.h
+++ b/src/native/nota.engine/src/dsp/math/SimdAudio.h
@@ -193,7 +193,9 @@ inline void peakAndSumSquares(const float* src, int32_t count, float& outPeak, d
inline void scaleStereo(float* dst, const float* src, float gl, float gr, int32_t frames) noexcept {
int32_t i = 0;
#if defined(NOTA_SIMD_NEON)
- const float32x4_t vgains = {gl, gr, gl, gr};
+ // Loaded from memory: MSVC ARM64 has no brace-init for NEON vector types.
+ alignas(16) const float gainArr[4] = {gl, gr, gl, gr};
+ const float32x4_t vgains = vld1q_f32(gainArr);
for (; i + 4 <= frames; i += 4) {
float32x4_t s0 = vmulq_f32(vld1q_f32(src + i * 2), vgains);
float32x4_t s1 = vmulq_f32(vld1q_f32(src + i * 2 + 4), vgains);
@@ -227,7 +229,9 @@ inline void scaleStereo(float* dst, const float* src, float gl, float gr, int32_
inline void addStereoScaled(float* dst, const float* src, float gl, float gr, int32_t frames) noexcept {
int32_t i = 0;
#if defined(NOTA_SIMD_NEON)
- const float32x4_t vgains = {gl, gr, gl, gr};
+ // Loaded from memory: MSVC ARM64 has no brace-init for NEON vector types.
+ alignas(16) const float gainArr[4] = {gl, gr, gl, gr};
+ const float32x4_t vgains = vld1q_f32(gainArr);
for (; i + 4 <= frames; i += 4) {
float32x4_t s0 = vmulq_f32(vld1q_f32(src + i * 2), vgains);
float32x4_t s1 = vmulq_f32(vld1q_f32(src + i * 2 + 4), vgains);