Standalone plugin on iOS receives MIDI messages twice


#1

Hello,

I’ve started working on IAA on 5.1.0 and noticed my ProcessBlock method received twice each messages. I’ve just tested with 5.1.1 and have the same issue.

It seems to be related with the timerCallback in the juce_StandaloneFilterWindow.h. It looks like the midiCallback is added twice, once in the setupAudioDevices method and once in the timerCallback. If I deactivate the timer, I only receive the MIDI message once (back to normal).

I’ve also noticed the timerCallback keeps on going through all the conditions and call the addMidiInputCallback each time which is strange since the list of my MIDI devices remains the same all time long.

In order to test my App, I use a MIDI device connected to my computer then forwarded to a MIDI network connected to the iOS device.

Do you think it is related to JUCE or some misuse from me ?

Thanks for your help


#2

Yeah that’s a bug. A fix for this is now on develop with commit ffdc318. Thanks for reporting!


#3

I copy/pasted the modification. Everything seems back to normal.
Thank you


#4

Can you please put the curly braces back? Fixing the code is one thing, but you make it less readable and invite compiler errors. @jules recently had to add them or people who still used MSVC 2013 got a compiler error.

Also it seems that this bug was affecting every platform, not just iOS. Is that true?


#5

Fabian’s braces look good to me. The VC compiler error only happened when using a macro in a range-based for.


#6

So you don’t follow your own style guide and neither do other ROLI developers. Great.


#7

Fabian’s code does follow our style guide… He obviously removed the braces in order to follow it.

You can (and regularly do!) accuse us of a lot of things, but seriously… relax and let us worry about style!


#8

Sorry, I must have misinterpreted them then.

So here I quote the guide, maybe you can tell me how I misinterpret them:

This is a for-loop, wrapping an if-statement. So now the for-loop should follow the “more than one line”-rule. Or is it only true for if-statements?

also

At the end of the day, it’s your code you can, and should, do whatever you like. I just find it strange that the braces were already there and then removed. The style guide seems to support the braces, but apparently they are not wanted.

I’m not trying to cause trouble here, I’m just genuinely confused. I’ve had my own style over the last 25+ years, but I’m always trying to improve and I found your style-guide very helpful. In general I don’t use

if (fooBar)

anymore and instead write

if (fooBar == true)

to make the intend a lot clearer. Same principle as for nullptr. It just makes it a lot clearer what is going on.

So I felt that the change, especially since the braces were already there, was detrimental to the intend and readability of the code. I looked up the style-guide and found the quoted paragraph and posted.