Mercurial > hg > svgui
comparison widgets/Fader.cpp @ 946:36cddc3de023 alignment_view
Merge from default branch
author | Chris Cannam |
---|---|
date | Mon, 20 Apr 2015 09:19:52 +0100 |
parents | 4a578a360011 |
children | a34a2a25907c |
comparison
equal
deleted
inserted
replaced
897:499b637f2a26 | 946:36cddc3de023 |
---|---|
108 vx += diff; | 108 vx += diff; |
109 | 109 |
110 if (vx > getMaxX()) vx = getMaxX(); | 110 if (vx > getMaxX()) vx = getMaxX(); |
111 if (vx < 0) vx = 0; | 111 if (vx < 0) vx = 0; |
112 | 112 |
113 float fval = AudioLevel::fader_to_multiplier | 113 float fval = (float)AudioLevel::fader_to_multiplier |
114 (vx, getMaxX(), AudioLevel::LongFader); | 114 (vx, getMaxX(), AudioLevel::LongFader); |
115 | 115 |
116 setValue(fval); | 116 setValue(fval); |
117 emit valueChanged(fval); | 117 emit valueChanged(fval); |
118 ev->accept(); | 118 ev->accept(); |
130 | 130 |
131 void | 131 void |
132 Fader::mouseDoubleClickEvent(QMouseEvent *) | 132 Fader::mouseDoubleClickEvent(QMouseEvent *) |
133 { | 133 { |
134 bool ok = false; | 134 bool ok = false; |
135 float min = AudioLevel::fader_to_dB | 135 float min = (float)AudioLevel::fader_to_dB |
136 (0, getMaxX(), AudioLevel::LongFader); | 136 (0, getMaxX(), AudioLevel::LongFader); |
137 float max = AudioLevel::fader_to_dB | 137 float max = (float)AudioLevel::fader_to_dB |
138 (getMaxX(), getMaxX(), AudioLevel::LongFader); | 138 (getMaxX(), getMaxX(), AudioLevel::LongFader); |
139 float deft = AudioLevel::multiplier_to_dB(m_value); | 139 float deft = (float)AudioLevel::multiplier_to_dB(m_value); |
140 | 140 |
141 float dB = QInputDialog::getDouble | 141 float dB = (float)QInputDialog::getDouble |
142 (this, | 142 (this, |
143 tr("Enter new fader level"), | 143 tr("Enter new fader level"), |
144 tr("New fader level, from %1 to %2 dBFS:").arg(min).arg(max), | 144 tr("New fader level, from %1 to %2 dBFS:").arg(min).arg(max), |
145 deft, min, max, 3, &ok); | 145 deft, min, max, 3, &ok); |
146 | 146 |
147 if (ok) { | 147 if (ok) { |
148 float value = AudioLevel::dB_to_multiplier(dB); | 148 float value = (float)AudioLevel::dB_to_multiplier(dB); |
149 setValue(value); | 149 setValue(value); |
150 emit valueChanged(value); | 150 emit valueChanged(value); |
151 update(); | 151 update(); |
152 } | 152 } |
153 } | 153 } |
177 ev->accept(); | 177 ev->accept(); |
178 | 178 |
179 //!!! needs improvement | 179 //!!! needs improvement |
180 | 180 |
181 if (ev->delta() > 0) { | 181 if (ev->delta() > 0) { |
182 setValue(m_value * 1.1); | 182 setValue(m_value * 1.f); |
183 } else { | 183 } else { |
184 setValue(m_value / 1.1); | 184 setValue(m_value / 1.f); |
185 } | 185 } |
186 | 186 |
187 update(); | 187 update(); |
188 emit valueChanged(getValue()); | 188 emit valueChanged(getValue()); |
189 } | 189 } |
201 } | 201 } |
202 | 202 |
203 void | 203 void |
204 Fader::setValue(float v) | 204 Fader::setValue(float v) |
205 { | 205 { |
206 float max = AudioLevel::dB_to_multiplier(10.0); | 206 float max = (float)AudioLevel::dB_to_multiplier(10.0); |
207 | 207 |
208 if (v > max) { | 208 if (v > max) { |
209 v = max; | 209 v = max; |
210 } else if (v < 0.0) { | 210 } else if (v < 0.0) { |
211 v = 0.0; | 211 v = 0.0; |
212 } | 212 } |
213 | 213 |
214 if (m_value != v) { | 214 if (m_value != v) { |
215 m_value = v; | 215 m_value = v; |
216 float db = AudioLevel::multiplier_to_dB(m_value); | 216 float db = (float)AudioLevel::multiplier_to_dB(m_value); |
217 QString text; | 217 QString text; |
218 if (db <= AudioLevel::DB_FLOOR) { | 218 if (db <= AudioLevel::DB_FLOOR) { |
219 text = tr("Level: Off"); | 219 text = tr("Level: Off"); |
220 } else { | 220 } else { |
221 text = tr("Level: %1%2.%3%4 dB") | 221 text = tr("Level: %1%2.%3%4 dB") |