mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-26 03:30:46 +00:00
jaudiolib: don't attempt audio format auto-detection for less than 12 bytes.
git-svn-id: https://svn.eduke32.com/eduke32@4263 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
b6e9c0b409
commit
0ab2814f2e
1 changed files with 6 additions and 3 deletions
|
@ -874,8 +874,11 @@ int32_t FX_StartDemandFeedPlayback
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static wavedata FX_AutoDetectFormat(const char *ptr)
|
static wavedata FX_AutoDetectFormat(const char *ptr, uint32_t length)
|
||||||
{
|
{
|
||||||
|
if (length < 12)
|
||||||
|
return Unknown;
|
||||||
|
|
||||||
switch (LITTLE32(*(int32_t *)ptr))
|
switch (LITTLE32(*(int32_t *)ptr))
|
||||||
{
|
{
|
||||||
case 'C'+('r'<<8)+('e'<<16)+('a'<<24): // Crea
|
case 'C'+('r'<<8)+('e'<<16)+('a'<<24): // Crea
|
||||||
|
@ -925,7 +928,7 @@ int32_t FX_PlayLoopedAuto(char *ptr, uint32_t length, int32_t loopstart, int32_t
|
||||||
{
|
{
|
||||||
int32_t handle = -1;
|
int32_t handle = -1;
|
||||||
|
|
||||||
switch (FX_AutoDetectFormat(ptr))
|
switch (FX_AutoDetectFormat(ptr, length))
|
||||||
{
|
{
|
||||||
case VOC:
|
case VOC:
|
||||||
handle = MV_PlayVOC(ptr, length, loopstart, loopend, pitchoffset, vol, left, right, priority, callbackval);
|
handle = MV_PlayVOC(ptr, length, loopstart, loopend, pitchoffset, vol, left, right, priority, callbackval);
|
||||||
|
@ -973,7 +976,7 @@ int32_t FX_PlayAuto3D(char *ptr, uint32_t length, int32_t loophow, int32_t pitch
|
||||||
{
|
{
|
||||||
int32_t handle = -1;
|
int32_t handle = -1;
|
||||||
|
|
||||||
switch (FX_AutoDetectFormat(ptr))
|
switch (FX_AutoDetectFormat(ptr, length))
|
||||||
{
|
{
|
||||||
case VOC:
|
case VOC:
|
||||||
handle = MV_PlayVOC3D(ptr, length, loophow, pitchoffset, angle, distance, priority, callbackval);
|
handle = MV_PlayVOC3D(ptr, length, loophow, pitchoffset, angle, distance, priority, callbackval);
|
||||||
|
|
Loading…
Reference in a new issue