I found the solution in this project.
You need to use Audio Units. Add a node with this component description:
description.componentType = kAudioUnitType_MusicDevice;
description.componentSubType = kAudioUnitSubType_DLSSynth;
description.componentManufacturer = kAudioUnitManufacturer_Apple;
description.componentFlags = 0;
description.componentFlagsMask = 0;
AUGraphAddNode (graph, &description, &synthNode);
Open and initialize your audio units and play the notes like that:
MusicDeviceMIDIEvent (synthUnit, channel, note, velocity, 0);