| 1476 | //============================================================= |
| 1477 | template <class T> |
| 1478 | int8_t AudioSampleConverter<T>::sampleToSignedByte (T sample) |
| 1479 | { |
| 1480 | if constexpr (std::is_floating_point<T>::value) |
| 1481 | { |
| 1482 | sample = clamp (sample, -1., 1.); |
| 1483 | return static_cast<int8_t> (sample * static_cast<T> (0x7F)); |
| 1484 | } |
| 1485 | else |
| 1486 | { |
| 1487 | if constexpr (std::is_signed_v<T>) |
| 1488 | return static_cast<int8_t> (clamp (sample, -128, 127)); |
| 1489 | else |
| 1490 | return static_cast<int8_t> (clamp (sample, 0, 255) - 128); |
| 1491 | } |
| 1492 | } |
| 1493 | |
| 1494 | //============================================================= |
| 1495 | template <class T> |
nothing calls this directly
no outgoing calls
no test coverage detected