Dispatching messages from juce_xxx_Messaging.cpp

I’ve patched both juce_win_Messaging.cpp and juce_mac_Messaging.cpp so that they receive events when media is inserted/ejected, but I’m not exactly clear on the best way to get these messages to my app.

I’m currently using

MessageManager::getInstance()->deliverBroadcastMessage(T(“CRDOM_INSERTED”));

which works, but hardly seems ideal. I’d like to be able to send parameters with the message, like I could with Message instance, but I can’t see a way to do it. Any suggestions?

Thanks,

Art

Broadcast messages are for inter-process messages so can’t carry much data.

Why not just make an abstract listener class, let the listeners register with a singleton “disk insertion manager” class, and call them back?

Thanks for the suggestion, Jules. I was hoping to keep type information from my app out of the juce code to keep maintenance headaches to a minimum.

Wouldn’t a more generic way of handling this be to have JUCEApplication implement MessageListener?

Can’t see how that’d help. And disk drive notifications have nothing to do with the application object anyway, so it doesn’t belong there. Using listener classes and a manager object that can register them for callbacks is a much neater way of doing things like this, and doesn’t spill over into any other parts of the code.