mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-10 23:01:59 +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
|
||||
{
|
||||
public:
|
||||
MIDIWaveWriter(const char *filename, MIDIDevice *devtouse);
|
||||
MIDIWaveWriter(const char *filename, SoftSynthMIDIDevice *devtouse);
|
||||
~MIDIWaveWriter();
|
||||
int Resume();
|
||||
int Open(MidiCallback cb, void *userdata)
|
||||
|
|
|
@ -87,11 +87,11 @@ struct FmtChunk
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
MIDIWaveWriter::MIDIWaveWriter(const char *filename, MIDIDevice *playdevice)
|
||||
: SoftSynthMIDIDevice(playDevice->GetSampleRate())
|
||||
MIDIWaveWriter::MIDIWaveWriter(const char *filename, SoftSynthMIDIDevice *playdevice)
|
||||
: SoftSynthMIDIDevice(playdevice->GetSampleRate())
|
||||
{
|
||||
File = FileWriter::Open(filename);
|
||||
playDevice = (SoftSynthMIDIDevice*) playdevice;
|
||||
playDevice = playdevice;
|
||||
if (File != nullptr)
|
||||
{ // Write wave header
|
||||
uint32_t work[3];
|
||||
|
|
|
@ -319,8 +319,13 @@ bool MIDIStreamer::DumpWave(const char *filename, int subsong, int samplerate)
|
|||
|
||||
assert(MIDI == NULL);
|
||||
auto devtype = SelectMIDIDevice(DeviceType);
|
||||
if (devtype == MDEV_MMAPI)
|
||||
{
|
||||
Printf("MMAPI device is not supported");
|
||||
return false;
|
||||
}
|
||||
MIDI = CreateMIDIDevice(devtype, samplerate);
|
||||
MIDI = new MIDIWaveWriter(filename, MIDI);
|
||||
MIDI = new MIDIWaveWriter(filename, reinterpret_cast<SoftSynthMIDIDevice *>(MIDI));
|
||||
return InitPlayback();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue