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).
I have no doubt that makes sense, but I wasn't thinking of changing anything about how the code worked - just re-factoring it to allow it the same code to be used both in Score::renderMidi() and ExportMidi::write().  Unless you are saying that by doing this I have somehow caused an extra copy that was not there before?