From f030154fe727e25a2afe1f78b3998c2d2dba95e4 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Tue, 18 Aug 2009 09:24:15 +0000 Subject: astyle cleanup, corrects not loading of material textures --- src/audio/wav.cc | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'src/audio/wav.cc') diff --git a/src/audio/wav.cc b/src/audio/wav.cc index 178f199..b6ca710 100644 --- a/src/audio/wav.cc +++ b/src/audio/wav.cc @@ -5,7 +5,7 @@ */ /* -see +see http://ccrma.stanford.edu/CCRMA/Courses/422/projects/WaveFormat/ */ @@ -19,7 +19,8 @@ http://ccrma.stanford.edu/CCRMA/Courses/422/projects/WaveFormat/ #include "filesystem/filesystem.h" #include "sys/sys.h" -namespace audio { +namespace audio +{ PCM *Wav::load(std::string const & name) { @@ -29,7 +30,7 @@ PCM *Wav::load(std::string const & name) std::string filename("sounds/"); filename.append(name); filename.append(".wav"); - + filesystem::File *wav_file = filesystem::open(filename.c_str()); if (!wav_file) { con_warn << "Could not open " << filename << std::endl; @@ -52,7 +53,7 @@ PCM *Wav::load(std::string const & name) } // format WAVE - if (strncmp((char *)header+8, "WAVE", 4) != 0) { + if (strncmp((char *)header + 8, "WAVE", 4) != 0) { con_warn << "Error reading " << filename << ": invalid WAVE header!" << std::endl; filesystem::close(wav_file); return 0; @@ -61,7 +62,7 @@ PCM *Wav::load(std::string const & name) // file size //size_t chunksize = header[4] + (header[5] << 8) + (header[6] << 16) + (header[7] << 24); - if (strncmp((char *)header+12, "fmt ", 4) != 0) { + if (strncmp((char *)header + 12, "fmt ", 4) != 0) { con_warn << "Error reading " << filename << ": invalid format header!" << std::endl; filesystem::close(wav_file); return 0; @@ -78,7 +79,7 @@ PCM *Wav::load(std::string const & name) } unsigned int channels = header[22] + (header[23] << 8); - if ((channels < 1) || (channels >2)) { + if ((channels < 1) || (channels > 2)) { con_warn << "Error reading " << filename << ": invalid number of channels!" << std::endl; filesystem::close(wav_file); return 0; @@ -89,7 +90,7 @@ PCM *Wav::load(std::string const & name) //size_t blockalign = header[32] + (header[33] << 8); size_t bitspersample = header[34] + (header[35] << 8); - if (strncmp((char *)header + 36, "data", 4) !=0) { + if (strncmp((char *)header + 36, "data", 4) != 0) { con_warn << "Error reading " << filename << ": invalid data header!" << std::endl; filesystem::close(wav_file); return 0; @@ -109,8 +110,8 @@ PCM *Wav::load(std::string const & name) con_warn << "Error reading " << filename << ": file truncated!" << std::endl; } - con_debug << " " << filename << " " << pcm->samplerate()<< "Hz " << pcm->bitspersample() << "bit " << - pcm->channels() << " chan " << pcm->size() << " bytes" << std::endl; + con_debug << " " << filename << " " << pcm->samplerate() << "Hz " << pcm->bitspersample() << "bit " << + pcm->channels() << " chan " << pcm->size() << " bytes" << std::endl; filesystem::close(wav_file); return pcm; -- cgit v1.2.3