mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-24 21:11:39 +00:00
- fixed: Creating an OPL MIDI device can fail if no GENMIDI lump is found, and an exception is thrown. We need to handle this exception to prevent an abort.
This commit is contained in:
parent
9402bcf6cd
commit
e662e4321a
1 changed files with 11 additions and 1 deletions
|
@ -38,6 +38,7 @@
|
||||||
#include "templates.h"
|
#include "templates.h"
|
||||||
#include "doomdef.h"
|
#include "doomdef.h"
|
||||||
#include "m_swap.h"
|
#include "m_swap.h"
|
||||||
|
#include "doomerrors.h"
|
||||||
|
|
||||||
// MACROS ------------------------------------------------------------------
|
// MACROS ------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -277,7 +278,16 @@ MIDIDevice *MIDIStreamer::CreateMIDIDevice(EMidiDevice devtype) const
|
||||||
return new TimidityMIDIDevice;
|
return new TimidityMIDIDevice;
|
||||||
|
|
||||||
case MDEV_OPL:
|
case MDEV_OPL:
|
||||||
return new OPLMIDIDevice;
|
try
|
||||||
|
{
|
||||||
|
return new OPLMIDIDevice;
|
||||||
|
}
|
||||||
|
catch (CRecoverableError &err)
|
||||||
|
{
|
||||||
|
// The creation of an OPL MIDI device can abort with an error if no GENMIDI lump can be found.
|
||||||
|
Printf("Unable to create OPL MIDI device: %s\nFalling back to FModEx playback", err.GetMessage());
|
||||||
|
return new FMODMIDIDevice;
|
||||||
|
}
|
||||||
|
|
||||||
case MDEV_TIMIDITY:
|
case MDEV_TIMIDITY:
|
||||||
return new TimidityPPMIDIDevice;
|
return new TimidityPPMIDIDevice;
|
||||||
|
|
Loading…
Reference in a new issue