| 63 | } |
| 64 | |
| 65 | void 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) |
nothing calls this directly
no test coverage detected