Results 1 to 5 of 5

Thread: Scratching my head over MCC_SET_PAUSE as windows message

  1. #1
    Join Date
    Jul 2001
    Location
    Risør - Norway
    Posts
    5,477

    Default Scratching my head over MCC_SET_PAUSE as windows message

    I need to use discrete pause/play (without starting from the beginning again if play is accidentally pressed when something is already playing, like MCC_PLAY does). I have managed to get it working with a command line (MCC) command, like this:

    Code:
    C:\Windows\System32\MC14.exe /MCC 10022, 1
    But I would really like to have it as a windows message since all my other stuff is as a windows message. The problem is sending the parameter. The code I use for a regular function like play/pause in Zone 0 is like this:

    Code:
    WindowHandle = win.FindWindow ("MJFrame",nil)
    result = win.PostMessage ( WindowHandle, 33768, 10000, 16777216)
    Deactivating pause (discrete play would be a better name for it, but it's under the SET_PAUSE) is like this, without a parameter:

    Code:
    WindowHandle = win.FindWindow ("MJFrame",nil)
    result = win.PostMessage ( WindowHandle, 33768, 10022, 16777216)
    And I should think that the set pause command with parameter should have been something like this:

    Code:
    WindowHandle = win.FindWindow ("MJFrame",nil)
    result = win.PostMessage ( WindowHandle, 33768, 10022, 1, 16777216)
    Or maybe:

    Code:
    WindowHandle = win.FindWindow ("MJFrame",nil)
    result = win.PostMessage ( WindowHandle, 33768, 10022, 16777216, 1)
    But none of those work because, as GIrder says: "This function requires 4 parameter(s), not 5." Can somebod please tell me how to do this in a way that works?
    Tor - managing director of the Cinema Inferno home theater and multi-zone sound system with Girder running the show in the back, NetRemote as the GUI and Media Center 17, PowerDVD and ZoomPlayer as playback software
    Hobsyssel mastiffs: http://www.hobsyssel.no

  2. #2
    Join Date
    May 2004
    Location
    Dallas, TX
    Posts
    1,125

    Default

    Mastiff,

    Try the following to deactivate the pause.

    Code:
    WindowHandle = win.FindWindow ("MJFrame",nil)
    result = win.PostMessage ( WindowHandle, 33768, 10022, 16777217)
    Per the JRMC Wiki if using the Zone parameter you need to add the MCC_SET_PAUSE parameter to the zone parameter.

    http://wiki.jriver.com/index.php/Med...Commands#Zones
    Rick

    Girder 6.0 - Elk M1 Gold - JRMC 11.1 w/ M-Audio Delta 410 - NetRemote - BlueIris DVR
    Girder 6 Plugins - Elk M1/EZ8, Pushover Connector and more on the way.


    Visit My Showcase

  3. #3
    Join Date
    Jul 2001
    Location
    Risør - Norway
    Posts
    5,477

    Default

    So much to learn, so small brain... That was fast, Rick! Thanks a lot! By the way I'm trying to use one of your old scripts on getting playback information from MC. You helped Quixote with this script:

    Code:
    --[[
        JRMC Playstate By Zone
        
        * PLAYSTATE_STOPPED - Stopped
        * PLAYSTATE_PAUSED - Paused
        * PLAYSTATE_PLAYING - Playing
        * PLAYSTATE_WAITING - Waiting) 
    --]]
    
    local playstates = {
        [0] = 'Stopped',
        'Paused',
        'Playing',
        'Waiting',
    }
    
    require ('luacom')
    local jrmc = luacom.GetObject ("MediaJukebox Application")
    if not jrmc then
        jrmc = luacom.CreateObject ("MediaJukebox Application")
        if jrmc == nil then print ('MC 12 COM','Object creation failed') return false end
    end
    
    print ('MC Automation Object Created')
    print ('MC Version:', jrmc:GetVersion():Version())
    print ('MC Zone Count:', jrmc:GetZones():GetNumberZones())
    
    -- poll the zones
    local zonecount = jrmc:GetZones():GetNumberZones()
    for i = 0, zonecount - 1 do
        local playback = jrmc:GetZones():GetZone(i):GetPlayback()
        local state = playstates[playback:State()]
        print ('Zone', i, 'playstate', state)
    end
    
    -- destroy the automation object
    jrmc = nil
    
    -- clean up
    collectgarbage
    And he said he had gotten the info into variables. I think I'm really, really out of shape with LUA. Haven't really coded in a couple of years because everything in my house has been working very well. But now the radio senders in my area are going down (they're dialing down the power to force people over to digital radio), and I want to use JRMC for streaming radio. The problem is that every now and then the DSL connection in my house out in the sticks breaks for a few seconds, which stops the streaming. So I would really love to have a very simple function to check if a specific zone is playing (I'm going to use a timer to do that maybe every 20 seconds or so) and start it playing if it's not. Also sometimes it stays on "buffering" forever, until I stop and start playback again, and that will be "waiting" in playback state. So do you have a tip for how I do something like this for checking playback of the first zone, zone 0 (and then I go from that with the rest of the zones):

    Code:
    if state 0 == "waiting"
    then gir.TriggerEvent ("Stop and play",18)
    Also would it be wise to load the original script for every time I'm checking, or could that simply be left in memory? I know these com objects can be rather tricky.
    Tor - managing director of the Cinema Inferno home theater and multi-zone sound system with Girder running the show in the back, NetRemote as the GUI and Media Center 17, PowerDVD and ZoomPlayer as playback software
    Hobsyssel mastiffs: http://www.hobsyssel.no

  4. #4
    Join Date
    May 2004
    Location
    Dallas, TX
    Posts
    1,125

    Default

    Mastiff,

    Modified the above script to provide for checks on playback in the current zone. Let me know if you need more.

    Code:
    --[[
        JRMC Playstate By Zone
        
        * PLAYSTATE_STOPPED - Stopped
        * PLAYSTATE_PAUSED - Paused
        * PLAYSTATE_PLAYING - Playing
        * PLAYSTATE_WAITING - Waiting) 
    --]]
    
    local playstates = {
        [0] = 'Stopped',
        'Paused',
        'Playing',
        'Waiting',
    }
    
    require ('luacom')
    local jrmc = luacom.GetObject ("MediaJukebox Application")
    if not jrmc then
        jrmc = luacom.CreateObject ("MediaJukebox Application")
        if jrmc == nil then print ('MC 12 COM','Object creation failed') return false end
    end
    
    print ('MC Automation Object Created')
    print ('MC Version:', jrmc:GetVersion():Version())
    print ('MC Zone Count:', jrmc:GetZones():GetNumberZones())
    
    -- poll the zones
    local zonecount = jrmc:GetZones():GetNumberZones()
    for i = 0, zonecount - 1 do
        local playback = jrmc:GetZones():GetZone(i):GetPlayback()
        local state = playstates[playback:State()]
        print ('Zone', i, 'playstate', state)
    	if state == "Stopped" then
    		-- do something here, ie sendmessage to start playback
    	elseif state == "Paused" then
    		-- do something here
    	elseif state == "Playing" then
    		-- do something here
    	elseif state == "Waiting" then
    		-- do something here
    	end
    end
    
    -- destroy the automation object
    jrmc = nil
    
    -- clean up
    collectgarbage()
    Rick

    Girder 6.0 - Elk M1 Gold - JRMC 11.1 w/ M-Audio Delta 410 - NetRemote - BlueIris DVR
    Girder 6 Plugins - Elk M1/EZ8, Pushover Connector and more on the way.


    Visit My Showcase

  5. #5
    Join Date
    Jul 2001
    Location
    Risør - Norway
    Posts
    5,477

    Default

    Great, Rick! Thanks! You're a wizard! But one question: Does this check all the zones at once, or can I have it check one zone at a time? Would it be possible to have a function for that?
    Tor - managing director of the Cinema Inferno home theater and multi-zone sound system with Girder running the show in the back, NetRemote as the GUI and Media Center 17, PowerDVD and ZoomPlayer as playback software
    Hobsyssel mastiffs: http://www.hobsyssel.no

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •