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

◆ geti16()

int16_t fl::WaveSimulation2D::geti16 ( size_t x,
size_t y ) const

Definition at line 74 of file wave_simulation.cpp.

74 {
75 if (!has(x, y))
76 return 0;
77 int32_t sum = 0;
78 for (uint32_t j = 0; j < mMultiplier; ++j) {
79 for (uint32_t i = 0; i < mMultiplier; ++i) {
80 uint32_t xx = x * mMultiplier + i;
81 uint32_t yy = y * mMultiplier + j;
82 int32_t pt = mSim->geti16(xx, yy);
83 // int32_t ch_pt = mChangeGrid[(yy * mMultiplier) + xx];
84 int32_t ch_pt = mChangeGrid(xx, yy);
85 if (ch_pt != 0) { // we got a hit.
86 sum += ch_pt;
87 } else {
88 sum += pt;
89 }
90 }
91 }
92 int16_t out = static_cast<int16_t>(sum / (mMultiplier * mMultiplier));
93 return out;
94}
int y
Definition Audio.ino:72
int x
Definition Audio.ino:71
fl::Grid< int16_t > mChangeGrid
fl::scoped_ptr< WaveSimulation2D_Real > mSim
bool has(size_t x, size_t y) const

References has(), mChangeGrid, mMultiplier, mSim, x, and y.

Referenced by geti16All(), geti8(), and getu8().

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