1

I have been working with the MusicPlayer and MusicSequence classes to play MIDI files. However, I am wondering how to specify instruments for different channels. What is the MusicPlayer's default response to program change events? Can I tell the MusicPlayer to use certain samplers for certain channels? Or is the only way to set my own function as a MIDI Endpoint, and then handle the playing of notes myself using MusicDeviceMIDIEvent() to specify the sampler?

4

1 回答 1

0

您可以为 MusicSequence 中的不同轨道指定不同的乐器。(MusicTrack API)我不认为 MusicPlayer 对频道本身做任何事情。您可以指定在加载 MIDI 文件时将通道转换为轨道。

音乐序列加载标志

用于配置 MusicSequenceFileLoad 和 MusicSequenceFileLoadData 函数行为的标志。

枚举 { kMusicSequenceLoadSMF_ChannelsToTracks = (1 << 0) }; typedef UInt32 MusicSequenceLoadFlags;

常数

kMusicSequenceLoadSMF_ChannelsToTracks

If this flag is set the resultant Sequence will contain a tempo track, 1 track for each MIDI Channel that is found in the SMF, 1 track

对于 SysEx 或 MetaEvents - 这将是 LoadSMFWithFlags 调用之后序列中的最后一个轨道。

Available in OS X v10.3 and later.

Declared in MusicPlayer.h.
于 2012-09-24T13:01:26.763 回答