Add patch 3161987 from Jason C. Penney: Add (optional) SoundFont support to midi_coreaudio synth. Added some extra info to dosbox.conf to describe this
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@3733
This commit is contained in:
parent
7318abd114
commit
b29e06c006
2 changed files with 18 additions and 0 deletions
|
@ -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.");
|
||||
|
|
|
@ -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));
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue