mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-11 07:12:16 +00:00
Fixed crash in MIDI to wave writer
This commit is contained in:
parent
6ab58e56ad
commit
7f17121df8
3 changed files with 10 additions and 5 deletions
|
@ -198,7 +198,7 @@ protected:
|
||||||
class MIDIWaveWriter : public SoftSynthMIDIDevice
|
class MIDIWaveWriter : public SoftSynthMIDIDevice
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MIDIWaveWriter(const char *filename, MIDIDevice *devtouse);
|
MIDIWaveWriter(const char *filename, SoftSynthMIDIDevice *devtouse);
|
||||||
~MIDIWaveWriter();
|
~MIDIWaveWriter();
|
||||||
int Resume();
|
int Resume();
|
||||||
int Open(MidiCallback cb, void *userdata)
|
int Open(MidiCallback cb, void *userdata)
|
||||||
|
|
|
@ -87,11 +87,11 @@ struct FmtChunk
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
MIDIWaveWriter::MIDIWaveWriter(const char *filename, MIDIDevice *playdevice)
|
MIDIWaveWriter::MIDIWaveWriter(const char *filename, SoftSynthMIDIDevice *playdevice)
|
||||||
: SoftSynthMIDIDevice(playDevice->GetSampleRate())
|
: SoftSynthMIDIDevice(playdevice->GetSampleRate())
|
||||||
{
|
{
|
||||||
File = FileWriter::Open(filename);
|
File = FileWriter::Open(filename);
|
||||||
playDevice = (SoftSynthMIDIDevice*) playdevice;
|
playDevice = playdevice;
|
||||||
if (File != nullptr)
|
if (File != nullptr)
|
||||||
{ // Write wave header
|
{ // Write wave header
|
||||||
uint32_t work[3];
|
uint32_t work[3];
|
||||||
|
|
|
@ -319,8 +319,13 @@ bool MIDIStreamer::DumpWave(const char *filename, int subsong, int samplerate)
|
||||||
|
|
||||||
assert(MIDI == NULL);
|
assert(MIDI == NULL);
|
||||||
auto devtype = SelectMIDIDevice(DeviceType);
|
auto devtype = SelectMIDIDevice(DeviceType);
|
||||||
|
if (devtype == MDEV_MMAPI)
|
||||||
|
{
|
||||||
|
Printf("MMAPI device is not supported");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
MIDI = CreateMIDIDevice(devtype, samplerate);
|
MIDI = CreateMIDIDevice(devtype, samplerate);
|
||||||
MIDI = new MIDIWaveWriter(filename, MIDI);
|
MIDI = new MIDIWaveWriter(filename, reinterpret_cast<SoftSynthMIDIDevice *>(MIDI));
|
||||||
return InitPlayback();
|
return InitPlayback();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue