mirror of
https://github.com/ZDoom/qzdoom-gpl.git
synced 2024-11-17 17:50:57 +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;
|
||||
#ifdef HAVE_MPG123
|
||||
decoder = new MPG123Decoder;
|
||||
if(!decoder->open((const char*)sfxdata, length))
|
||||
{
|
||||
delete decoder;
|
||||
decoder = NULL;
|
||||
}
|
||||
if(decoder->open((const char*)sfxdata, length))
|
||||
return decoder;
|
||||
|
||||
delete decoder;
|
||||
decoder = NULL;
|
||||
#endif
|
||||
#ifdef HAVE_SNDFILE
|
||||
if(!decoder)
|
||||
{
|
||||
decoder = new SndFileDecoder;
|
||||
if(!decoder->open((const char*)sfxdata, length))
|
||||
{
|
||||
delete decoder;
|
||||
decoder = NULL;
|
||||
}
|
||||
}
|
||||
decoder = new SndFileDecoder;
|
||||
if(decoder->open((const char*)sfxdata, length))
|
||||
return decoder;
|
||||
|
||||
delete decoder;
|
||||
decoder = NULL;
|
||||
#endif
|
||||
return decoder;
|
||||
}
|
||||
|
@ -568,19 +565,19 @@ SoundDecoder* SoundRenderer::CreateDecoder(const char *fname, int offset, int le
|
|||
SoundDecoder *decoder = NULL;
|
||||
#ifdef HAVE_MPG123
|
||||
decoder = new MPG123Decoder;
|
||||
if(!decoder->open(fname, offset, length))
|
||||
{
|
||||
delete decoder;
|
||||
decoder = NULL;
|
||||
}
|
||||
if(decoder->open(fname, offset, length))
|
||||
return decoder;
|
||||
|
||||
delete decoder;
|
||||
decoder = NULL;
|
||||
#endif
|
||||
#ifdef HAVE_SNDFILE
|
||||
decoder = new SndFileDecoder;
|
||||
if(!decoder->open(fname, offset, length))
|
||||
{
|
||||
delete decoder;
|
||||
decoder = NULL;
|
||||
}
|
||||
if(decoder->open(fname, offset, length))
|
||||
return decoder;
|
||||
|
||||
delete decoder;
|
||||
decoder = NULL;
|
||||
#endif
|
||||
return decoder;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue