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
int _pos;
/** Sample rate */
int _sampleRate;
unsigned int _sampleRate;
private:
......
......@@ -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)) {
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) {
......
......@@ -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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment