INTERACT FORUM

Please login or register.

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

Author Topic: Using J River REMOTE Control to Play Songs in PREVIEW Mode  (Read 2600 times)

scm

  • World Citizen
  • ***
  • Posts: 171
Using J River REMOTE Control to Play Songs in PREVIEW Mode
« on: July 19, 2011, 01:51:56 pm »

I programmed my remote by going to Options, Remote Controls, Commands, Add Custom, Add Run:

mc14.exe
/mcc 10031,120,30

This should theoretically begin playback at 30 seconds and then play for 120 seconds.  It does not begin at 30 seconds.  It begins at the beginning.  However, it does only play 120 seconds.

Is this a bug in Media Center (I'm using version 14), or am I doing something wrong?
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Using J River REMOTE Control to Play Songs in PREVIEW Mode
« Reply #1 on: July 19, 2011, 09:12:36 pm »

The parameter is a single parameter.  You have to perform bit arithmetic.

Quote
low 12 bits: int nDurationSeconds, high 12 bits: int nStartSeconds

This means, the low 12 bits are the duration, and the high 12 bits are the start point.

So, the math is this:

(nStartSeconds << 12) + nDurationSeconds

For 30 seconds into the song, that would be

30 << 12 = 122880

add 10 to that for your duration which would be: 122890

mc14.exe /mcc 10031,122890
Logged
The opinions I express represent my own folly.

scm

  • World Citizen
  • ***
  • Posts: 171
Re: Using J River REMOTE Control to Play Songs in PREVIEW Mode
« Reply #2 on: July 19, 2011, 11:32:09 pm »

Can you explain that math? 

I don't know what "<<" or "low 12 bits" is or at all how that math is working.
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Using J River REMOTE Control to Play Songs in PREVIEW Mode
« Reply #3 on: July 20, 2011, 12:12:15 am »

Sure.

Here's an online calculator.

http://instacalc.com/

Paste in:

(30 << 12)  + 10

and you should get the result:

122890

This would be 30 seconds into the song, play for 10 seconds.  Just replace the 30 above with the starting point, and the 10 with the duration you want played.
Logged
The opinions I express represent my own folly.

scm

  • World Citizen
  • ***
  • Posts: 171
Re: Using J River REMOTE Control to Play Songs in PREVIEW Mode
« Reply #4 on: July 20, 2011, 12:30:26 pm »

I input exactly what you advised and it didn't work at all.  It plays songs just like normal, from start to finish.  Did you test this?  
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Using J River REMOTE Control to Play Songs in PREVIEW Mode
« Reply #5 on: July 20, 2011, 01:18:18 pm »

Yes, I tested it, on MC16.  It works here.  See image.

This particular core command appears to have been around for a long time, so I don't believe version is relevant.
Logged
The opinions I express represent my own folly.

scm

  • World Citizen
  • ***
  • Posts: 171
Re: Using J River REMOTE Control to Play Songs in PREVIEW Mode
« Reply #6 on: July 20, 2011, 01:31:32 pm »

Oops you're right.  Since I am submitting the command with the MC Remote Control, I forgot I had switched the button I was using for it, and was sitting there hitting the wrong button after correctly inputting your code haha.

Now it works wonderfully.  Where can I learn more about this 12 bits low and high stuff so I can understand how to convert other equations?  A quick search on google lead me nowhere.  I just want to better understand the core command language so I can customize more commands.

Thanks so much for your help!  Now I can finally hit that sweet spot of a 90 second preview starting 30 seconds into the song, and really start to enjoy my playlists.
Logged

scm

  • World Citizen
  • ***
  • Posts: 171
Re: Using J River REMOTE Control to Play Songs in PREVIEW Mode
« Reply #7 on: July 20, 2011, 01:35:08 pm »

Oh, and I need to create a custom remote control command to switch it back out of preview mode so it goes to "Play Entire Song".

What would be the code for this?
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Using J River REMOTE Control to Play Songs in PREVIEW Mode
« Reply #8 on: July 20, 2011, 01:59:20 pm »

Use 0 as the parameter.

mc14.exe /mcc 10031,0

Learning about bit shifting requires understanding binary representation (eg. base 2).  You already understand base 10 shifting... think about shifting 10 by inserting one 0 at the right 10, and you get 100.  Shift left again and you get 1000.

The same holds true for base 2 representations of numbers.  30 in decimal is 11110 in binary (that's 16 + 8 + 4 + 2).  Left shifting 11110 by 12 just adds 12 0's to the right.  Converting (ignore the spaces) 1 1110 0000 0000 0000 to decimal is 122880.
Logged
The opinions I express represent my own folly.

scm

  • World Citizen
  • ***
  • Posts: 171
Re: Using J River REMOTE Control to Play Songs in PREVIEW Mode
« Reply #9 on: July 21, 2011, 01:06:01 am »

So what's that program in your screen capture that seems to let you view code alongside MC?
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Using J River REMOTE Control to Play Songs in PREVIEW Mode
« Reply #10 on: July 21, 2011, 01:18:31 am »

Two programs, cygwin which I use as for my unix/linux toolkit on Windows, and snagit for the screen captures.  I just aligned the two program windows so you could see how it all works.

Here's how I did the math automatically in cygwin:

   mc16.exe /mcc 10031,$(perl -e 'print (30 << 12) + 10;')


but in the screenshot, I only showed the resulting parameter, so as not to confuse the matter.  I see no reason why I should do the math, so I let perl do it for me and the result is passed by bash shell command output expansion, where bash then launches mc16.exe.  (the Window's cmd.exe shell stinks).
Logged
The opinions I express represent my own folly.
Pages: [1]   Go Up