mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Added workarounds for an internal compiler error bug on armeabi Android
This commit is contained in:
parent
279c4bc4db
commit
80a226204a
2 changed files with 15 additions and 0 deletions
|
|
@ -1922,9 +1922,16 @@ long ov_read_filter(OggVorbis_File *vf,char *buffer,int length,
|
||||||
vorbis_fpu_setround(&fpu);
|
vorbis_fpu_setround(&fpu);
|
||||||
for(j=0;j<samples;j++)
|
for(j=0;j<samples;j++)
|
||||||
for(i=0;i<channels;i++){
|
for(i=0;i<channels;i++){
|
||||||
|
// Workaround for an ndk armeabi compiler bug which crashes on signed saturation
|
||||||
|
#ifdef ANDROID
|
||||||
|
float f = pcm[i][j];
|
||||||
|
f = (f <= 1.0f ? (f >= -1.0f ? f : -1.0f) : 1.0f);
|
||||||
|
val = vorbis_ftoi(f * 128.f);
|
||||||
|
#else
|
||||||
val=vorbis_ftoi(pcm[i][j]*128.f);
|
val=vorbis_ftoi(pcm[i][j]*128.f);
|
||||||
if(val>127)val=127;
|
if(val>127)val=127;
|
||||||
else if(val<-128)val=-128;
|
else if(val<-128)val=-128;
|
||||||
|
#endif
|
||||||
*buffer++=val+off;
|
*buffer++=val+off;
|
||||||
}
|
}
|
||||||
vorbis_fpu_restore(fpu);
|
vorbis_fpu_restore(fpu);
|
||||||
|
|
|
||||||
|
|
@ -41,8 +41,16 @@ struct AudioThumbnail::MinMaxValue
|
||||||
|
|
||||||
inline void setFloat (Range<float> newRange) noexcept
|
inline void setFloat (Range<float> newRange) noexcept
|
||||||
{
|
{
|
||||||
|
// Workaround for an ndk armeabi compiler bug which crashes on signed saturation
|
||||||
|
#if JUCE_ANDROID
|
||||||
|
Range<float> limitedRange (jlimit (-1.0f, 1.0f, newRange.getStart()),
|
||||||
|
jlimit (-1.0f, 1.0f, newRange.getEnd()));
|
||||||
|
values[0] = (int8) (limitedRange.getStart() * 127.0f);
|
||||||
|
values[1] = (int8) (limitedRange.getEnd() * 127.0f);
|
||||||
|
#else
|
||||||
values[0] = (int8) jlimit (-128, 127, roundFloatToInt (newRange.getStart() * 127.0f));
|
values[0] = (int8) jlimit (-128, 127, roundFloatToInt (newRange.getStart() * 127.0f));
|
||||||
values[1] = (int8) jlimit (-128, 127, roundFloatToInt (newRange.getEnd() * 127.0f));
|
values[1] = (int8) jlimit (-128, 127, roundFloatToInt (newRange.getEnd() * 127.0f));
|
||||||
|
#endif
|
||||||
|
|
||||||
if (values[0] == values[1])
|
if (values[0] == values[1])
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue