An unusual MIDI linking error


I’ve been working on loading and playing .wav files, but I haven’t managed to link after including Juce’s sound- and audio-related components. The errors I see go something like this:

/juce/bin/libjucedebug.a(juce_mac_CoreMidi.o) reference to undefined _MIDIClientCreate
/juce/bin/libjucedebug.a(juce_mac_CoreMidi.o) reference to undefined _MIDIDeviceGetNumberOfEntities
/juce/bin/libjucedebug.a(juce_mac_CoreMidi.o) reference to undefined _MIDIEndpointGetEntity

What’s particularly interesting is that the juce demo compiles and links successfully. As a sanity check, I took the AudioDemo section and copied it verbatim into my current app. This again failed to link for the reasons above.
What might I be forgetting? If it helps, I’m using XCode 2.4.1 on a ppc mac, with the latest Juce source as of perhaps a month ago.


You need to add CoreMidi to the list of libraries that your app uses.


Ah! Figures it would be something simple like that. =)

Perhaps you can humor me with the answer to another (hopefully) simple question? While I’ve gotten my basic version of the Audio Demo running, it still won’t successfully play a .wav file. One problem seems to be that the BufferingAudioSource never updates it’s ‘nextPlayPos’; possibly because the AudioTransportSource being used to read the file stops calling on the buffer after the first call to getNextAudioBlock().
This exact same code works correctly when compiled into the standard Juce demo, however, and I’m at a loss for any differences between the project-configurations and usages of that app and my test one.


Ah, here we go. If anyone else has had a similar problem, the issue turned out to be that the juce.xconfig file is not brought over automatically when you copy a project in XCode. In of itself, this doesn’t stop the new project from compiling and running successfully. But it will stop it from successfully reading and playing audio, apparently.

So, when you copy a project:

  1. Draw the juce.xconfig file into the treeview.
  2. Select ‘Edit Project Settings’
  3. In the drop down at the bottom of the window choose (Based on: Juce).
    3b) Lather, rinse, repeat for all your build configurations (debug, release, etc.)