LibAudio: Make AudioLoaders return float instead of double

AudioBuffers already use floats internally so there is no need for
loaders to produces doubles
This commit is contained in:
2026-07-02 19:55:12 +03:00
parent 4473ee4d49
commit 0a8b03d349
3 changed files with 6 additions and 6 deletions

View File

@@ -105,17 +105,17 @@ namespace LibAudio
}
template<typename T>
static double read_sample(BAN::ConstByteSpan data)
static float read_sample(BAN::ConstByteSpan data)
{
if constexpr(BAN::is_same_v<float, T> || BAN::is_same_v<double, T>)
return data.as<const T>();
else if constexpr(BAN::is_signed_v<T>)
return data.as<const T>() / static_cast<double>(BAN::numeric_limits<T>::max());
return data.as<const T>() / static_cast<float>(BAN::numeric_limits<T>::max());
else
return data.as<const T>() / (BAN::numeric_limits<T>::max() / 2.0) - 1.0;
return data.as<const T>() / (BAN::numeric_limits<T>::max() / 2.0f) - 1.0f;
}
double WAVAudioLoader::get_sample()
float WAVAudioLoader::get_sample()
{
ASSERT(samples_remaining() > 0);