MCPcopy Create free account
hub / github.com/BespokeSynth/BespokeSynth / Render

Method Render

Source/PatchCable.cpp:65–442  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63}
64
65void PatchCable::Render()
66{
67 PatchCablePos cable = GetPatchCablePos();
68 mX = cable.start.x;
69 mY = cable.start.y;
70 ofVec2f cableFadeOut = cable.start * .47 + cable.end * .53f;
71 ofVec2f cableFadeIn = cable.start * .53f + cable.end * .47f;
72 float cableQuality = gDrawScale * UserPrefs.cable_quality.Get();
73
74 float lineWidth = 1;
75 float plugWidth = 4;
76 float lineAlpha = .4f;
77
78 bool fatCable = false;
79
80 if (TheSynth->GetLastClickedModule() == GetOwningModule() ||
81 TheSynth->GetLastClickedModule() == mTarget)
82 fatCable = true;
83
84 if (TheSynth->ShouldAccentuateActiveModules()) //only draw if we're making noise
85 {
86 if (GetConnectionType() == kConnectionType_Note ||
87 GetConnectionType() == kConnectionType_Grid ||
88 GetConnectionType() == kConnectionType_Pulse ||
89 GetConnectionType() == kConnectionType_Modulator ||
90 GetConnectionType() == kConnectionType_ValueSetter ||
91 GetConnectionType() == kConnectionType_UIControl)
92 {
93 bool hasNote = false;
94 const NoteHistoryEvent& event = mOwner->GetHistory().GetHistoryEvent(0);
95 float elapsed = float(gTime - event.mTime) / NOTE_HISTORY_LENGTH;
96 if (event.mOn || elapsed <= 1)
97 hasNote = true;
98
99 if (!hasNote)
100 return;
101 }
102 else if (GetConnectionType() == kConnectionType_Audio)
103 {
104 IAudioSource* audioSource = dynamic_cast<IAudioSource*>(GetOwningModule());
105 if (audioSource)
106 {
107 RollingBuffer* vizBuff = mOwner->GetOverrideVizBuffer();
108 if (vizBuff == nullptr)
109 vizBuff = audioSource->GetVizBuffer();
110 assert(vizBuff);
111 int numSamples = vizBuff->Size();
112 bool allZero = true;
113 for (int ch = 0; ch < vizBuff->NumChannels(); ++ch)
114 {
115 for (int i = 0; i < numSamples && allZero; ++i)
116 {
117 if (vizBuff->GetSample(i, ch) != 0)
118 allZero = false;
119 }
120 }
121
122 if (allZero)

Callers

nothing calls this directly

Calls 15

ofPushMatrixFunction · 0.85
ofPushStyleFunction · 0.85
ofNoFillFunction · 0.85
NormalFunction · 0.85
ofSetLineWidthFunction · 0.85
ofClampFunction · 0.85
ofSetColorFunction · 0.85
ofSetColorGradientFunction · 0.85
ofBeginShapeFunction · 0.85
ofVertexFunction · 0.85
BezierFunction · 0.85
ofEndShapeFunction · 0.85

Tested by

no test coverage detected