| 1404 | //============================================================= |
| 1405 | template <class T> |
| 1406 | int32_t AudioSampleConverter<T>::sampleToTwentyFourBitInt (T sample) |
| 1407 | { |
| 1408 | if constexpr (std::is_floating_point<T>::value) |
| 1409 | { |
| 1410 | sample = clamp (sample, -1., 1.); |
| 1411 | return static_cast<int32_t> (sample * static_cast<T> (8388607.)); |
| 1412 | } |
| 1413 | else |
| 1414 | { |
| 1415 | if constexpr (std::is_signed_v<T>) |
| 1416 | return static_cast<int32_t> (clamp (sample, SignedInt24_Min, SignedInt24_Max)); |
| 1417 | else |
| 1418 | return static_cast<int32_t> (clamp (sample, UnsignedInt24_Min, UnsignedInt24_Max) + SignedInt24_Min); |
| 1419 | } |
| 1420 | } |
| 1421 | |
| 1422 | //============================================================= |
| 1423 | template <class T> |
nothing calls this directly
no outgoing calls
no test coverage detected