FastLED 3.9.15
Loading...
Searching...
No Matches

◆ compute_stereo_samples()

static void fl::third_party::vorbis::compute_stereo_samples ( short * output,
int32_t num_c,
float ** data,
int32_t d_offset,
int32_t len )
static

Definition at line 4970 of file stb_vorbis.cpp.hpp.

4971{
4972 constexpr int32_t STB_BUFFER_SIZE = 32;
4973 float buffer[STB_BUFFER_SIZE];
4974 int32_t i,j,o,n = STB_BUFFER_SIZE >> 1;
4975 // o is the offset in the source data
4977 for (o = 0; o < len; o += STB_BUFFER_SIZE >> 1) {
4978 // o2 is the offset in the output data
4979 int32_t o2 = o << 1;
4980 memset(buffer, 0, sizeof(buffer));
4981 if (o + n > len) n = len - o;
4982 for (j=0; j < num_c; ++j) {
4984 if (m == (PLAYBACK_LEFT | PLAYBACK_RIGHT)) {
4985 for (i=0; i < n; ++i) {
4986 buffer[i*2+0] += data[j][d_offset+o+i];
4987 buffer[i*2+1] += data[j][d_offset+o+i];
4988 }
4989 } else if (m == PLAYBACK_LEFT) {
4990 for (i=0; i < n; ++i) {
4991 buffer[i*2+0] += data[j][d_offset+o+i];
4992 }
4993 } else if (m == PLAYBACK_RIGHT) {
4994 for (i=0; i < n; ++i) {
4995 buffer[i*2+1] += data[j][d_offset+o+i];
4996 }
4997 }
4998 }
4999 for (i=0; i < (n<<1); ++i) {
5000 FL_STBV_FASTDEF(temp);
5001 int32_t v = FL_STBV_FAST_SCALED_FLOAT_TO_INT(temp,buffer[i],15);
5002 if ((uint32_t) (v + 32768) > 65535)
5003 v = v < 0 ? -32768 : 32767;
5004 output[o2+i] = v;
5005 }
5006 }
5007}
static constexpr int8_t PLAYBACK_LEFT
static int8 channel_position[7][6]
static constexpr int8_t PLAYBACK_RIGHT
void * memset(void *s, int c, size_t n) FL_NOEXCEPT
fl::u32 uint32_t
Definition coder.h:219
fl::i32 int32_t
Definition coder.h:220
#define FL_STBV_FAST_SCALED_FLOAT_TO_INT(temp, x, s)
#define FL_STBV_FASTDEF(x)
#define fl_stbv_check_endianness()

References channel_position, FL_NOEXCEPT, fl_stbv_check_endianness, FL_STBV_FAST_SCALED_FLOAT_TO_INT, FL_STBV_FASTDEF, memset(), PLAYBACK_LEFT, and PLAYBACK_RIGHT.

Referenced by convert_channels_short_interleaved().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: