MCPcopy Create free account
hub / github.com/adamstark/AudioFile / unsignedByteToSample

Method unsignedByteToSample

AudioFile.h:1496–1509  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1494//=============================================================
1495template <class T>
1496T AudioSampleConverter<T>::unsignedByteToSample (uint8_t sample)
1497{
1498 if constexpr (std::is_floating_point<T>::value)
1499 {
1500 return static_cast<T> (sample - 128) / static_cast<T> (127.);
1501 }
1502 else if (std::numeric_limits<T>::is_integer)
1503 {
1504 if constexpr (std::is_unsigned_v<T>)
1505 return static_cast<T> (sample);
1506 else
1507 return static_cast<T> (sample - 128);
1508 }
1509}
1510
1511//=============================================================
1512template <class T>

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected