INTERACT FORUM

Please login or register.

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

Author Topic: Programming question  (Read 2047 times)

petrossa

  • World Citizen
  • ***
  • Posts: 127
Programming question
« on: February 16, 2011, 05:18:10 am »

I have written an our-of-proc connection. I get all the interfaces loaded, pointers are good. I receive events when i connect to a running instance, all info correct.

I request the playbackautomation interface, i get it.


I run this

 switch (code)
  {
   case NextTrack:
    playback->Next();
    break;
   case PrevTrack:
    playback->Previous();
    break;
   case StopTrack:
    playback->Stop();
    break;
   case PlayTrack:
    playback->Play();
    break;
  default:
     break;
  }

the calls return without error but MC doesn't react.

What do i do wrong?  :'(
Logged

cncb

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 3106
Re: Utterly, totally and completely confused
« Reply #1 on: February 16, 2011, 08:19:05 am »

Maybe you are controlling a different zone in MC than you think (not the one shown in the application)?
Logged
-Craig    MO 4Media remote and player:  Android/TV/Auto | iOS | Windows 10/UWP

petrossa

  • World Citizen
  • ***
  • Posts: 127
Re: Programming question
« Reply #2 on: February 16, 2011, 11:59:40 am »

Found it out. 

I have a separate thread running to decode a mask on an usb line, which in turn translates into commands and calls the MC interface. (i've have hardwired the bathroom with a pushbuttonpanel to the computer because i can't get wireless to work for more then 3 meters, NATO sucks) The main interface is loaded in the main thread.  >:(

Although i call back to the mainthread to execute the command something goes missing. Guess i have to poll the the other thread from the main thread to work.

FacePalm

Tnx for the answer just the same.
Logged

petrossa

  • World Citizen
  • ***
  • Posts: 127
Re: Programming question
« Reply #3 on: February 16, 2011, 12:29:49 pm »

Yep, polling the thread work fine.

Maybe this will help someone else:

If you have COM interfaces opened for services other than MC and you run it multithreaded, you can't refer back to the main thread to use the MC interface without weird side effects.

One needs to open the MC interface in the main thread, and poll the other the threads from the main thread to execute Set commands. Weirdly enough Get commands work fine.

Go figure ?
Logged

JimH

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 72443
  • Where did I put my teeth?
Re: Programming question
« Reply #4 on: February 16, 2011, 12:40:02 pm »

(i've have hardwired the bathroom with a pushbuttonpanel to the computer because i can't get wireless to work for more then 3 meters, NATO sucks)
Powerline networking works well.
Logged

petrossa

  • World Citizen
  • ***
  • Posts: 127
Re: Programming question
« Reply #5 on: February 17, 2011, 04:33:57 am »

True, but then i'd have to put a computer in my bathroom. And then i might as well put an ethernet cable. Would be nicer to use the JRiver ID. In any case, i did try to convince my wife to put a computer in there but that fell on seriously deaf ears.  :'(

This way i can just make a panel with pushbuttons and by connecting 5 wires to ground in various combo's i can generate 120 commands, convert the signals to a bitmap, copy that to an integer and control MC that way.

I was thinking to include a mechanical selector switch, so to set the function of the pushbuttons. Grounding one wire, leaves me !4 commands per selection.

So wire 1: playback, wire 2: playlist, wire 3: etc. Feedback by leds.

I laid a HDMI cable, it has ample wires and well shielded. I even feed the music through it to a 300 w car PowerAmplifier in the bathroom.

With the humidity most other electronics fail.



Logged
Pages: [1]   Go Up