Skip to content
Snippets Groups Projects
Commit f5689d28 authored by Rafaël Carré's avatar Rafaël Carré
Browse files

audiofile: cleanup (samplerate -> unsigned)

parent 63388c99
No related branches found
No related tags found
No related merge requests found
...@@ -91,7 +91,7 @@ class AudioLoop ...@@ -91,7 +91,7 @@ class AudioLoop
int _pos; int _pos;
/** Sample rate */ /** Sample rate */
int _sampleRate; unsigned int _sampleRate;
private: private:
......
...@@ -58,23 +58,18 @@ RawFile::~RawFile() ...@@ -58,23 +58,18 @@ RawFile::~RawFile()
// load file in mono format // load file in mono format
void RawFile::loadFile (const std::string& name, sfl::AudioCodec* codec, unsigned int sampleRate = 8000) throw(AudioFileException) 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; audioCodec = codec;
// if the filename was already load, with the same samplerate // if the filename was already load, with the same samplerate
// we do nothing // we do nothing
if (filepath == name && _sampleRate == sampleRate)
if ((filepath == name) && (_sampleRate == (int)sampleRate)) {
return; return;
}
filepath = name; filepath = name;
// no filename to load // no filename to load
if (filepath.empty()) { if (filepath.empty())
throw AudioFileException("Unable to open audio file: filename is empty"); throw AudioFileException("Unable to open audio file: filename is empty");
}
std::fstream file; std::fstream file;
...@@ -185,7 +180,7 @@ WaveFile::~WaveFile() ...@@ -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 { try {
...@@ -213,7 +208,7 @@ bool WaveFile::isFileExist (const std::string& fileName) ...@@ -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; int maxIteration = 0;
...@@ -398,7 +393,7 @@ void WaveFile::openExistingWaveFile (const std::string& fileName, int audioSampl ...@@ -398,7 +393,7 @@ void WaveFile::openExistingWaveFile (const std::string& fileName, int audioSampl
} }
_size = nbSample; _size = nbSample;
_sampleRate = (int) audioSamplingRate; _sampleRate = audioSamplingRate;
// Copy audio into audioloopi // Copy audio into audioloopi
if (srate != audioSamplingRate) { if (srate != audioSamplingRate) {
......
...@@ -161,7 +161,7 @@ class WaveFile : public AudioFile ...@@ -161,7 +161,7 @@ class WaveFile : public AudioFile
* @param The internal sampling rate, file will be resampled * @param The internal sampling rate, file will be resampled
* if it's sampling rate does not correspond to internal one * 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 * Test if the specified file already exist
...@@ -184,7 +184,7 @@ class WaveFile : public AudioFile ...@@ -184,7 +184,7 @@ class WaveFile : public AudioFile
* @param File name * @param File name
* @param Audio sampling rate * @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) * Sound format for this file (16/32 bits)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment