diff options
author | OBATA Akio <obache@wizdas.com> | 2022-01-05 16:36:10 +0900 |
---|---|---|
committer | OBATA Akio <obache@wizdas.com> | 2022-01-05 16:36:10 +0900 |
commit | ecd978360d79ba71df598f372be65cc1c0e34d80 (patch) | |
tree | b8065873a3fc01b7115df7207de638589d304145 /noatun-plugins/tippercanoe/core.cpp | |
parent | 762bfec2c849854fc0247acf8d2f107c27b17940 (diff) | |
download | tdeaddons-ecd978360d79ba71df598f372be65cc1c0e34d80.tar.gz tdeaddons-ecd978360d79ba71df598f372be65cc1c0e34d80.zip |
noatun-plugins: change to use SDL feature to handle data for SDL
With own imcompleted endianness checkes, systems might be mis-detected
as big endian.
Change to use SDL macros to determine endianness.
Change to use SDL function to byte swap
Change to use SDL tyepdef for appropriate size integer type
Signed-off-by: OBATA Akio <obache@wizdas.com>
Diffstat (limited to 'noatun-plugins/tippercanoe/core.cpp')
-rw-r--r-- | noatun-plugins/tippercanoe/core.cpp | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/noatun-plugins/tippercanoe/core.cpp b/noatun-plugins/tippercanoe/core.cpp index 8d1f155..8181a81 100644 --- a/noatun-plugins/tippercanoe/core.cpp +++ b/noatun-plugins/tippercanoe/core.cpp @@ -23,6 +23,7 @@ #include <string.h> #include "syna.h" #include <unistd.h> +#include <SDL_endian.h> Core *core; #define outputs unsigned char *Dlo=(unsigned char*)lastOutputBmp.data; \ @@ -302,9 +303,6 @@ bool Core::calculate() double a[NumSamples], b[NumSamples]; int clarity[NumSamples]; //Surround sound int i,j,k; -#ifndef LITTLEENDIAN - sampleType temp; -#endif int brightFactor = int(Brightness * brightnessTwiddler /(starSize+0.01)); @@ -314,18 +312,8 @@ bool Core::calculate() for(i=0;i<NumSamples;i++) { -# ifdef LITTLEENDIAN - x[i] = data[i*2]; - y[i] = data[i*2+1]; -# else - // Need to convert to big-endian - temp = data[i*2]; - temp = (temp >> 8) | (temp << 8); - x[i] = temp; - temp = data[i*2+1]; - temp = (temp << 8) | (temp >> 8); - y[i] = temp; -# endif + x[i] = SDL_SwapLE16(data[i*2]); + y[i] = SDL_SwapLE16(data[i*2+1]); } fft(x,y); |