# Issues with Cinder-MIDI2 / RtMidi not detecting ports

**URL:** <https://discourse.libcinder.org/t/issues-with-cinder-midi2-rtmidi-not-detecting-ports/1587>\
**Category:** CinderBlocks\
**Created:** [November 13, 2019, 1:24am UTC](https://discourse.libcinder.org/t/issues-with-cinder-midi2-rtmidi-not-detecting-ports/1587 "2019-11-13T01:24:51Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![couleurs](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.libcinder.org/couleurs/32/99_2.png) [@couleurs](https://discourse.libcinder.org/u/couleurs)\
**Post date:** [November 13, 2019, 1:24am UTC](https://discourse.libcinder.org/t/issues-with-cinder-midi2-rtmidi-not-detecting-ports/1587/1 "2019-11-13T01:24:52Z")

</div>

Hey folks, I was revisiting an old app that used to work well with an external MIDI controller and realized the MIDI part doesn’t work on this new mac laptop I use which is on the Mojave OS.

It seems that RtMidi, which is what the Cinder-MIDI2 block is built on top of, is not detecting any ports because it is stuck in dummy mode although it should be in MacOS mode. Digging through the code, more specifically `RtMidi.h`, it seems that depends on the `CINDER_MAC` preprocessor macro being set properly which seems to happen in `configure.cmake`.

Any idea why something could go wrong here? Could it maybe be due to build order and the midi block not being built before that variable is properly set? Anything that could have regressed because of Mojave? Things were working fine on my old mac which was on the previous OS.

Thanks for your help!  
Johan

---

<div class="post-metadata">

**Author:** ![couleurs](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.libcinder.org/couleurs/32/99_2.png) [@couleurs](https://discourse.libcinder.org/u/couleurs)\
**Post date:** [November 14, 2019, 3:43am UTC](https://discourse.libcinder.org/t/issues-with-cinder-midi2-rtmidi-not-detecting-ports/1587/2 "2019-11-14T03:43:03Z")

</div>

For what it’s worth I just tested things with python-rtmidi and in that case it does return available ports so it does seem related to something with my Cinder app.

---

<div class="post-metadata">

**Author:** ![gabor\_papp](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.libcinder.org/gabor_papp/32/769_2.png) [@gabor\_papp](https://discourse.libcinder.org/u/gabor_papp)\
**Post date:** [November 15, 2019, 10:42am UTC](https://discourse.libcinder.org/t/issues-with-cinder-midi2-rtmidi-not-detecting-ports/1587/3 "2019-11-15T10:42:38Z")

</div>

Have you tried to add the `-D __MACOSX_CORE__ ` flag to your build? As far as I know this is what is required by RtMidi on macOS.

-Gabor

---

<div class="post-metadata">

**Author:** ![couleurs](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.libcinder.org/couleurs/32/99_2.png) [@couleurs](https://discourse.libcinder.org/u/couleurs)\
**Post date:** [November 15, 2019, 6:30pm UTC](https://discourse.libcinder.org/t/issues-with-cinder-midi2-rtmidi-not-detecting-ports/1587/4 "2019-11-15T18:30:21Z")

</div>

Thanks @gabor_papp! My understanding skimming through RtMidi’s code is that this would happen automatically when CINDER\_MAC is properly set. See: [https://github.com/brucelane/Cinder-MIDI2/blob/master/lib/RtMidi.h#L576](https://github.com/brucelane/Cinder-MIDI2/blob/master/lib/RtMidi.h#L576)

But maybe not on Mojave and I need to add that explicitly? What would be a good place to add that flag? This is what my make file currently looks like: [https://github.com/couleurs/nightsea-live/blob/master/proj/cmake/CMakeLists.txt](https://github.com/couleurs/nightsea-live/blob/master/proj/cmake/CMakeLists.txt)

Thanks so much for your help 🙂

---

<div class="post-metadata">

**Author:** ![gabor\_papp](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.libcinder.org/gabor_papp/32/769_2.png) [@gabor\_papp](https://discourse.libcinder.org/u/gabor_papp)\
**Post date:** [November 15, 2019, 6:54pm UTC](https://discourse.libcinder.org/t/issues-with-cinder-midi2-rtmidi-not-detecting-ports/1587/5 "2019-11-15T18:54:37Z")

</div>

Are you using CMake to build your project? I cannot see the CMake build files for Bruce’s Cinder-MIDI2.

---

<div class="post-metadata">

**Author:** ![couleurs](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.libcinder.org/couleurs/32/99_2.png) [@couleurs](https://discourse.libcinder.org/u/couleurs)\
**Post date:** [November 15, 2019, 7:10pm UTC](https://discourse.libcinder.org/t/issues-with-cinder-midi2-rtmidi-not-detecting-ports/1587/6 "2019-11-15T19:10:42Z")

</div>

I am! And you’re right, the CMake build files are not there for the MIDI but I created them locally: [https://gist.github.com/couleurs/1003849914ce139adc3a30a9e300d798](https://gist.github.com/couleurs/1003849914ce139adc3a30a9e300d798)

This was a while back but I think I just created this file by re-purposing what was done with other blocks. I am by no means a CMake expert. But this is probably the right place to add the flag you mentioned?

---

<div class="post-metadata">

**Author:** ![gabor\_papp](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.libcinder.org/gabor_papp/32/769_2.png) [@gabor\_papp](https://discourse.libcinder.org/u/gabor_papp)\
**Post date:** [November 15, 2019, 7:17pm UTC](https://discourse.libcinder.org/t/issues-with-cinder-midi2-rtmidi-not-detecting-ports/1587/7 "2019-11-15T19:17:44Z")

</div>

yes, i would try adding something like this:

```auto
	add_definitions( -D __MACOSX_CORE__ )

```

---

<div class="post-metadata">

**Author:** ![couleurs](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.libcinder.org/couleurs/32/99_2.png) [@couleurs](https://discourse.libcinder.org/u/couleurs)\
**Post date:** [November 15, 2019, 7:26pm UTC](https://discourse.libcinder.org/t/issues-with-cinder-midi2-rtmidi-not-detecting-ports/1587/8 "2019-11-15T19:26:33Z")

</div>

Hmm when I do so I get a warning saying that macro was already defined (which makes sense given that it seems that the block customizes `RtMidi.h` to automatically define the macro when `CINDER_MAC` is set). But I also get a bunch of linker errors saying all the functions for `MidiInCore` are not defined, although they should get defined when that macro is on. Very confusing 😕

---

<div class="post-metadata">

**Author:** ![couleurs](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.libcinder.org/couleurs/32/99_2.png) [@couleurs](https://discourse.libcinder.org/u/couleurs)\
**Post date:** [November 15, 2019, 9:56pm UTC](https://discourse.libcinder.org/t/issues-with-cinder-midi2-rtmidi-not-detecting-ports/1587/9 "2019-11-15T21:56:09Z")

</div>

Hmm I think some of my issues might be related to not properly importing CoreMIDI. When I do so, and hardcode ` __MACOSX_CORE__ ` in the custom `RtMidi.h` from the block, or explicitly add the Mac flag as @gabor_papp suggested, things work as expected. Not quite sure why I need to do that though since `CINDER_MAC` should take of things, but I will update the thread if I find out. At least I’m unblocked 🙂

---

<div class="post-metadata">

**Author:** ![sherwood](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.libcinder.org/sherwood/32/811_2.png) [@sherwood](https://discourse.libcinder.org/u/sherwood)\
**Post date:** [October 3, 2023, 2:12am UTC](https://discourse.libcinder.org/t/issues-with-cinder-midi2-rtmidi-not-detecting-ports/1587/10 "2023-10-03T02:12:54Z")

</div>

Resurfacing this, I’m getting the same thing, not detecting any ports, but I’m on Windows 11 with VS 2019. I’ve really been going around in circles trying to figure out why. I’m using the template in the block with tinderbox and everything compiles fine, just no ports. Thanks for any help!

---

<div class="post-metadata">

**Author:** ![brucelane](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.libcinder.org/brucelane/32/541_2.png) [@brucelane](https://discourse.libcinder.org/u/brucelane)\
**Post date:** [March 30, 2024, 9:29pm UTC](https://discourse.libcinder.org/t/issues-with-cinder-midi2-rtmidi-not-detecting-ports/1587/11 "2024-03-30T21:29:13Z")

</div>

Hi,  
On Windows add winmm.lib

 ![image](https://canada1.discourse-cdn.com/flex030/uploads/libcinder/original/2X/0/03c9ece03a5b3ccef3446a680cd80c8c04c8107e.png)
