diff --git a/src/dosbox.cpp b/src/dosbox.cpp index 79fb5db8..40be085c 100644 --- a/src/dosbox.cpp +++ b/src/dosbox.cpp @@ -491,6 +491,7 @@ void DOSBOX_Init(void) { Pstring = secprop->Add_string("midiconfig",Property::Changeable::WhenIdle,""); Pstring->Set_help("Special configuration options for the device driver. This is usually the id of the device you want to use.\n" + " or in the case of coreaudio, you can specify a soundfont here.\n" " When using a Roland MT-32 rev. 0 as midi output device, some games may require a delay in order to prevent 'buffer overflow' issues.\n" " In that case, add 'delaysysex', for example: midiconfig=2 delaysysex\n" " See the README/Manual for more details."); diff --git a/src/gui/midi_coreaudio.h b/src/gui/midi_coreaudio.h index 0ffc60f1..ee6c752f 100644 --- a/src/gui/midi_coreaudio.h +++ b/src/gui/midi_coreaudio.h @@ -32,6 +32,7 @@ class MidiHandler_coreaudio : public MidiHandler { private: AUGraph m_auGraph; AudioUnit m_synth; + const char *soundfont; public: MidiHandler_coreaudio() : m_auGraph(0), m_synth(0) {} const char * GetName(void) { return "coreaudio"; } @@ -71,6 +72,22 @@ public: // Get the music device from the graph. RequireNoErr(AUGraphGetNodeInfo(m_auGraph, synthNode, NULL, NULL, NULL, &m_synth)); + // Optionally load a soundfont + if (conf && conf[0]) { + soundfont = conf; + FSRef soundfontRef; + RequireNoErr(FSPathMakeRef((const UInt8*)soundfont, &soundfontRef, NULL)); + RequireNoErr(AudioUnitSetProperty( + m_synth, + kMusicDeviceProperty_SoundBankFSRef, + kAudioUnitScope_Global, + 0, + &soundfontRef, + sizeof(soundfontRef) + )); + LOG_MSG("MIDI:coreaudio: loaded soundfont: %s",soundfont); + } + // Finally: Start the graph! RequireNoErr(AUGraphStart(m_auGraph));