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).
No, extra copies were created in old code too. It's just the next possible improvement.