Mercurial > SDL_sound_CoreAudio
comparison decoders/shn.c @ 212:8c2cb920a383
Changed the magic number macro to be more uniform with other decoders.
author | Ryan C. Gordon <icculus@icculus.org> |
---|---|
date | Sun, 13 Jan 2002 19:46:04 +0000 |
parents | 47cc2de2ae36 |
children | c9772a9f5271 |
comparison
equal
deleted
inserted
replaced
211:b35c04e4691e | 212:8c2cb920a383 |
---|---|
213 #define SHN_BITSHIFTSIZE 2 | 213 #define SHN_BITSHIFTSIZE 2 |
214 | 214 |
215 #define SHN_LPCQOFFSET_VER2 (1 << SHN_LPCQUANT) | 215 #define SHN_LPCQOFFSET_VER2 (1 << SHN_LPCQUANT) |
216 | 216 |
217 | 217 |
218 #define MAGIC_NUM 0x676B6A61 /* looks like "ajkg" as chars. */ | 218 #define SHN_MAGIC 0x676B6A61 /* looks like "ajkg" as chars. */ |
219 | 219 |
220 #ifndef M_LN2 | 220 #ifndef M_LN2 |
221 #define M_LN2 0.69314718055994530942 | 221 #define M_LN2 0.69314718055994530942 |
222 #endif | 222 #endif |
223 | 223 |
355 | 355 |
356 while (1) | 356 while (1) |
357 { | 357 { |
358 BAIL_IF_MACRO(SDL_RWread(rw, &ch, sizeof (ch), 1) != 1, NULL, -1); | 358 BAIL_IF_MACRO(SDL_RWread(rw, &ch, sizeof (ch), 1) != 1, NULL, -1); |
359 word = ((word << 8) & 0xFFFFFF00) | ch; | 359 word = ((word << 8) & 0xFFFFFF00) | ch; |
360 if (SDL_SwapBE32(word) == MAGIC_NUM) | 360 if (SDL_SwapBE32(word) == SHN_MAGIC) |
361 { | 361 { |
362 BAIL_IF_MACRO(SDL_RWread(rw, &ch, sizeof (ch), 1) != 1, NULL, -1); | 362 BAIL_IF_MACRO(SDL_RWread(rw, &ch, sizeof (ch), 1) != 1, NULL, -1); |
363 return((int) ch); | 363 return((int) ch); |
364 } /* if */ | 364 } /* if */ |
365 } /* while */ | 365 } /* while */ |
385 | 385 |
386 if (__Sound_strcasecmp(ext, "shn") == 0) | 386 if (__Sound_strcasecmp(ext, "shn") == 0) |
387 return(extended_shn_magic_search(sample)); | 387 return(extended_shn_magic_search(sample)); |
388 | 388 |
389 BAIL_IF_MACRO(SDL_RWread(rw, &magic, sizeof (magic), 1) != 1, NULL, -1); | 389 BAIL_IF_MACRO(SDL_RWread(rw, &magic, sizeof (magic), 1) != 1, NULL, -1); |
390 BAIL_IF_MACRO(SDL_SwapLE32(magic) != MAGIC_NUM, "SHN: Not a SHN file", -1); | 390 BAIL_IF_MACRO(SDL_SwapLE32(magic) != SHN_MAGIC, "SHN: Not a SHN file", -1); |
391 BAIL_IF_MACRO(SDL_RWread(rw, &ch, sizeof (ch), 1) != 1, NULL, -1); | 391 BAIL_IF_MACRO(SDL_RWread(rw, &ch, sizeof (ch), 1) != 1, NULL, -1); |
392 BAIL_IF_MACRO(ch > 3, "SHN: Unsupported file version", -1); | 392 BAIL_IF_MACRO(ch > 3, "SHN: Unsupported file version", -1); |
393 | 393 |
394 return((int) ch); | 394 return((int) ch); |
395 } /* determine_shn_version */ | 395 } /* determine_shn_version */ |