| 230 | } |
| 231 | |
| 232 | qint32 Utils::floatToInt24(float f) |
| 233 | { |
| 234 | // Limit the input |
| 235 | if (f > 1.0f) |
| 236 | f = 1.0f; |
| 237 | else if (f < -1.0f) |
| 238 | f = -1.0f; |
| 239 | |
| 240 | f = f * 8388607.5f /*(.5f + 0x7FFFFF)*/ - .5f; |
| 241 | qint32 result = static_cast<qint32>(f + (f > 0 ? 0.5f : -0.5f)); |
| 242 | |
| 243 | // Limit the output |
| 244 | if (result > 8388607) |
| 245 | return 8388607; |
| 246 | else if (result < -8388608) |
| 247 | return -8388608; |
| 248 | |
| 249 | return result; |
| 250 | } |
| 251 | |
| 252 | float Utils::int24ToFloat(qint32 i) |
| 253 | { |
nothing calls this directly
no outgoing calls
no test coverage detected