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
|
@ -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
Add a link
Reference in a new issue