mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Android: fix float comparisons
float comparison
This commit is contained in:
parent
61a4a3785a
commit
99138c13f8
3 changed files with 5 additions and 5 deletions
|
|
@ -65,7 +65,7 @@ namespace AndroidHighPerformanceAudioHelpers
|
||||||
static bool canUseHighPerformanceAudioPath (int nativeBufferSize, int requestedBufferSize, int requestedSampleRate)
|
static bool canUseHighPerformanceAudioPath (int nativeBufferSize, int requestedBufferSize, int requestedSampleRate)
|
||||||
{
|
{
|
||||||
return ((requestedBufferSize % nativeBufferSize) == 0)
|
return ((requestedBufferSize % nativeBufferSize) == 0)
|
||||||
&& (requestedSampleRate == getNativeSampleRate())
|
&& approximatelyEqual ((double) requestedSampleRate, getNativeSampleRate())
|
||||||
&& isProAudioDevice();
|
&& isProAudioDevice();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -147,7 +147,7 @@ struct SIMDFallbackOps
|
||||||
UnionType a {av}, b {bv};
|
UnionType a {av}, b {bv};
|
||||||
|
|
||||||
for (size_t i = 0; i < n; ++i)
|
for (size_t i = 0; i < n; ++i)
|
||||||
if (a.s[i] != b.s[i])
|
if (! exactlyEqual (a.s[i], b.s[i]))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -181,8 +181,8 @@ struct SIMDFallbackOps
|
||||||
struct ScalarOr { static forcedinline MaskType op (MaskType a, MaskType b) noexcept { return a | b; } };
|
struct ScalarOr { static forcedinline MaskType op (MaskType a, MaskType b) noexcept { return a | b; } };
|
||||||
struct ScalarXor { static forcedinline MaskType op (MaskType a, MaskType b) noexcept { return a ^ b; } };
|
struct ScalarXor { static forcedinline MaskType op (MaskType a, MaskType b) noexcept { return a ^ b; } };
|
||||||
struct ScalarNot { static forcedinline MaskType op (MaskType a, MaskType b) noexcept { return (~a) & b; } };
|
struct ScalarNot { static forcedinline MaskType op (MaskType a, MaskType b) noexcept { return (~a) & b; } };
|
||||||
struct ScalarEq { static forcedinline bool op (ScalarType a, ScalarType b) noexcept { return (a == b); } };
|
struct ScalarEq { static forcedinline bool op (ScalarType a, ScalarType b) noexcept { return exactlyEqual (a, b); } };
|
||||||
struct ScalarNeq { static forcedinline bool op (ScalarType a, ScalarType b) noexcept { return (a != b); } };
|
struct ScalarNeq { static forcedinline bool op (ScalarType a, ScalarType b) noexcept { return ! exactlyEqual (a, b); } };
|
||||||
struct ScalarGt { static forcedinline bool op (ScalarType a, ScalarType b) noexcept { return (a > b); } };
|
struct ScalarGt { static forcedinline bool op (ScalarType a, ScalarType b) noexcept { return (a > b); } };
|
||||||
struct ScalarGeq { static forcedinline bool op (ScalarType a, ScalarType b) noexcept { return (a >= b); } };
|
struct ScalarGeq { static forcedinline bool op (ScalarType a, ScalarType b) noexcept { return (a >= b); } };
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -921,7 +921,7 @@ private:
|
||||||
auto* env = getEnv();
|
auto* env = getEnv();
|
||||||
|
|
||||||
// Perform a potentially pending volume setting
|
// Perform a potentially pending volume setting
|
||||||
if (lastAudioVolume != std::numeric_limits<float>::min())
|
if (! exactlyEqual (lastAudioVolume, std::numeric_limits<float>::min()))
|
||||||
env->CallVoidMethod (nativeMediaPlayer, AndroidMediaPlayer.setVolume, (jfloat) lastAudioVolume, (jfloat) lastAudioVolume);
|
env->CallVoidMethod (nativeMediaPlayer, AndroidMediaPlayer.setVolume, (jfloat) lastAudioVolume, (jfloat) lastAudioVolume);
|
||||||
|
|
||||||
env->CallVoidMethod (nativeMediaPlayer, AndroidMediaPlayer.start);
|
env->CallVoidMethod (nativeMediaPlayer, AndroidMediaPlayer.start);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue