mirror of
https://github.com/ZDoom/qzdoom-gpl.git
synced 2024-11-18 01:51:40 +00:00
Cleanup creating decoders
This commit is contained in:
parent
9f493fca5f
commit
e2708c8b3e
1 changed files with 21 additions and 24 deletions
|
@ -543,22 +543,19 @@ SoundDecoder *SoundRenderer::CreateDecoder(const BYTE *sfxdata, int length)
|
||||||
SoundDecoder *decoder = NULL;
|
SoundDecoder *decoder = NULL;
|
||||||
#ifdef HAVE_MPG123
|
#ifdef HAVE_MPG123
|
||||||
decoder = new MPG123Decoder;
|
decoder = new MPG123Decoder;
|
||||||
if(!decoder->open((const char*)sfxdata, length))
|
if(decoder->open((const char*)sfxdata, length))
|
||||||
{
|
return decoder;
|
||||||
|
|
||||||
delete decoder;
|
delete decoder;
|
||||||
decoder = NULL;
|
decoder = NULL;
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_SNDFILE
|
#ifdef HAVE_SNDFILE
|
||||||
if(!decoder)
|
|
||||||
{
|
|
||||||
decoder = new SndFileDecoder;
|
decoder = new SndFileDecoder;
|
||||||
if(!decoder->open((const char*)sfxdata, length))
|
if(decoder->open((const char*)sfxdata, length))
|
||||||
{
|
return decoder;
|
||||||
|
|
||||||
delete decoder;
|
delete decoder;
|
||||||
decoder = NULL;
|
decoder = NULL;
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
return decoder;
|
return decoder;
|
||||||
}
|
}
|
||||||
|
@ -568,19 +565,19 @@ SoundDecoder* SoundRenderer::CreateDecoder(const char *fname, int offset, int le
|
||||||
SoundDecoder *decoder = NULL;
|
SoundDecoder *decoder = NULL;
|
||||||
#ifdef HAVE_MPG123
|
#ifdef HAVE_MPG123
|
||||||
decoder = new MPG123Decoder;
|
decoder = new MPG123Decoder;
|
||||||
if(!decoder->open(fname, offset, length))
|
if(decoder->open(fname, offset, length))
|
||||||
{
|
return decoder;
|
||||||
|
|
||||||
delete decoder;
|
delete decoder;
|
||||||
decoder = NULL;
|
decoder = NULL;
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_SNDFILE
|
#ifdef HAVE_SNDFILE
|
||||||
decoder = new SndFileDecoder;
|
decoder = new SndFileDecoder;
|
||||||
if(!decoder->open(fname, offset, length))
|
if(decoder->open(fname, offset, length))
|
||||||
{
|
return decoder;
|
||||||
|
|
||||||
delete decoder;
|
delete decoder;
|
||||||
decoder = NULL;
|
decoder = NULL;
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
return decoder;
|
return decoder;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue