ref: 0b8c63530f113a7fd92cbe3f54539f33c2cf095b
parent: e01bd185a58dabd79ccdb14d725f32a2800db577
author: Roman Fomin <[email protected]>
date: Mon Oct 25 06:51:46 EDT 2021
set initial tempo
--- a/src/i_winmusic.c
+++ b/src/i_winmusic.c
@@ -421,7 +421,8 @@
{
int i;
midi_file_t *file;
- MIDIPROPTIMEDIV prop;
+ MIDIPROPTIMEDIV timediv;
+ MIDIPROPTEMPO tempo;
MMRESULT mmr;
file = MIDI_LoadFile(filename);
@@ -438,10 +439,21 @@
channel_volume[i] = 100;
}
- prop.cbStruct = sizeof(MIDIPROPTIMEDIV);
- prop.dwTimeDiv = MIDI_GetFileTimeDivision(file);
- mmr = midiStreamProperty(hMidiStream, (LPBYTE)&prop,
+ timediv.cbStruct = sizeof(MIDIPROPTIMEDIV);
+ timediv.dwTimeDiv = MIDI_GetFileTimeDivision(file);
+ mmr = midiStreamProperty(hMidiStream, (LPBYTE)&timediv,
MIDIPROP_SET | MIDIPROP_TIMEDIV);
+ if (mmr != MMSYSERR_NOERROR)
+ {
+ MidiErrorMessageBox(mmr);
+ return;
+ }
+
+ // Set initial tempo.
+ tempo.cbStruct = sizeof(MIDIPROPTIMEDIV);
+ tempo.dwTempo = 500000; // 120 bmp
+ mmr = midiStreamProperty(hMidiStream, (LPBYTE)&tempo,
+ MIDIPROP_SET | MIDIPROP_TEMPO);
if (mmr != MMSYSERR_NOERROR)
{
MidiErrorMessageBox(mmr);