INTERACT FORUM
Windows => Plug-in Development => Topic started by: LehighBri on May 24, 2004, 01:33:08 pm
-
Is there any event handling built into the Media Jukebox COM object? I would like to call a method each time a new file is played. This would be similar to iTunes' OnPlayerPlayEvent.
Any ideas on if this is possible or what classes to look at? Thanks!
-
There aren't currently notifications in the automation SDK. Perhaps in the next version.
For now, you'll need to run a timer or something similar and poll MC.
-
Thanks for the perfectly good workaround, and I look forward to hearing how this will be implemented in future versions!
-
Another alternative is to use the Windows messaging interface: that's event-based.
-
Sorry, what I wrote is incorrect. The message-based interface is only good for sending commands to MC, not for receiving notifications from it.
-
J River - any chance we could get some development in this area? I would settle for anything at all, no matter how simple. If you could just broadcast a windows message every time you started or stopped playing a new track, that would be fantastic.
Polling really is a bad solution - it means we have to choose between latency and CPU usage. An event-based solution means no compromises.
-
Polling really is a bad solution
I agree and you're not the only one after it. I made a request over two years ago:
http://yabb.jriver.com/interact/index.php?board=6;action=display;threadid=15822;start=msg107191#msg107191
Although to be fair in PlayingNow I poll every 750ms to check what is currently playing and no-one has complained that it's a performance killer; but a proper event mechanism would be nice.
-
...and soooo easy to do, surely? COM already supports an event mechanim, but failing that just blasting out a windows message to all windows to say "something happened" is a 1-liner.
-
The problem with a windows message is that it's a PITA for VB users, which unfortunately most plugin users are, so it would only benefit a few of us or those who can handle subclassing in VB.
-
I agree that something more sophisticated would be better, but after waiting for over a year for that with no end in sight, I'm more than ready to accept *anything* J River can provide.
This problem is getting more acute for me now, since I've expanded my CAV6.6 software to handle up to 6 zones. Polling 6 zones in MC is really a drag!
-
Bumpity! Can we have events pleeeeaaaaase?
-
Double-bump
-
Triple Bump ;-)
Doesn't bother me that much but as I'm here!
-
There is a solution that exists that we use internally. It's not well documented and the messages it uses may change between versions (and possibly even builds).
With that disclaimer said, the solution that exists is:
OnCreate(...) of a window:
pMJ->RegisterWindowWithRouter(hwndMyWindow, TRUE);
Handle this message:
WM_MC_COMMAND
Return TRUE if you handle a message or MCC_UNHANDLED if you don't.
For example, the on track change notification looks like this:
MCC_NOTIFY_PLAYER_INFO_CHANGED (test (Param & PLAYER_INFO_CHANGE_PLAYING_FILE))
OnDestroy(...) of a window:
pMJ->RegisterWindowWithRouter(hwndMyWindow, FALSE);
More information on the messages here: (focus on the MCC_NOTIFICATIONS_SECTION)
http://www.jrmediacenter.com/DevZone/MCCommands.h
-
Interesting to know :),
Cheers Matt!
-
Hi Matt,
While I appreciate you telling us this I don't think it's really usable since you are saying it may change even down at the build level.
Something more robust is unfortunately needed.
-
While I appreciate you telling us this I don't think it's really usable since you are saying it may change even down at the build level.
Something more robust is unfortunately needed.
I agree. Would be a fantastic feature for plugins, and needs to be fairly robust (and constant!!) to be useful in any meaningful way. And, really, it needs to be events. Some plugins (Encoder) use events already.