Audio: Fix some type warning
Former-commit-id: 9ed6d64e771e77d03b91060823efb4236739914b [formerly 0efc1b14cd61f3d33fc642dbe4eb6bf05d58ec7e] [formerly dbc079525b48a2efb8a7917b4b376a318f8d5fae [formerly 7c202e02ac2a8b745208e1b852ff44d2169ebaf0]] Former-commit-id: 27a65bcbd5e499dcc741f76a5c0a31bc9ae09e60 [formerly 97ed7176fd1f0f906229d19e68aedc335a7ca420] Former-commit-id: 1779855a4f20dc4216648aaed59542fd8c6d7bc8
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
template<typename T> void MixToMono(T* input, T* output, unsigned int channelCount, unsigned int frameCount);
|
||||
template<typename T> void MixToMono(T* input, T* output, UInt32 channelCount, UInt64 frameCount);
|
||||
}
|
||||
|
||||
#include <Nazara/Audio/Algorithm.inl>
|
||||
|
||||
@@ -19,16 +19,16 @@ namespace Nz
|
||||
* \remark The input buffer may be the same as the output one
|
||||
*/
|
||||
template<typename T>
|
||||
void MixToMono(T* input, T* output, unsigned int channelCount, unsigned int frameCount)
|
||||
void MixToMono(T* input, T* output, UInt32 channelCount, UInt64 frameCount)
|
||||
{
|
||||
// To avoid overflow, we use, as an accumulator, a type which is large enough: (u)int 64 bits for integers, double for floatings
|
||||
typedef typename std::conditional<std::is_unsigned<T>::value, UInt64, Int64>::type BiggestInt;
|
||||
typedef typename std::conditional<std::is_integral<T>::value, BiggestInt, double>::type Biggest;
|
||||
|
||||
for (unsigned int i = 0; i < frameCount; ++i)
|
||||
for (UInt64 i = 0; i < frameCount; ++i)
|
||||
{
|
||||
Biggest acc = Biggest(0);
|
||||
for (unsigned int j = 0; j < channelCount; ++j)
|
||||
for (UInt32 j = 0; j < channelCount; ++j)
|
||||
acc += input[i * channelCount + j];
|
||||
|
||||
output[i] = static_cast<T>(acc / channelCount);
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace Nz
|
||||
UInt32 GetDuration() const;
|
||||
AudioFormat GetFormat() const;
|
||||
UInt32 GetPlayingOffset() const;
|
||||
UInt32 GetSampleCount() const;
|
||||
UInt64 GetSampleCount() const;
|
||||
UInt32 GetSampleRate() const;
|
||||
SoundStatus GetStatus() const;
|
||||
|
||||
|
||||
@@ -50,18 +50,18 @@ namespace Nz
|
||||
|
||||
public:
|
||||
SoundBuffer() = default;
|
||||
SoundBuffer(AudioFormat format, unsigned int sampleCount, unsigned int sampleRate, const Int16* samples);
|
||||
SoundBuffer(AudioFormat format, UInt64 sampleCount, UInt32 sampleRate, const Int16* samples);
|
||||
SoundBuffer(const SoundBuffer&) = delete;
|
||||
SoundBuffer(SoundBuffer&&) = delete;
|
||||
~SoundBuffer();
|
||||
|
||||
bool Create(AudioFormat format, unsigned int sampleCount, unsigned int sampleRate, const Int16* samples);
|
||||
bool Create(AudioFormat format, UInt64 sampleCount, UInt32 sampleRate, const Int16* samples);
|
||||
void Destroy();
|
||||
|
||||
UInt32 GetDuration() const;
|
||||
AudioFormat GetFormat() const;
|
||||
const Int16* GetSamples() const;
|
||||
UInt32 GetSampleCount() const;
|
||||
UInt64 GetSampleCount() const;
|
||||
UInt32 GetSampleRate() const;
|
||||
|
||||
bool IsValid() const;
|
||||
|
||||
@@ -21,11 +21,11 @@ namespace Nz
|
||||
|
||||
virtual UInt32 GetDuration() const = 0;
|
||||
virtual AudioFormat GetFormat() const = 0;
|
||||
virtual UInt32 GetSampleCount() const = 0;
|
||||
virtual UInt64 GetSampleCount() const = 0;
|
||||
virtual UInt32 GetSampleRate() const = 0;
|
||||
|
||||
virtual unsigned int Read(void* buffer, unsigned int sampleCount) = 0;
|
||||
virtual void Seek(UInt32 offset) = 0;
|
||||
virtual UInt64 Read(void* buffer, UInt64 sampleCount) = 0;
|
||||
virtual void Seek(UInt64 offset) = 0;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user