diff --git a/sflphone-common/src/audio/audioloop.h b/sflphone-common/src/audio/audioloop.h index 4d1ceece8dfc33a23e924f900e9a0ad9f32cf77c..b68a139d86882a17df59645b5803ffb2c8c91637 100644 --- a/sflphone-common/src/audio/audioloop.h +++ b/sflphone-common/src/audio/audioloop.h @@ -91,7 +91,7 @@ class AudioLoop int _pos; /** Sample rate */ - int _sampleRate; + unsigned int _sampleRate; private: diff --git a/sflphone-common/src/audio/sound/audiofile.cpp b/sflphone-common/src/audio/sound/audiofile.cpp index 66c61ca7f308c233bce4265ddf4e3fba7106b7fe..f5e8ecdf6cc4aed2c51fed21fcdc690ab34f47df 100644 --- a/sflphone-common/src/audio/sound/audiofile.cpp +++ b/sflphone-common/src/audio/sound/audiofile.cpp @@ -58,23 +58,18 @@ RawFile::~RawFile() // load file in mono format void RawFile::loadFile (const std::string& name, sfl::AudioCodec* codec, unsigned int sampleRate = 8000) throw(AudioFileException) { - _debug("RawFile: Load new file %s", name.c_str()); - audioCodec = codec; // if the filename was already load, with the same samplerate // we do nothing - - if ((filepath == name) && (_sampleRate == (int)sampleRate)) { - return; - } + if (filepath == name && _sampleRate == sampleRate) + return; filepath = name; // no filename to load - if (filepath.empty()) { + if (filepath.empty()) throw AudioFileException("Unable to open audio file: filename is empty"); - } std::fstream file; @@ -185,7 +180,7 @@ WaveFile::~WaveFile() -void WaveFile::openFile (const std::string& fileName, int audioSamplingRate) throw(AudioFileException) +void WaveFile::openFile (const std::string& fileName, unsigned int audioSamplingRate) throw(AudioFileException) { try { @@ -213,7 +208,7 @@ bool WaveFile::isFileExist (const std::string& fileName) } -void WaveFile::openExistingWaveFile (const std::string& fileName, int audioSamplingRate) throw(AudioFileException) +void WaveFile::openExistingWaveFile (const std::string& fileName, unsigned int audioSamplingRate) throw(AudioFileException) { int maxIteration = 0; @@ -398,7 +393,7 @@ void WaveFile::openExistingWaveFile (const std::string& fileName, int audioSampl } _size = nbSample; - _sampleRate = (int) audioSamplingRate; + _sampleRate = audioSamplingRate; // Copy audio into audioloopi if (srate != audioSamplingRate) { diff --git a/sflphone-common/src/audio/sound/audiofile.h b/sflphone-common/src/audio/sound/audiofile.h index 07195cb6738b677bfe323672580230608e148f32..0e6de14abad9cc1a8f3fc9d9ec90649fa9d32124 100644 --- a/sflphone-common/src/audio/sound/audiofile.h +++ b/sflphone-common/src/audio/sound/audiofile.h @@ -161,7 +161,7 @@ class WaveFile : public AudioFile * @param The internal sampling rate, file will be resampled * if it's sampling rate does not correspond to internal one */ - void openFile (const std::string&, int) throw(AudioFileException); + void openFile (const std::string&, unsigned int) throw(AudioFileException); /** * Test if the specified file already exist @@ -184,7 +184,7 @@ class WaveFile : public AudioFile * @param File name * @param Audio sampling rate */ - void openExistingWaveFile (const std::string&, int) throw(AudioFileException); + void openExistingWaveFile (const std::string&, unsigned int) throw(AudioFileException); /** * Sound format for this file (16/32 bits)