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

Method thirtyTwoBitIntToSample

AudioFile.h:1340–1353  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1338//=============================================================
1339template <class T>
1340T AudioSampleConverter<T>::thirtyTwoBitIntToSample (int32_t sample)
1341{
1342 if constexpr (std::is_floating_point<T>::value)
1343 {
1344 return static_cast<T> (sample) / static_cast<T> (std::numeric_limits<int32_t>::max());
1345 }
1346 else if (std::numeric_limits<T>::is_integer)
1347 {
1348 if constexpr (std::is_signed_v<T>)
1349 return static_cast<T> (sample);
1350 else
1351 return static_cast<T> (clamp (static_cast<T> (sample + 2147483648), 0, 4294967295));
1352 }
1353}
1354
1355//=============================================================
1356template <class T>

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected