Issue Description
When playing certain MIDI files using AVMIDIPlayer, the initial volume settings for individual tracks are being ignored during the first playback. This results in all tracks playing at the same volume level, regardless of their specified volume settings in the MIDI file.
Steps to Reproduce
- Load a MIDI file that contains different volume settings for multiple tracks
- Start playback using AVMIDIPlayer
- Observe that all tracks play at the same volume level, ignoring their individual volume settings
Current Behavior
- All tracks play at the same volume level during initial playback
- Track volume settings specified in the MIDI file are not being respected
- This behavior consistently occurs on first playback of affected MIDI files
Expected Behavior
- Each track should play at its specified volume level from the beginning
- Volume settings in the MIDI file should be respected from the first playback
Workaround
I discovered that the correct volume settings can be restored by:
- Starting playback of the MIDI file
- Setting the
currentPosition
property to (current time - 1 second) - After this operation, all tracks play at their intended volume levels
However, this is not an ideal solution as it requires manual intervention and may affect the playback experience.
Questions
- Is there a way to ensure the track volume settings are respected during the initial playback?
- Is this a known issue with AVMIDIPlayer?
- Are there any configuration settings or alternative approaches that could resolve this issue?
Technical Details
- iOS Version: 18.1.1 (22B91)
- Xcode Version: 16.1 (16B40)