We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 5356 - [PATCH] native_midi_macosx: volume should be set before starting playing
Summary: [PATCH] native_midi_macosx: volume should be set before starting playing
Status: RESOLVED FIXED
Alias: None
Product: SDL_mixer
Classification: Unclassified
Component: misc (show other bugs)
Version: unspecified
Hardware: All Mac OS X (All)
: P2 normal
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-11-18 20:42 UTC by michaeljosephmaltese
Modified: 2020-11-22 08:37 UTC (History)
1 user (show)

See Also:


Attachments
native_midi_macosx: set volume before starting playing (715 bytes, patch)
2020-11-18 20:42 UTC, michaeljosephmaltese
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description michaeljosephmaltese 2020-11-18 20:42:29 UTC
Created attachment 4525 [details]
native_midi_macosx: set volume before starting playing

On macOS, the native MIDI backend applies volume after the MIDI file starts playing, which can lead to a split second of music at an incorrect volume (e.g. say you want to fade it in, or just have it start muted).

I tracked this to native_midi_start in native_midi_macosx.c, which calls MusicPlayerStart before calling GetSequenceAudioUnit and native_midi_setvolume — this needs to be the other way round. We can safely move these around since we have a valid AudioUnit in the graph after calling MusicPlayerPreroll.

Patch attached.
Comment 1 Ozkan Sezer 2020-11-22 08:37:59 UTC
This patch is in: https://hg.libsdl.org/SDL_mixer/rev/900ad643ac68
Thanks.