#include "readwav.hxx"
#include <cassert>
+#include <cstdlib>
#include <zlib.h> // for gzXXX functions
uint8_t *d = (uint8_t *) b->data;
size_t newLength = b->length * 2;
int16_t *buf = (int16_t *) malloc(newLength);
- size_t i;
if (buf == NULL)
throw sg_exception("malloc failed decoing ULaw WAV file");
- for (i = 0; i < b->length; i++) {
+ for (ALsizei i = 0; i < b->length; i++) {
buf[i] = mulaw2linear(d[i]);
}
ALuint createBufferFromFile(const SGPath& path)
{
+ ALuint buffer = -1;
+#ifdef ENABLE_SOUND
ALenum format;
ALsizei size;
ALfloat sampleFrequency;
ALvoid* data = loadWAVFromFile(path, format, size, sampleFrequency);
assert(data);
- ALuint buffer;
alGenBuffers(1, &buffer);
if (alGetError() != AL_NO_ERROR) {
free(data);
free(data);
throw sg_io_exception("OpenAL setting buffer data failed", sg_location(path.str()));
}
-
+#endif
return buffer;
}