| 1439 | //============================================================= |
| 1440 | template <class T> |
| 1441 | int16_t AudioSampleConverter<T>::sampleToSixteenBitInt (T sample) |
| 1442 | { |
| 1443 | if constexpr (std::is_floating_point<T>::value) |
| 1444 | { |
| 1445 | sample = clamp (sample, -1., 1.); |
| 1446 | return static_cast<int16_t> (sample * static_cast<T> (32767.)); |
| 1447 | } |
| 1448 | else |
| 1449 | { |
| 1450 | if constexpr (std::is_signed_v<T>) |
| 1451 | return static_cast<int16_t> (clamp (sample, SignedInt16_Min, SignedInt16_Max)); |
| 1452 | else |
| 1453 | return static_cast<int16_t> (clamp (sample, UnsignedInt16_Min, UnsignedInt16_Max) + SignedInt16_Min); |
| 1454 | } |
| 1455 | } |
| 1456 | |
| 1457 | //============================================================= |
| 1458 | template <class T> |
nothing calls this directly
no outgoing calls
no test coverage detected