INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Event handling using the MC COM object  (Read 4192 times)

LehighBri

  • Guest
Event handling using the MC COM object
« 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!
Logged

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42373
  • Shoes gone again!
Re:Event handling using the MC COM object
« Reply #1 on: May 24, 2004, 01:35:16 pm »

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.
Logged
Matt Ashland, JRiver Media Center

LehighBri

  • Guest
Re:Event handling using the MC COM object
« Reply #2 on: May 24, 2004, 01:50:14 pm »

Thanks for the perfectly good workaround, and I look forward to hearing how this will be implemented in future versions!
Logged

Zoner

  • Regular Member
  • World Citizen
  • ***
  • Posts: 198
  • nothing more to say...
Re:Event handling using the MC COM object
« Reply #3 on: June 17, 2004, 04:47:30 pm »

Another alternative is to use the Windows messaging interface: that's event-based.
Logged

Zoner

  • Regular Member
  • World Citizen
  • ***
  • Posts: 198
  • nothing more to say...
Re:Event handling using the MC COM object
« Reply #4 on: July 05, 2004, 04:35:39 am »

Sorry, what I wrote is incorrect.  The message-based interface is only good for sending commands to MC, not for receiving notifications from it.
Logged

Zoner

  • Regular Member
  • World Citizen
  • ***
  • Posts: 198
  • nothing more to say...
Re:Event handling using the MC COM object
« Reply #5 on: July 12, 2004, 03:22:59 am »

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.
Logged

RhinoBanga

  • Citizen of the Universe
  • *****
  • Posts: 1703
  • Developer
Re:Event handling using the MC COM object
« Reply #6 on: July 12, 2004, 09:05:11 am »

Quote
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.
Logged

Zoner

  • Regular Member
  • World Citizen
  • ***
  • Posts: 198
  • nothing more to say...
Re:Event handling using the MC COM object
« Reply #7 on: July 13, 2004, 01:55:43 am »

...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.
Logged

RhinoBanga

  • Citizen of the Universe
  • *****
  • Posts: 1703
  • Developer
Re:Event handling using the MC COM object
« Reply #8 on: July 13, 2004, 02:38:26 am »

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.
Logged

Zoner

  • Regular Member
  • World Citizen
  • ***
  • Posts: 198
  • nothing more to say...
Re:Event handling using the MC COM object
« Reply #9 on: July 17, 2004, 03:52:02 am »

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!
Logged

NaTeDoGG

  • Regular Member
  • Junior Woodchuck
  • **
  • Posts: 70
  • Change this by choosing profile
Re:Event handling using the MC COM object
« Reply #10 on: September 25, 2004, 01:19:12 am »

Bumpity! Can we have events pleeeeaaaaase?
Logged

Zoner

  • Regular Member
  • World Citizen
  • ***
  • Posts: 198
  • nothing more to say...
Re:Event handling using the MC COM object
« Reply #11 on: November 07, 2004, 03:41:05 am »

Double-bump
Logged

Mr ChriZ

  • Citizen of the Universe
  • *****
  • Posts: 4375
  • :-D
Re: Event handling using the MC COM object
« Reply #12 on: March 05, 2006, 07:39:18 am »

Triple Bump ;-)
Doesn't bother me that much but as I'm here!

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42373
  • Shoes gone again!
Re: Event handling using the MC COM object
« Reply #13 on: March 06, 2006, 08:46:29 am »

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
Logged
Matt Ashland, JRiver Media Center

Mr ChriZ

  • Citizen of the Universe
  • *****
  • Posts: 4375
  • :-D
Re: Event handling using the MC COM object
« Reply #14 on: March 06, 2006, 08:54:13 am »

Interesting to know  :),
Cheers Matt!

RhinoBanga

  • Citizen of the Universe
  • *****
  • Posts: 1703
  • Developer
Re: Event handling using the MC COM object
« Reply #15 on: March 06, 2006, 09:00:21 am »

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.
Logged

scthom

  • Citizen of the Universe
  • *****
  • Posts: 621
Re: Event handling using the MC COM object
« Reply #16 on: March 06, 2006, 05:23:48 pm »

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.
Logged
Pages: [1]   Go Up