MCPcopy Create free account
hub / github.com/DISTRHO/Cardinal / scope_plot

Function scope_plot

plugins/Cardinal/src/sassy/sassy_scope.cpp:193–251  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

191
192#if 0
193static void scope_plot(ScopeData* gScope, const float uiScale, int index)
194{
195 ImVec2 p = ImGui::GetItemRectMin();
196 const float gSamplerate = gScope->mSampleRate;
197 int cycle = gSamplerate * 10;
198 /*
199 Okay, max scale is 1 second, so..
200 */
201 int samples = (int)(gSamplerate * gScope->mTimeScale);
202
203 scope_grid(uiScale);
204
205 int ofs = scope_sync(gScope, index);
206
207 if (gScope->mDisplay == 2)
208 {
209 for (int i = 0; i < 16384; i++)
210 {
211 for (int j = 0; j < 4; j++)
212 {
213 if (gScope->mCh[j].mEnabled)
214 {
215 float* graphdata = gScope->mCh[j].mData;
216 float y = graphdata[(index - ofs + i * samples / 16384 + cycle) % cycle];
217 float x = graphdata[(index - ofs + i * samples / 16384 + cycle - 1) % cycle];
218 x = x * gScope->mCh[j].mScale;
219 y = y * gScope->mCh[j].mScale - gScope->mCh[j].mOffset;
220 ImGui::GetWindowDrawList()->AddCircleFilled(
221 ImVec2(p.x + (grid_size / 2 + x * grid_quarter_size) * uiScale, p.y + (grid_size / 2 + y * grid_quarter_size) * uiScale),
222 1,
223 (gScope->colors[j] & 0xffffff) | 0x3f000000);
224 }
225 }
226 }
227 }
228 else
229 {
230 for (int i = 0; i < 32768; i++)
231 {
232 for (int j = 0; j < 2; j++)
233 {
234 if (gScope->mCh[j*2].mEnabled)
235 {
236 float* graphdata = gScope->mCh[j * 2].mData;
237 float x = graphdata[(index - ofs + i * samples / 32768 + cycle) % cycle];
238 graphdata = gScope->mCh[j * 2 + 1].mData;
239 float y = graphdata[(index - ofs + i * samples / 32768 + cycle) % cycle];
240 x = x * gScope->mCh[j * 2].mScale - gScope->mCh[j * 2].mOffset;
241 y = y * gScope->mCh[j * 2 + 1].mScale - gScope->mCh[j * 2 + 1].mOffset;
242 ImGui::GetWindowDrawList()->AddCircleFilled(
243 ImVec2(p.x + (grid_size / 2 + x * grid_quarter_size) * uiScale, p.y + (grid_size / 2 + y * grid_quarter_size) * uiScale),
244 1,
245 (gScope->colors[j*2] & 0xffffff) | 0x3f000000);
246 }
247 }
248 }
249 }
250

Callers

nothing calls this directly

Calls 4

scope_gridFunction · 0.85
scope_syncFunction · 0.85
ImVec2Function · 0.85
AddCircleFilledMethod · 0.80

Tested by

no test coverage detected