| 109 | } |
| 110 | |
| 111 | void CVisualizerScope::Draw() |
| 112 | { |
| 113 | #ifdef _DEBUG |
| 114 | int min_ = 0; // // // |
| 115 | int max_ = 0; |
| 116 | #endif |
| 117 | |
| 118 | const int TIME_SCALING = 7; |
| 119 | |
| 120 | static int LastPos = 0; |
| 121 | static int Accum = 0; |
| 122 | |
| 123 | for (auto sample : m_pSamples) { // // // |
| 124 | #ifdef _DEBUG |
| 125 | if (min_ > sample) |
| 126 | min_ = sample; |
| 127 | if (max_ < sample) |
| 128 | max_ = sample; |
| 129 | #endif |
| 130 | |
| 131 | int Pos = m_iWindowBufPtr++ / TIME_SCALING; |
| 132 | |
| 133 | Accum += sample; |
| 134 | |
| 135 | if (Pos != LastPos) { |
| 136 | m_pWindowBuf[LastPos] = Accum / TIME_SCALING; |
| 137 | Accum = 0; |
| 138 | } |
| 139 | |
| 140 | LastPos = Pos; |
| 141 | |
| 142 | if (Pos == m_iWidth) { |
| 143 | m_iWindowBufPtr = 0; |
| 144 | LastPos = 0; |
| 145 | RenderBuffer(); |
| 146 | } |
| 147 | } |
| 148 | |
| 149 | #ifdef _DEBUG |
| 150 | m_iPeak = max_ - min_; // // // |
| 151 | #endif |
| 152 | } |
| 153 | |
| 154 | void CVisualizerScope::Display(CDC *pDC, bool bPaintMsg) |
| 155 | { |
no outgoing calls
no test coverage detected