fix #38041: pedal not exported to MIDI

Pedal events were not being collected at all during export - only during playback.  I factored that out so the same code is used for both playback and export.  Swing was also not being exported correctly if you tried exporting before listening to playback within MuseScore; I fixed that as well.  There are some other things that are done in Score::renderMidi() but not in ExportMidi::write() - like calling updateVelo() - but this appears to not be necessary as updateVelo is called on every doLayout() (something we could consider eliminating, BTW).
For better performance - maybe use ref instead of copy (vector can be heavy) in 'for' loop in old code: 
for (const std::pair<...>& pedalEvents : channelPedalEvents) ?
Or in C++11 manner:
for (const auto& pedalEvents : channelPedalEvents).