| 1 | /* Copyright 2012 Kjetil S. Matheussen |
| 2 | |
| 3 | This program is free software; you can redistribute it and/or |
| 4 | modify it under the terms of the GNU General Public License |
| 5 | as published by the Free Software Foundation; either version 2 |
| 6 | of the License, or (at your option) any later version. |
| 7 | |
| 8 | This program is distributed in the hope that it will be useful, |
| 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 | GNU General Public License for more details. |
| 12 | |
| 13 | You should have received a copy of the GNU General Public License |
| 14 | along with this program; if not, write to the Free Software |
| 15 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ |
| 16 | |
| 17 | |
| 18 | #include <math.h> |
| 19 | |
| 20 | #include <QWidget> |
| 21 | #include <QGraphicsItem> |
| 22 | #include <QTimer> |
| 23 | #include <QSlider> |
| 24 | #include <QTimerEvent> |
| 25 | |
| 26 | #include "EditorWidget.h"cxx . . $ `<file>/Qt/EditorWidget.h`/ |
| 27 | |
| 28 | #include "Qt_SliderPainter_proc.h"cxx . . $ `<file>/Qt/Qt_SliderPainter_proc.h`/ |
| 29 | |
| 30 | #include "Qt_SliderPainterPainter.h"cxx . . $ `<file>/Qt/Qt_SliderPainterPainter.h`/ |
| 31 | |
| 32 | |
| 33 | const int k_timer_intervalcxx . . $ k_timer_interval. = 50; |
| 34 | |
| 35 | |
| 36 | static int scale_intcxx . . $ scale_int(ea6ae529d4ec1c7a).(int x, int x1, int x2, int y1, int y2){ |
| 37 | return (int)scalecxx . . $ scale(a4708ef16e45b76e).((float)x,(float)x1,(float)x2,(float)y1,(float)y2); |
| 38 | } |
| 39 | |
| 40 | static float gain2dbcxx . . $ gain2db(fbcf3211dfe1bfd1).(float val){ |
| 41 | if(val<=0.0f) |
| 42 | return -100.0f; |
| 43 | |
| 44 | return 20*log10cxx . . $ log10(fbcf3211dfe1bfd1).(val); |
| 45 | } |
| 46 | |
| 47 | static float db2linearcxx . . $ db2linear(fbcf3211dfe1bfd1).(float db){ |
| 48 | if(db<-70) |
| 49 | return 0.0f; |
| 50 | else if(db>40) |
| 51 | return 1.0f; |
| 52 | else |
| 53 | return scalecxx . . $ scale(a4708ef16e45b76e).(db,-70.0f,40.0f,0.0f,1.0f); |
| 54 | } |
| 55 | |
| 56 | #if 0 |
| 57 | // Function iec_scale picked from meterbridge by Steve Harris. |
| 58 | // db is a value between 0 and 1. |
| 59 | |
| 60 | static float iec_scale(float db) { |
| 61 | |
| 62 | db = 20.0f * log10f(db); |
| 63 | |
| 64 | |
| 65 | float def = 0.0f; /* Meter deflection %age */ |
| 66 | |
| 67 | if (db < -70.0f) { |
| 68 | def = 0.0f; |
| 69 | } else if (db < -60.0f) { |
| 70 | def = (db + 70.0f) * 0.25f; |
| 71 | } else if (db < -50.0f) { |
| 72 | def = (db + 60.0f) * 0.5f + 5.0f; |
| 73 | } else if (db < -40.0f) { |
| 74 | def = (db + 50.0f) * 0.75f + 7.5; |
| 75 | } else if (db < -30.0f) { |
| 76 | def = (db + 40.0f) * 1.5f + 15.0f; |
| 77 | } else if (db < -20.0f) { |
| 78 | def = (db + 30.0f) * 2.0f + 30.0f; |
| 79 | } else if (db < 0.0f) { |
| 80 | def = (db + 20.0f) * 2.5f + 50.0f; |
| 81 | } else { |
| 82 | def = 100.0f; |
| 83 | } |
| 84 | |
| 85 | return def * 2.0f / 200.0f; |
| 86 | } |
| 87 | #endif |
| 88 | |
| 89 | |
| 90 | |
| 91 | |
| 92 | #define MAX_CHANNELScxx . . $ `Qt/Qt_SliderPainter.cpp:92:9`! 8 |
| 93 | |
| 94 | //namespace{ // stupid c++ with all this useless syntax necessary to make a program appear to work. C++ is only great if you like a challenge and don't want things done. |
| 95 | |
| 96 | namespacecxx . . $ `$anonymous_namespace_Qt/Qt_SliderPainter.cpp`/{ |
| 97 | struct AutomationOrPeakDatacxx . . $ `$anonymous_namespace_Qt/Qt_SliderPainter.cpp`/AutomationOrPeakData#{ |
| 98 | float *valuecxx . . $ `$anonymous_namespace_Qt/Qt_SliderPainter.cpp`/AutomationOrPeakData#value.; |
| 99 | int requested_poscxx . . $ `$anonymous_namespace_Qt/Qt_SliderPainter.cpp`/AutomationOrPeakData#requested_pos.; |
| 100 | int last_drawn_poscxx . . $ `$anonymous_namespace_Qt/Qt_SliderPainter.cpp`/AutomationOrPeakData#last_drawn_pos.; |
| 101 | |
| 102 | int *colorcxx . . $ `$anonymous_namespace_Qt/Qt_SliderPainter.cpp`/AutomationOrPeakData#color.; |
| 103 | |
| 104 | int chcxx . . $ `$anonymous_namespace_Qt/Qt_SliderPainter.cpp`/AutomationOrPeakData#ch.; |
| 105 | int num_chcxx . . $ `$anonymous_namespace_Qt/Qt_SliderPainter.cpp`/AutomationOrPeakData#num_ch.; |
| 106 | |
| 107 | bool is_automationcxx . . $ `$anonymous_namespace_Qt/Qt_SliderPainter.cpp`/AutomationOrPeakData#is_automation.; |
| 108 | }; |
| 109 | } |
| 110 | |
| 111 | static int DATA_get_y1cxx . . $ DATA_get_y1(d680edb3f85be227).(AutomationOrPeakDatacxx . . $ `$anonymous_namespace_Qt/Qt_SliderPainter.cpp`/AutomationOrPeakData# *data, int height){ |
| 112 | return scale_intcxx . . $ scale_int(ea6ae529d4ec1c7a).(data->chcxx . . $ `$anonymous_namespace_Qt/Qt_SliderPainter.cpp`/AutomationOrPeakData#ch.,0,data->num_chcxx . . $ `$anonymous_namespace_Qt/Qt_SliderPainter.cpp`/AutomationOrPeakData#num_ch.,1,height-1); |
| 113 | } |
| 114 | |
| 115 | static int DATA_get_y2cxx . . $ DATA_get_y2(d680edb3f85be227).(AutomationOrPeakDatacxx . . $ `$anonymous_namespace_Qt/Qt_SliderPainter.cpp`/AutomationOrPeakData# *data, int height){ |
| 116 | return scale_intcxx . . $ scale_int(ea6ae529d4ec1c7a).(data->chcxx . . $ `$anonymous_namespace_Qt/Qt_SliderPainter.cpp`/AutomationOrPeakData#ch.+1,0,data->num_chcxx . . $ `$anonymous_namespace_Qt/Qt_SliderPainter.cpp`/AutomationOrPeakData#num_ch.,1,height-1); |
| 117 | } |
| 118 | |
| 119 | struct SliderPaintercxx . . $ SliderPainter#{ |
| 120 | |
| 121 | struct Timercxx . . $ SliderPainter#Timer# : public QTimercxx . . $ QTimer#{ |
| 122 | SliderPaintercxx . . $ SliderPainter# *_paintercxx . . $ SliderPainter#Timer#_painter.; |
| 123 | |
| 124 | void timerEventcxx . . $ SliderPainter#Timer#timerEvent(b9e57d1150f23bf5).(QTimerEventcxx . . $ QTimerEvent# * e){ |
| 125 | //if(_painter->isVisible()) |
| 126 | // printf("oh yeah. value: %f. last_drawn: %d, visible? %d\n",*data->value, data->last_drawn_pos,_painter->isVisible()); |
| 127 | |
| 128 | if(_paintercxx . . $ SliderPainter#Timer#_painter.->isVisiblecxx . . $ SliderPainter#isVisible(c9857a73d68e59ba).()==false) |
| 129 | return; |
| 130 | |
| 131 | for(unsigned int i=0;i<_paintercxx . . $ SliderPainter#Timer#_painter.->_datacxx . . $ SliderPainter#_data..sizecxx . . $ std/vector#size(c9b1e749b64d5edc).();i++){ |
| 132 | AutomationOrPeakDatacxx . . $ `$anonymous_namespace_Qt/Qt_SliderPainter.cpp`/AutomationOrPeakData# *data = _paintercxx . . $ SliderPainter#Timer#_painter.->_datacxx . . $ SliderPainter#_data..atcxx . . $ std/vector#at(428bb168810b9e52).(i); |
| 133 | |
| 134 | float gain; |
| 135 | |
| 136 | if(data->is_automationcxx . . $ `$anonymous_namespace_Qt/Qt_SliderPainter.cpp`/AutomationOrPeakData#is_automation.) |
| 137 | gain = *data->valuecxx . . $ `$anonymous_namespace_Qt/Qt_SliderPainter.cpp`/AutomationOrPeakData#value.; |
| 138 | else{ |
| 139 | float db = gain2dbcxx . . $ gain2db(fbcf3211dfe1bfd1).(*data->valuecxx . . $ `$anonymous_namespace_Qt/Qt_SliderPainter.cpp`/AutomationOrPeakData#value.); |
| 140 | if(db>4.0f) |
| 141 | _paintercxx . . $ SliderPainter#Timer#_painter.->_peak_colorcxx . . $ SliderPainter#_peak_color. = 14; |
| 142 | else if(db>0.0f) |
| 143 | _paintercxx . . $ SliderPainter#Timer#_painter.->_peak_colorcxx . . $ SliderPainter#_peak_color. = 6; |
| 144 | else |
| 145 | _paintercxx . . $ SliderPainter#Timer#_painter.->_peak_colorcxx . . $ SliderPainter#_peak_color. = 13; |
| 146 | |
| 147 | gain = db2linearcxx . . $ db2linear(fbcf3211dfe1bfd1).(db); |
| 148 | } |
| 149 | |
| 150 | data->requested_poscxx . . $ `$anonymous_namespace_Qt/Qt_SliderPainter.cpp`/AutomationOrPeakData#requested_pos. = scalecxx . . $ scale(a4708ef16e45b76e).(gain,0.0f,1.0f, |
| 151 | 0.0f,(float)_paintercxx . . $ SliderPainter#Timer#_painter.->widthcxx . . $ SliderPainter#width(b126dc7c1de90089).()) |
| 152 | - 1; |
| 153 | |
| 154 | if(data->last_drawn_poscxx . . $ `$anonymous_namespace_Qt/Qt_SliderPainter.cpp`/AutomationOrPeakData#last_drawn_pos. != data->requested_poscxx . . $ `$anonymous_namespace_Qt/Qt_SliderPainter.cpp`/AutomationOrPeakData#requested_pos.){ |
| 155 | |
| 156 | //printf("Painting. Last drawn: %d. requested: %d\n",data->last_drawn_pos,data->requested_pos); |
| 157 | |
| 158 | |
| 159 | int y1 = DATA_get_y1cxx . . $ DATA_get_y1(d680edb3f85be227).(data,_paintercxx . . $ SliderPainter#Timer#_painter.->heightcxx . . $ SliderPainter#height(b126dc7c1de90089).()); |
| 160 | int y2 = DATA_get_y2cxx . . $ DATA_get_y2(d680edb3f85be227).(data,_paintercxx . . $ SliderPainter#Timer#_painter.->heightcxx . . $ SliderPainter#height(b126dc7c1de90089).()); |
| 161 | int height = y2-y1; |
| 162 | |
| 163 | //printf("y1: %d, y2: %d, height: %d. req: %d, last: %d\n",y1,y2,height,data->requested_pos,data->last_drawn_pos); |
| 164 | _paintercxx . . $ SliderPainter#Timer#_painter.->updatecxx . . $ SliderPainter#update(748afa4755bc9595).(data->requested_poscxx . . $ `$anonymous_namespace_Qt/Qt_SliderPainter.cpp`/AutomationOrPeakData#requested_pos., |
| 165 | y1,4,height+1); |
| 166 | _paintercxx . . $ SliderPainter#Timer#_painter.->updatecxx . . $ SliderPainter#update(748afa4755bc9595).(data->last_drawn_poscxx . . $ `$anonymous_namespace_Qt/Qt_SliderPainter.cpp`/AutomationOrPeakData#last_drawn_pos., |
| 167 | y1,4,height+1); |
| 168 | |
| 169 | //printf("%d - %d\n",data->requested_pos,data->last_drawn_pos); |
| 170 | } |
| 171 | } |
| 172 | |
| 173 | //e->accept(); |
| 174 | } |
| 175 | }; // struct Timer |
| 176 | |
| 177 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<AutomationOrPeakDatacxx . . $ `$anonymous_namespace_Qt/Qt_SliderPainter.cpp`/AutomationOrPeakData#*>_datacxx . . $ SliderPainter#_data.; |
| 178 | |
| 179 | QSlidercxx . . $ QSlider# *_qslidercxx . . $ SliderPainter#_qslider.; |
| 180 | QGraphicsItemcxx . . $ QGraphicsItem# *_graphics_itemcxx . . $ SliderPainter#_graphics_item.; // Either widget or _graphics_item must be set. |
| 181 | |
| 182 | int _x1cxx . . $ SliderPainter#_x1.; |
| 183 | int _y1cxx . . $ SliderPainter#_y1.; |
| 184 | int _x2cxx . . $ SliderPainter#_x2.; |
| 185 | int _y2cxx . . $ SliderPainter#_y2.; |
| 186 | |
| 187 | float *_peak_valuescxx . . $ SliderPainter#_peak_values.; |
| 188 | bool _local_peak_valuescxx . . $ SliderPainter#_local_peak_values.; |
| 189 | float _automation_valuecxx . . $ SliderPainter#_automation_value.; |
| 190 | int _automation_colorcxx . . $ SliderPainter#_automation_color.; |
| 191 | int _peak_colorcxx . . $ SliderPainter#_peak_color.; |
| 192 | |
| 193 | bool _alternative_colorcxx . . $ SliderPainter#_alternative_color.; |
| 194 | |
| 195 | int _valuecxx . . $ SliderPainter#_value.; |
| 196 | |
| 197 | int _num_automationscxx . . $ SliderPainter#_num_automations.; |
| 198 | Timercxx . . $ SliderPainter#Timer# _timercxx . . $ SliderPainter#_timer.; |
| 199 | |
| 200 | QStringcxx . . $ QString# _display_stringcxx . . $ SliderPainter#_display_string.; |
| 201 | |
| 202 | int _num_channelscxx . . $ SliderPainter#_num_channels.; |
| 203 | |
| 204 | |
| 205 | int valuecxx . . $ SliderPainter#value(b126dc7c1de90089).(){ |
| 206 | if(_qslidercxx . . $ SliderPainter#_qslider.!=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) |
| 207 | return _qslidercxx . . $ SliderPainter#_qslider.->valuecxx . . $ QAbstractSlider#value(455f465bc33b4cdf).(); |
| 208 | else |
| 209 | return _valuecxx . . $ SliderPainter#_value.; |
| 210 | } |
| 211 | |
| 212 | int minimumcxx . . $ SliderPainter#minimum(b126dc7c1de90089).(){ |
| 213 | if(_qslidercxx . . $ SliderPainter#_qslider.!=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) |
| 214 | return _qslidercxx . . $ SliderPainter#_qslider.->minimumcxx . . $ QAbstractSlider#minimum(455f465bc33b4cdf).(); |
| 215 | else |
| 216 | return 0; |
| 217 | } |
| 218 | |
| 219 | int maximumcxx . . $ SliderPainter#maximum(b126dc7c1de90089).(){ |
| 220 | if(_qslidercxx . . $ SliderPainter#_qslider.!=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) |
| 221 | return _qslidercxx . . $ SliderPainter#_qslider.->maximumcxx . . $ QAbstractSlider#maximum(455f465bc33b4cdf).(); |
| 222 | else |
| 223 | return 10000; |
| 224 | } |
| 225 | |
| 226 | int orientationcxx . . $ SliderPainter#orientation(b126dc7c1de90089).(){ |
| 227 | if(_qslidercxx . . $ SliderPainter#_qslider.!=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) |
| 228 | return _qslidercxx . . $ SliderPainter#_qslider.->orientationcxx . . $ QAbstractSlider#orientation(4cb85ee07ca33cb).(); |
| 229 | else |
| 230 | return Qtcxx . . $ Qt/::Horizontalcxx . . $ Qt/Horizontal.; |
| 231 | } |
| 232 | |
| 233 | bool isEnabledcxx . . $ SliderPainter#isEnabled(c9857a73d68e59ba).(){ |
| 234 | if(_qslidercxx . . $ SliderPainter#_qslider.!=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) |
| 235 | return _qslidercxx . . $ SliderPainter#_qslider.->isEnabledcxx . . $ QWidget#isEnabled(50ce9a9e25b4a850).(); |
| 236 | else |
| 237 | return _num_channelscxx . . $ SliderPainter#_num_channels.>0; |
| 238 | } |
| 239 | |
| 240 | bool isVisiblecxx . . $ SliderPainter#isVisible(c9857a73d68e59ba).(){ |
| 241 | if(_qslidercxx . . $ SliderPainter#_qslider.!=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) |
| 242 | return _qslidercxx . . $ SliderPainter#_qslider.->isVisiblecxx . . $ QWidget#isVisible(50ce9a9e25b4a850).() && !_qslidercxx . . $ SliderPainter#_qslider.->isHiddencxx . . $ QWidget#isHidden(50ce9a9e25b4a850).(); |
| 243 | else |
| 244 | return _graphics_itemcxx . . $ SliderPainter#_graphics_item.->isVisiblecxx . . $ QGraphicsItem#isVisible(50ce9a9e25b4a850).(); |
| 245 | } |
| 246 | |
| 247 | void updatecxx . . $ SliderPainter#update(748afa4755bc9595).(int x, int y, int width, int height){ |
| 248 | //fprintf(stderr,"x: %d. _qslider: %p\n",x,_qslider); |
| 249 | if(x<0) |
| 250 | x=0; |
| 251 | if(y<0) |
| 252 | y=0; |
| 253 | |
| 254 | //fprintf(stderr,"y: %d. _qslider: %p\n",y,_qslider); |
| 255 | if(_qslidercxx . . $ SliderPainter#_qslider.!=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!){ |
| 256 | return _qslidercxx . . $ SliderPainter#_qslider.->updatecxx . . $ QWidget#update(748afa4755bc9595).(x,y,width,height); |
| 257 | }else |
| 258 | return _graphics_itemcxx . . $ SliderPainter#_graphics_item.->updatecxx . . $ QGraphicsItem#update(52a61fa14d44b641).(_x1cxx . . $ SliderPainter#_x1.+x, _y1cxx . . $ SliderPainter#_y1.+y, width, height); |
| 259 | } |
| 260 | |
| 261 | int widthcxx . . $ SliderPainter#width(b126dc7c1de90089).(){ |
| 262 | if(_qslidercxx . . $ SliderPainter#_qslider.!=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) |
| 263 | return _qslidercxx . . $ SliderPainter#_qslider.->widthcxx . . $ QWidget#width(455f465bc33b4cdf).(); |
| 264 | else |
| 265 | return _x2cxx . . $ SliderPainter#_x2.-_x1cxx . . $ SliderPainter#_x1.; |
| 266 | } |
| 267 | |
| 268 | int heightcxx . . $ SliderPainter#height(b126dc7c1de90089).(){ |
| 269 | if(_qslidercxx . . $ SliderPainter#_qslider.!=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) |
| 270 | return _qslidercxx . . $ SliderPainter#_qslider.->heightcxx . . $ QWidget#height(455f465bc33b4cdf).(); |
| 271 | else |
| 272 | return _y2cxx . . $ SliderPainter#_y2.-_y1cxx . . $ SliderPainter#_y1.; |
| 273 | } |
| 274 | |
| 275 | void initcxx . . $ SliderPainter#init(49f6e7a06ebc5aa8).(){ |
| 276 | _valuecxx . . $ SliderPainter#_value. = 0; |
| 277 | _num_automationscxx . . $ SliderPainter#_num_automations. = 0; |
| 278 | _num_channelscxx . . $ SliderPainter#_num_channels. = 0; |
| 279 | _peak_valuescxx . . $ SliderPainter#_peak_values. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 280 | _local_peak_valuescxx . . $ SliderPainter#_local_peak_values.=false; |
| 281 | _automation_colorcxx . . $ SliderPainter#_automation_color. = 13; |
| 282 | _peak_colorcxx . . $ SliderPainter#_peak_color. = 13; |
| 283 | _alternative_colorcxx . . $ SliderPainter#_alternative_color. = false; |
| 284 | } |
| 285 | |
| 286 | SliderPaintercxx . . $ SliderPainter#SliderPainter(ac8d75a184dfaaa6).(QSlidercxx . . $ QSlider# *widget) |
| 287 | : _qslidercxx . . $ SliderPainter#_qslider.(widget) |
| 288 | , _graphics_itemcxx . . $ SliderPainter#_graphics_item.(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) |
| 289 | , _automation_valuecxx . . $ SliderPainter#_automation_value.(0.0f) |
| 290 | { |
| 291 | initcxx . . $ SliderPainter#init(49f6e7a06ebc5aa8).(); |
| 292 | } |
| 293 | |
| 294 | SliderPaintercxx . . $ SliderPainter#SliderPainter(af50d9c5bfd58279).(QGraphicsItemcxx . . $ QGraphicsItem# *graphics_item) |
| 295 | : _qslidercxx . . $ SliderPainter#_qslider.(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) |
| 296 | , _graphics_itemcxx . . $ SliderPainter#_graphics_item.(graphics_item) |
| 297 | { |
| 298 | initcxx . . $ SliderPainter#init(49f6e7a06ebc5aa8).(); |
| 299 | } |
| 300 | |
| 301 | ~cxx . . $ SliderPainter#`~SliderPainter`(ced63f7c635d850d).SliderPaintercxx . . $ SliderPainter#(){ |
| 302 | if(_local_peak_valuescxx . . $ SliderPainter#_local_peak_values.==true) |
| 303 | free(_peak_valuescxx . . $ SliderPainter#_peak_values.); |
| 304 | |
| 305 | for(unsigned int i=0;i<_datacxx . . $ SliderPainter#_data..sizecxx . . $ std/vector#size(c9b1e749b64d5edc).();i++) // Don't like iterators. Rather free memory manually than using them. |
| 306 | delete _datacxx . . $ SliderPainter#_data..atcxx . . $ std/vector#at(428bb168810b9e52).(i); |
| 307 | } |
| 308 | |
| 309 | AutomationOrPeakDatacxx . . $ `$anonymous_namespace_Qt/Qt_SliderPainter.cpp`/AutomationOrPeakData# *create_automation_datacxx . . $ SliderPainter#create_automation_data(b48edcad84c22617).(){ |
| 310 | AutomationOrPeakDatacxx . . $ `$anonymous_namespace_Qt/Qt_SliderPainter.cpp`/AutomationOrPeakData# *data = new AutomationOrPeakDatacxx . . $ `$anonymous_namespace_Qt/Qt_SliderPainter.cpp`/AutomationOrPeakData#; |
| 311 | |
| 312 | data->valuecxx . . $ `$anonymous_namespace_Qt/Qt_SliderPainter.cpp`/AutomationOrPeakData#value. = &_automation_valuecxx . . $ SliderPainter#_automation_value.; |
| 313 | data->requested_poscxx . . $ `$anonymous_namespace_Qt/Qt_SliderPainter.cpp`/AutomationOrPeakData#requested_pos. = 0; |
| 314 | data->last_drawn_poscxx . . $ `$anonymous_namespace_Qt/Qt_SliderPainter.cpp`/AutomationOrPeakData#last_drawn_pos. = 0; |
| 315 | |
| 316 | data->colorcxx . . $ `$anonymous_namespace_Qt/Qt_SliderPainter.cpp`/AutomationOrPeakData#color. = &_automation_colorcxx . . $ SliderPainter#_automation_color.; |
| 317 | |
| 318 | data->chcxx . . $ `$anonymous_namespace_Qt/Qt_SliderPainter.cpp`/AutomationOrPeakData#ch. = 0; |
| 319 | data->num_chcxx . . $ `$anonymous_namespace_Qt/Qt_SliderPainter.cpp`/AutomationOrPeakData#num_ch. = 1; |
| 320 | |
| 321 | data->is_automationcxx . . $ `$anonymous_namespace_Qt/Qt_SliderPainter.cpp`/AutomationOrPeakData#is_automation. = true; |
| 322 | |
| 323 | _datacxx . . $ SliderPainter#_data..push_backcxx . . $ std/vector#push_back(77d9f17553126ecb).(data); |
| 324 | if(_num_automationscxx . . $ SliderPainter#_num_automations.==0){ |
| 325 | _timercxx . . $ SliderPainter#_timer.._paintercxx . . $ SliderPainter#Timer#_painter. = this; |
| 326 | _timercxx . . $ SliderPainter#_timer..setIntervalcxx . . $ QTimer#setInterval(d4f767463ce0a6b3).(k_timer_intervalcxx . . $ k_timer_interval.); |
| 327 | _timercxx . . $ SliderPainter#_timer..startcxx . . $ QTimer#start(49f6e7a06ebc5aa8).(); |
| 328 | } |
| 329 | _num_automationscxx . . $ SliderPainter#_num_automations.++; |
| 330 | |
| 331 | return data; |
| 332 | } |
| 333 | |
| 334 | float *obtain_automation_value_pointercxx . . $ SliderPainter#obtain_automation_value_pointer(a3aba87f01dec7c2).(){ |
| 335 | create_automation_datacxx . . $ SliderPainter#create_automation_data(b48edcad84c22617).(); |
| 336 | return &_automation_valuecxx . . $ SliderPainter#_automation_value.; |
| 337 | } |
| 338 | |
| 339 | int *obtain_automation_color_pointercxx . . $ SliderPainter#obtain_automation_color_pointer(a7741f82f5fc3640).(){ |
| 340 | return &_automation_colorcxx . . $ SliderPainter#_automation_color.; |
| 341 | } |
| 342 | |
| 343 | float *obtain_peak_value_pointerscxx . . $ SliderPainter#obtain_peak_value_pointers(53bda2b791433d40).(int num_channels, float *peak_values){ |
| 344 | bool is_replacing = _peak_valuescxx . . $ SliderPainter#_peak_values.!=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 345 | |
| 346 | if(peak_values==NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) { |
| 347 | _peak_valuescxx . . $ SliderPainter#_peak_values. = (float*)calloc(sizeof(float*),num_channels); |
| 348 | |
| 349 | _local_peak_valuescxx . . $ SliderPainter#_local_peak_values. = true; |
| 350 | |
| 351 | } else { |
| 352 | |
| 353 | _peak_valuescxx . . $ SliderPainter#_peak_values. = peak_values; |
| 354 | |
| 355 | } |
| 356 | |
| 357 | if(is_replacing){ |
| 358 | while(_num_automationscxx . . $ SliderPainter#_num_automations.>0) |
| 359 | release_automation_pointerscxx . . $ SliderPainter#release_automation_pointers(49f6e7a06ebc5aa8).(); // Warning! This works only since _is_replacing==true just for the bottom bar volume slider (which doesn't have automations). |
| 360 | _datacxx . . $ SliderPainter#_data..clearcxx . . $ std/vector#clear(ced63f7c635d850d).(); |
| 361 | } |
| 362 | |
| 363 | for(int ch=0;ch<num_channels;ch++){ |
| 364 | AutomationOrPeakDatacxx . . $ `$anonymous_namespace_Qt/Qt_SliderPainter.cpp`/AutomationOrPeakData# *data = create_automation_datacxx . . $ SliderPainter#create_automation_data(b48edcad84c22617).(); |
| 365 | data->chcxx . . $ `$anonymous_namespace_Qt/Qt_SliderPainter.cpp`/AutomationOrPeakData#ch. = ch; |
| 366 | data->num_chcxx . . $ `$anonymous_namespace_Qt/Qt_SliderPainter.cpp`/AutomationOrPeakData#num_ch. = num_channels; |
| 367 | data->is_automationcxx . . $ `$anonymous_namespace_Qt/Qt_SliderPainter.cpp`/AutomationOrPeakData#is_automation. = false; |
| 368 | data->valuecxx . . $ `$anonymous_namespace_Qt/Qt_SliderPainter.cpp`/AutomationOrPeakData#value. = &_peak_valuescxx . . $ SliderPainter#_peak_values.[ch]; |
| 369 | data->colorcxx . . $ `$anonymous_namespace_Qt/Qt_SliderPainter.cpp`/AutomationOrPeakData#color. = &_peak_colorcxx . . $ SliderPainter#_peak_color.; |
| 370 | } |
| 371 | |
| 372 | return _peak_valuescxx . . $ SliderPainter#_peak_values.; |
| 373 | } |
| 374 | |
| 375 | void set_peak_value_pointerscxx . . $ SliderPainter#set_peak_value_pointers(b7bdbdc5370467be).(int num_channels, float *pointers){ |
| 376 | obtain_peak_value_pointerscxx . . $ SliderPainter#obtain_peak_value_pointers(53bda2b791433d40).(num_channels, pointers); |
| 377 | } |
| 378 | |
| 379 | void release_automation_pointerscxx . . $ SliderPainter#release_automation_pointers(49f6e7a06ebc5aa8).(){ |
| 380 | _num_automationscxx . . $ SliderPainter#_num_automations.--; |
| 381 | if(_num_automationscxx . . $ SliderPainter#_num_automations.==0) |
| 382 | _timercxx . . $ SliderPainter#_timer..stopcxx . . $ QTimer#stop(49f6e7a06ebc5aa8).(); |
| 383 | } |
| 384 | |
| 385 | void paintcxx . . $ SliderPainter#paint(c81d535d1ac9d52).(QPaintercxx . . $ QPainter# *p){ |
| 386 | #ifdef COMPILING_RADIUM |
| 387 | QColor *colors = static_cast<EditorWidget*>(root->song->tracker_windows->os_visual.widget)->colors; |
| 388 | #else |
| 389 | QColorcxx . . $ QColor# *colors = g_colorscxx . . $ g_colors.; |
| 390 | #endif |
| 391 | |
| 392 | SLIDERPAINTERPAINTER_paintcxx . . $ SLIDERPAINTERPAINTER_paint(b27d8cf3279c2e1b).(p,0,0,widthcxx . . $ SliderPainter#width(b126dc7c1de90089).(),heightcxx . . $ SliderPainter#height(b126dc7c1de90089).(), |
| 393 | isEnabledcxx . . $ SliderPainter#isEnabled(c9857a73d68e59ba).(), |
| 394 | scalecxx . . $ scale(a4708ef16e45b76e).(valuecxx . . $ SliderPainter#value(b126dc7c1de90089).(),minimumcxx . . $ SliderPainter#minimum(b126dc7c1de90089).(),maximumcxx . . $ SliderPainter#maximum(b126dc7c1de90089).(),0.0f,1.0f), |
| 395 | _display_stringcxx . . $ QString#QString(132dd6869045752b)., |
| 396 | _alternative_colorcxx . . $ SliderPainter#_alternative_color.); |
| 397 | |
| 398 | for(unsigned int i=0;i<_datacxx . . $ SliderPainter#_data..sizecxx . . $ std/vector#size(c9b1e749b64d5edc).();i++){ |
| 399 | AutomationOrPeakDatacxx . . $ `$anonymous_namespace_Qt/Qt_SliderPainter.cpp`/AutomationOrPeakData# *data = _datacxx . . $ SliderPainter#_data..atcxx . . $ std/vector#at(428bb168810b9e52).(i); |
| 400 | int y1 = DATA_get_y1cxx . . $ DATA_get_y1(d680edb3f85be227).(data,heightcxx . . $ SliderPainter#height(b126dc7c1de90089).()); |
| 401 | int y2 = DATA_get_y2cxx . . $ DATA_get_y2(d680edb3f85be227).(data,heightcxx . . $ SliderPainter#height(b126dc7c1de90089).()); |
| 402 | int height = y2-y1; |
| 403 | |
| 404 | p->fillRectcxx . . $ QPainter#fillRect(b6f7dd7f1bbb6c84).(data->requested_poscxx . . $ `$anonymous_namespace_Qt/Qt_SliderPainter.cpp`/AutomationOrPeakData#requested_pos.+1 ,y1+1, |
| 405 | 2, height-1, |
| 406 | colors[*data->colorcxx . . $ `$anonymous_namespace_Qt/Qt_SliderPainter.cpp`/AutomationOrPeakData#color.]); |
| 407 | |
| 408 | p->setPencxx . . $ QPainter#setPen(af0a25dfda3214db).(QPencxx . . $ QPen#QPen(c1f9b1cc0228302b).(colorscxx . . $ QBrush#QBrush(b50947b0752ea6ac).[11].lightcxx . . $ QColor#light(a312dab4e0811e0).(120),1)); |
| 409 | p->drawRectcxx . . $ QPainter#drawRect(748afa4755bc9595).(data->requested_poscxx . . $ `$anonymous_namespace_Qt/Qt_SliderPainter.cpp`/AutomationOrPeakData#requested_pos., y1, |
| 410 | 3, height); |
| 411 | |
| 412 | data->last_drawn_poscxx . . $ `$anonymous_namespace_Qt/Qt_SliderPainter.cpp`/AutomationOrPeakData#last_drawn_pos. = data->requested_poscxx . . $ `$anonymous_namespace_Qt/Qt_SliderPainter.cpp`/AutomationOrPeakData#requested_pos.; |
| 413 | } |
| 414 | } |
| 415 | |
| 416 | }; |
| 417 | //} |
| 418 | |
| 419 | SliderPaintercxx . . $ SliderPainter# *SLIDERPAINTER_createcxx . . $ SLIDERPAINTER_create(aa4da35da68ce0c2).(QSlidercxx . . $ QSlider# *qslider){ |
| 420 | return new SliderPaintercxx . . $ SliderPainter#SliderPainter(ac8d75a184dfaaa6).(qslider); |
| 421 | } |
| 422 | |
| 423 | SliderPaintercxx . . $ SliderPainter# *SLIDERPAINTER_createcxx . . $ SLIDERPAINTER_create(64e33e97865781a9).(QGraphicsItemcxx . . $ QGraphicsItem# *graphics_item, int x1, int y1, int x2, int y2){ |
| 424 | SliderPaintercxx . . $ SliderPainter# *painter = new SliderPaintercxx . . $ SliderPainter#SliderPainter(af50d9c5bfd58279).(graphics_item); |
| 425 | painter->_x1cxx . . $ SliderPainter#_x1.=x1; |
| 426 | painter->_y1cxx . . $ SliderPainter#_y1.=y1; |
| 427 | painter->_x2cxx . . $ SliderPainter#_x2.=x2; |
| 428 | painter->_y2cxx . . $ SliderPainter#_y2.=y2; |
| 429 | |
| 430 | return painter; |
| 431 | } |
| 432 | |
| 433 | |
| 434 | void SLIDERPAINTER_deletecxx . . $ SLIDERPAINTER_delete(8b7a4a0b4199d9a1).(SliderPaintercxx . . $ SliderPainter# *painter){ |
| 435 | delete painter; |
| 436 | } |
| 437 | |
| 438 | void SLIDERPAINTER_setValuecxx . . $ SLIDERPAINTER_setValue(505cf284400e684c).(SliderPaintercxx . . $ SliderPainter# *painter, int value){ |
| 439 | painter->_valuecxx . . $ SliderPainter#_value. = value; |
| 440 | } |
| 441 | |
| 442 | void SLIDERPAINTER_set_num_channelscxx . . $ SLIDERPAINTER_set_num_channels(505cf284400e684c).(SliderPaintercxx . . $ SliderPainter# *painter, int num_channels){ |
| 443 | painter->_num_channelscxx . . $ SliderPainter#_num_channels. = num_channels; |
| 444 | } |
| 445 | |
| 446 | void SLIDERPAINTER_paintcxx . . $ SLIDERPAINTER_paint(cc527f67641552e1).(SliderPaintercxx . . $ SliderPainter# *painter, QPaintercxx . . $ QPainter# *p){ |
| 447 | painter->paintcxx . . $ SliderPainter#paint(c81d535d1ac9d52).(p); |
| 448 | } |
| 449 | |
| 450 | float *SLIDERPAINTER_obtain_peak_value_pointerscxx . . $ SLIDERPAINTER_obtain_peak_value_pointers(518bd43f8666251c).(SliderPaintercxx . . $ SliderPainter# *painter, int num_channels){ |
| 451 | return painter->obtain_peak_value_pointerscxx . . $ SliderPainter#obtain_peak_value_pointers(53bda2b791433d40).(num_channels,NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 452 | } |
| 453 | |
| 454 | void SLIDERPAINTER_set_peak_value_pointerscxx . . $ SLIDERPAINTER_set_peak_value_pointers(c94e3ca28f34c07e).(SliderPaintercxx . . $ SliderPainter# *painter, int num_channels, float *pointers){ |
| 455 | painter->set_peak_value_pointerscxx . . $ SliderPainter#set_peak_value_pointers(b7bdbdc5370467be).(num_channels, pointers); |
| 456 | } |
| 457 | |
| 458 | float *SLIDERPAINTER_obtain_automation_value_pointercxx . . $ SLIDERPAINTER_obtain_automation_value_pointer(aad2bf8cd6d872e9).(SliderPaintercxx . . $ SliderPainter# *painter){ |
| 459 | return painter->obtain_automation_value_pointercxx . . $ SliderPainter#obtain_automation_value_pointer(a3aba87f01dec7c2).(); |
| 460 | } |
| 461 | int *SLIDERPAINTER_obtain_automation_color_pointercxx . . $ SLIDERPAINTER_obtain_automation_color_pointer(e3411dab2b8a1c7).(SliderPaintercxx . . $ SliderPainter# *painter){ |
| 462 | return painter->obtain_automation_color_pointercxx . . $ SliderPainter#obtain_automation_color_pointer(a7741f82f5fc3640).(); |
| 463 | } |
| 464 | void SLIDERPAINTER_release_automation_pointerscxx . . $ SLIDERPAINTER_release_automation_pointers(8b7a4a0b4199d9a1).(SliderPaintercxx . . $ SliderPainter# *painter){ |
| 465 | painter->release_automation_pointerscxx . . $ SliderPainter#release_automation_pointers(49f6e7a06ebc5aa8).(); |
| 466 | } |
| 467 | |
| 468 | // Used for chips where the slider controls input volume instead of output volume. |
| 469 | void SLIDERPAINTER_set_alternative_colorcxx . . $ SLIDERPAINTER_set_alternative_color(8b7a4a0b4199d9a1).(SliderPaintercxx . . $ SliderPainter# *painter){ |
| 470 | painter->_alternative_colorcxx . . $ SliderPainter#_alternative_color. = true; |
| 471 | } |
| 472 | |
| 473 | void SLIDERPAINTER_set_stringcxx . . $ SLIDERPAINTER_set_string(f94ce0ad34af9600).(SliderPaintercxx . . $ SliderPainter# *painter,QStringcxx . . $ QString# string){ |
| 474 | painter->_display_stringcxx . . $ SliderPainter#_display_string. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). string; |
| 475 | } |
| 476 | |
| 477 | QStringcxx . . $ QString# SLIDERPAINTER_get_stringcxx . . $ SLIDERPAINTER_get_string(c5f73693511090ef).(SliderPaintercxx . . $ SliderPainter# *painter){ |
| 478 | return paintercxx . . $ QString#QString(132dd6869045752b).->_display_stringcxx . . $ SliderPainter#_display_string.; |
| 479 | } |