Skip to content

Commit 02ea41c

Browse files
committed
FastSineGenerator linker error when multiple compile units
1 parent 774bc93 commit 02ea41c

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/AudioEffects/SoundGenerator.h

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -261,12 +261,6 @@ class SquareWaveGenerator : public SineWaveGenerator<T> {
261261
}
262262
};
263263

264-
/// sine approximation.
265-
float sine(float t) {
266-
float p = (t - (int)t) - 0.5f; // 0 <= p <= 1
267-
float pp = p * p;
268-
return (p - 6.283211f * pp * p + 9.132843f * pp * pp * p) * -6.221086f;
269-
}
270264

271265
/**
272266
* @brief Sine wave which is based on a fast approximation function.
@@ -292,6 +286,14 @@ class FastSineGenerator : public SineWaveGenerator<T> {
292286
}
293287
return result;
294288
}
289+
290+
protected:
291+
/// sine approximation.
292+
inline float sine(float t) {
293+
float p = (t - (int)t) - 0.5f; // 0 <= p <= 1
294+
float pp = p * p;
295+
return (p - 6.283211f * pp * p + 9.132843f * pp * pp * p) * -6.221086f;
296+
}
295297
};
296298

297299
/**

0 commit comments

Comments
 (0)