From b1081c63e5bbd1a80845d3ede27835114b77d35a Mon Sep 17 00:00:00 2001 From: Lynix Date: Sat, 13 Jun 2015 17:23:45 +0200 Subject: [PATCH] More VS fixes Former-commit-id: 7b613049d581c62ccefd3b63938e51571a04fa8f --- include/Nazara/Audio/SoundStream.hpp | 4 ++-- src/Nazara/Audio/Audio.cpp | 2 +- src/Nazara/Audio/Formats/sndfileLoader.cpp | 28 +++++++++++----------- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/include/Nazara/Audio/SoundStream.hpp b/include/Nazara/Audio/SoundStream.hpp index c3bb47eb7..dfb637f59 100644 --- a/include/Nazara/Audio/SoundStream.hpp +++ b/include/Nazara/Audio/SoundStream.hpp @@ -18,8 +18,8 @@ class NAZARA_API NzSoundStream virtual nzUInt32 GetDuration() const = 0; virtual nzAudioFormat GetFormat() const = 0; - virtual unsigned int GetSampleCount() const = 0; - virtual unsigned int GetSampleRate() const = 0; + virtual nzUInt64 GetSampleCount() const = 0; + virtual nzUInt32 GetSampleRate() const = 0; virtual unsigned int Read(void* buffer, unsigned int sampleCount) = 0; virtual void Seek(nzUInt32 offset) = 0; diff --git a/src/Nazara/Audio/Audio.cpp b/src/Nazara/Audio/Audio.cpp index 6b539a33a..ef1481e50 100644 --- a/src/Nazara/Audio/Audio.cpp +++ b/src/Nazara/Audio/Audio.cpp @@ -7,7 +7,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/Nazara/Audio/Formats/sndfileLoader.cpp b/src/Nazara/Audio/Formats/sndfileLoader.cpp index 012b2258e..5d260f79b 100644 --- a/src/Nazara/Audio/Formats/sndfileLoader.cpp +++ b/src/Nazara/Audio/Formats/sndfileLoader.cpp @@ -81,12 +81,12 @@ namespace sf_close(m_handle); } - nzUInt32 GetDuration() const + nzUInt32 GetDuration() const override { return m_duration; } - nzAudioFormat GetFormat() const + nzAudioFormat GetFormat() const override { // Nous avons besoin du nombre de canaux d'origine pour convertir en mono, nous trichons donc un peu... if (m_mixToMono) @@ -95,12 +95,12 @@ namespace return m_format; } - unsigned int GetSampleCount() const + nzUInt64 GetSampleCount() const override { return m_sampleCount; } - unsigned int GetSampleRate() const + nzUInt32 GetSampleRate() const override { return m_sampleRate; } @@ -138,7 +138,7 @@ namespace return false; } - // Un peu de RAII + // Un peu de RRID NzCallOnExit onExit([this] { sf_close(m_handle); @@ -156,7 +156,7 @@ namespace m_sampleRate = infos.samplerate; // Durée de la musique (s) = samples / channels*rate - m_duration = 1000*m_sampleCount / (m_format*m_sampleRate); + m_duration = static_cast(1000*m_sampleCount / (m_format*m_sampleRate)); // https://github.com/LaurentGomila/SFML/issues/271 // http://www.mega-nerd.com/libsndfile/command.html#SFC_SET_SCALE_FLOAT_INT_READ @@ -184,17 +184,17 @@ namespace if (m_mixToMono) { // On garde un buffer sur le côté pour éviter la réallocation - m_mixBuffer.resize(m_format*sampleCount); - unsigned int readSampleCount = sf_read_short(m_handle, m_mixBuffer.data(), m_format*sampleCount); + m_mixBuffer.resize(m_format * sampleCount); + sf_count_t readSampleCount = sf_read_short(m_handle, m_mixBuffer.data(), m_format * sampleCount); NzMixToMono(m_mixBuffer.data(), static_cast(buffer), m_format, sampleCount); - return readSampleCount / m_format; + return static_cast(readSampleCount / m_format); } else - return sf_read_short(m_handle, static_cast(buffer), sampleCount); + return static_cast(sf_read_short(m_handle, static_cast(buffer), sampleCount)); } - void Seek(nzUInt32 offset) + void Seek(nzUInt32 offset) override { sf_seek(m_handle, offset*m_sampleRate / 1000, SEEK_SET); } @@ -205,9 +205,9 @@ namespace nzAudioFormat m_format; SNDFILE* m_handle; bool m_mixToMono; - unsigned int m_duration; - unsigned int m_sampleCount; - unsigned int m_sampleRate; + nzUInt32 m_duration; + nzUInt64 m_sampleCount; + nzUInt32 m_sampleRate; }; bool IsSupported(const NzString& extension)