INTERACT FORUM

Windows => Plug-in Development => Topic started by: teodorom on June 27, 2017, 09:56:39 am

Title: Plugin enabling interaction with TIDAL
Post by: teodorom on June 27, 2017, 09:56:39 am
Hi,
I was successful in creating "MyPlugin" for JRMC22 in
I have simply added a button that displays a message box.
Attaching the process Media Center 22, I can debug too ! ;D
At this point I would like to complete the project, that is
Can I do all that from inside the plugin ?
I'm doing that since the rendering of the stream made by MC is far superior, and then I can use the DSP inside MC.
Ah ! the name of the plugin will be TINR ("This Is Not ROON").
Thanks
Title: Re: Plugin enabling interaction with TIDAL
Post by: teodorom on June 28, 2017, 03:11:01 pm
I have to admit that a better C#/.NET programmer than me could have (much) less difficulties than me but ...
In the Plugin SDK sample I have
        public void Init ( MediaJukebox.MJAutomation mediaCenterReference )
        {   
            try
            {                 
                this.mediaCenterReference = mediaCenterReference;
            }
            catch (Exception e)
                    {
                              this.Enabled = false;
            }
        }
While in the code found @ https://wiki.jriver.com/index.php/Programming_Plugins_in_C I read:
public void Init ( MediaCenter.MCAutomation mcRef )
{
    try
    {
        this.mcRef = mcRef;
        // This tells MC to also call our MJEvent method
        this.mcRef.FireMJEvent += new IMJAutomationEvents_FireMJEventEventHandler ( MJEvent );   
    }
    catch (Exception e)
    {
        errorHandler ( e );
    }
I guess that this is the piece of code that could allow me to capture the "Play" event, but since I don't know the object model, I'm lost.
Any developer ?
Thanks
Title: Re: Plugin enabling interaction with TIDAL
Post by: teodorom on June 29, 2017, 08:52:46 am
Hi all (mainly to the developers).
Crashing my head I was able to have in my plugin the code depicted in htps://wiki.jriver.com/index.php/Programming_Plugins_in_C (http://htps://wiki.jriver.com/index.php/Programming_Plugins_in_C), so now I see in the Debug pane the events raised by MC.
Unfortunately the result is very deceiving.
When I press "Play" on an album I see
MJEvent type: MCCommand MCC: NOTIFY_PLAYLIST_FILES_CHANGED 636665472
MJEvent type: MCCommand MCC: NOTIFY_TRACK_CHANGE 0
MJEvent type: MCCommand MCC: NOTIFY_PLAYERSTATE_CHANGE 0
MJEvent type: MCCommand MCC: NOTIFY_VOLUME_CHANGED 0
MJEvent type: MCCommand MCC: NOTIFY_TRACK_CHANGE 0
MJEvent type: MCCommand MCC: NOTIFY_PLAYERSTATE_CHANGE 0

Let me guess that "636665472" is some internal ID used by MC.
Unfortunately, when I jump to the next (or any other) track, I see
MJEvent type: MCCommand MCC: NOTIFY_PLAYERSTATE_CHANGE 0
MJEvent type: MCCommand MCC: NOTIFY_VOLUME_CHANGED 0
MJEvent type: MCCommand MCC: NOTIFY_TRACK_CHANGE 0
MJEvent type: MCCommand MCC: NOTIFY_PLAYERSTATE_CHANGE 0
MJEvent type: MCCommand MCC: NOTIFY_PLAYERSTATE_CHANGE 0
MJEvent type: MCCommand MCC: NOTIFY_PLAYERSTATE_CHANGE 0

The ability of getting some ID of the track that's playing is crucial to my project (a "showstopper", if you want).
Please help !!!
Thanks
Title: Re: Plugin enabling interaction with TIDAL
Post by: JimH on June 29, 2017, 09:45:23 am
Have you found the documentation on the Developer page?  A link is at the bottom of this page.
Title: Re: Plugin enabling interaction with TIDAL
Post by: teodorom on June 29, 2017, 09:54:26 am
Yes, it was this way that I discovered https://wiki.jriver.com/index.php/Programming_Plugins_in_C#.Net (https://wiki.jriver.com/index.php/Programming_Plugins_in_C#.Net).
Information is buried somewhere, I guess ...
Thanks
Title: Re: Plugin enabling interaction with TIDAL
Post by: teodorom on June 29, 2017, 01:15:46 pm
Crashing my head I have realized that the "s3", available when the
private void MJEvent(String s1, String s2, String s3)
fires, is not an internal ID: apart being quite always 0, it always changes.
No clue of the meaning in the documentation.
So, I tried another way. I wrote:
MediaCenter.IMJCurPlaylistAutomation curPlaylist = mcRef.GetCurPlaylist();
The object curPlaylist does (quite well) its job, try:
curPlaylist.RemoveAllFiles();
The
MediaCenter.IMJFileAutomation nextFile = mcRef.GetFileByKey(curPlaylist.GetNextFile());
seems promising.
But nextFile is empty!
Debug.WriteLine(nextFile.Album);
Finally: how can I get the Key of the NextFile in the curPlayList ?


Thanks
Title: Re: Plugin enabling interaction with TIDAL
Post by: Matt on June 29, 2017, 01:34:35 pm
curPlaylist.GetNextFile() returns an index in the current playlist.

So you probably need to do curPlaylist.GetFile(curPlaylist.GetNextFile()).

Hope that gets you going :)
Title: Re: Plugin enabling interaction with TIDAL
Post by: teodorom on June 29, 2017, 01:43:56 pm
This works:
MediaCenter.IMJFileAutomation currFile = curPlaylist.GetFile(1);
Debug.WriteLine(currFile.GetKey());
MediaCenter.IMJFileAutomation nextFile = mcRef.GetFileByKey(currFile.GetKey());
Debug.WriteLine(nextFile.Album);

The "key" is currFile.GetKey().
Thanks