endianness for ogg vorbis

git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@1950 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
driAn
2008-05-13 19:17:30 +00:00
parent 8f1d24d57e
commit 5d615fcbf0
3 changed files with 9 additions and 2 deletions
+2 -2
View File
@@ -118,7 +118,7 @@ struct oggstream
int bitstream;
while(size < BUFSIZE)
{
long bytes = ov_read(&oggfile, pcm + size, BUFSIZE - size, 0, 2, 1, &bitstream);
long bytes = ov_read(&oggfile, pcm + size, BUFSIZE - size, isbigendian(), 2, 1, &bitstream);
if(bytes > 0) size += bytes;
else if (bytes < 0) return false;
else break; // done
@@ -242,7 +242,7 @@ struct sbuffer
if(!SDL_LoadWAV(file, &wavspec, &wavbuf, &wavlen)) continue;
ALenum format;
switch(wavspec.freq)
switch(wavspec.freq) // map format definitions from SDL to OpenAL
{
case AUDIO_U8: format = AL_FORMAT_STEREO8; break;
case AUDIO_S8: format = AL_FORMAT_MONO8; break;
+6
View File
@@ -263,3 +263,9 @@ void endianswap(void *memory, int stride, int length) // little endian as stor
p[stride-i-1] = t;
}
}
bool isbigendian()
{
long one = 1;
return !(*((char *)(&one)));
}
+1
View File
@@ -506,6 +506,7 @@ extern bool delfile(const char *path);
extern bool cmpb(void *b, int n, enet_uint32 c);
extern bool cmpf(char *fn, enet_uint32 c);
extern void endianswap(void *, int, int);
extern bool isbigendian();
#endif