FastLED 3.10.6
Loading...
Searching...
No Matches

◆ mp3d_scale_pcm()

MP3D_LEAF mp3d_sample_t mp3d_scale_pcm ( int64_t sample)

Definition at line 605 of file minimp3_synth_fixed.h.

606{
607 const int64_t t = sample + MP3D_PCM_HALF;
608 int32_t s = (int32_t)(t >= 0 ? (t >> MINIMP3_FRAC_BITS)
609 : -((-t) >> MINIMP3_FRAC_BITS));
610 s -= (s < 0);
611 if (s > 32767) return (int16_t) 32767;
612 if (s < -32768) return (int16_t)-32768;
613 return (int16_t)s;
614}
static uint32_t t
Definition Luminova.h:55
#define MINIMP3_FRAC_BITS
Definition minimp3.h:159
#define MP3D_PCM_HALF
CRGB sample(const CRGB *grid, const XYMap &xyMap, float x, float y, SampleMode mode)
Sample a pixel from a 2D CRGB grid at floating-point coordinates.
Definition sample.cpp.hpp:9
fl::i16 int16_t
Definition stdint.h:214
fl::i32 int32_t
Definition stdint.h:219

References FL_NO_EXCEPT, MINIMP3_FRAC_BITS, MP3D_PCM_HALF, and t.

Referenced by mp3d_synth(), and mp3d_synth_pair().

+ Here is the caller graph for this function: