Is it possible to control the volume of AVMIDIPlayer

I would like to use AVMIDIPlayer to play a multi-channel MIDI file in a game as background music, but I want the background music to fade out when the game is over. Unfortunately AVMIDIPlayer doesn't have a volume setting like AVAudioPlayer does. Is there a way to control AVMIDIPlayer volume? (Changing the global volume is actually not acceptable)

The only other solution I see is figuring out how to identify the tracks in the MIDI file, create a multi-tool AUGraph, and tickle the mixer at the end. I haven't been able to dig up any CoreMIDI examples with multiple tools and it looks pretty complicated.

+3


source to share


1 answer


Use MusicSequence to play back with AUGraph low-level audio, then sequence with MusicPlayer. In AUGraph, you can control the mixer node.



This becomes a harrowing detail.

0


source







All Articles