Untitled

 avatar
unknown
plain_text
2 years ago
22 kB
6
Indexable
routingEvidence = false
routingVTC = false
muteall = false
videoOutputOn = "NORMAL"
videoOutputOff = "LOGO"
streamCodec = "156.120.90.104"
lastInputRecorded = "156.120.90.25"

sourceEvidence = 0
sourceVTC = 0

muteWitness = Controls["Mute Witness"].Boolean
muteAll = Controls["AV_Disable"].Boolean

inputCodec = Controls["Stream Codec"].String

inputJudge = Controls["Stream Judge"].String
inputCRD = Controls["Stream CRD"].String
inputReporter = Controls["Stream Reporter"].String
inputPodium = Controls["Stream Podium"].String
inputDocCam = Controls["Stream Doc Cam"].String
inputAttorneyLeft = Controls["Stream Attorney Left"].String
inputAttorneyRight = Controls["Stream Attorney Right"].String

inputNone = ""
routedMessage = "Viewing Evidence"
unroutedMessage = "Add "

function NormalMode()
  print("Entering Normal Mode")

  Controls["Mute Judge"].String = "NORMAL"
  
  if Controls["Route Witness"].Boolean then
    Controls["Mute Witness"].String = "NORMAL"
  end
  
  if Controls["Route Bench"].Boolean then
    Controls["Mute Bench"].String = "NORMAL"
  end

  if Controls["Route Counsel"].Boolean then
    Controls["Mute Counsel"].String = "NORMAL"
  end

  if Controls["Route Streaming"].Boolean then
    Controls["Mute Stream"].String = "NORMAL"
  end 

  if Controls["Route Gallery"].Boolean then
    Controls["Mute Gallery"].String = "NORMAL"
  end

  Controls["Mute Far End"].String = "NORMAL"
end

function LogoMode()
  print("Entering Logo Mode")
   -- never mute the Judge
  --Controls["Mute Judge"].String = "NORMAL"
    
  Controls["Mute Witness"].String = "LOGO"
  
  Controls["Mute Bench"].String = "LOGO"
  
  Controls["Mute Counsel"].String = "LOGO"
  
  Controls["Mute Stream"].String = "LOGO"
  
  Controls["Mute Gallery"].String = "LOGO"

  Controls["Mute Far End"].String = "NORMAL"
end

function AllRouting()
  print("All Routing Mode")
  print(Controls["AV_Disable"].Boolean)

  if Controls["AV_Disable"].Boolean == false then
    Controls["Mute Judge"].String = "NORMAL"
    Controls["Mute Witness"].String = "NORMAL"
    Controls["Mute Bench"].String = "NORMAL"
    Controls["Mute Counsel"].String = "NORMAL"
    Controls["Mute Stream"].String = "NORMAL"
    Controls["Mute Gallery"].String = "NORMAL"
    Controls["Mute Far End"].String = "NORMAL"
  end

  Controls["Route Bench"].Boolean = true
  Controls["Route Witness"].Boolean = true
  Controls["Route Counsel"].Boolean = true
  Controls["Route Streaming"].Boolean = true
  Controls["Route Gallery"].Boolean = true
end

function delayedStart()
  Controls["Audio Stream URL"].String = "0.0.0.0"
end

killAllToggle = Component.New("Kill All Toggle")

function startup()
  Controls["Output Stream"].String = "156.120.90.19"
  Controls["Audio Stream URL"].String = "0.0.0.0"
  Controls["Mute Judge"].String = "NORMAL"
  sourceVTC = inputNone
  if killAllToggle.Toggle.Boolean == false then 
    killAllToggle.Toggle.Boolean = true
  end
  --Controls["AV_Disable"].Boolean = false
  --AllRouting()
  Timer.CallAfter(delayedStart, 0.1)
end

function routeEvidence(input)
  lastInputRecorded = input
  --Controls["Source Changed"]:Trigger()
  routingEvidence = true
  routingVTC = false
  --Controls["Route Evidence"].Boolean = routingEvidence
  --Controls["Route VTC"].Boolean = routingVTC
  setEvidenceFB(input)
  sourceEvidence = input
  --sourceVTC = inputNone
  print("Route Evidence Called " .. input,muteall)

  -- Route Judge
  Controls["Mute Judge"].String = "NORMAL"
  Controls["Output Judge"].String = input
  
  -- Route Witness
  if Controls["Route Witness"].Boolean then
    Controls["Mute Witness"].String = "NORMAL"
    Controls["Output Witness"].String = input
  else
    Controls["Mute Witness"].String = "LOGO"
  end
  
  -- Route Bench
  if Controls["Route Bench"].Boolean then
    Controls["Mute Bench"].String = "NORMAL"
    Controls["Output Bench"].String = input
  else
    Controls["Mute Bench"].String = "LOGO"
  end
  
  -- Route Counsel
  if Controls["Route Counsel"].Boolean then
    Controls["Mute Counsel"].String = "NORMAL"
    Controls["Output Counsel"].String = input
  else
    Controls["Mute Counsel"].String = "LOGO"
  end
  
  -- Route Streaming
  if Controls["Route Streaming"].Boolean then
    Controls["Mute Stream"].String = "NORMAL"
    Controls["Output Stream"].String = input
  else
    Controls["Mute Stream"].String = "LOGO"
  end
  
  -- Route Gallery
  if Controls["Route Gallery"].Boolean then
    Controls["Mute Gallery"].String = "NORMAL"
    Controls["Output Gallery"].String = input
  else
    Controls["Mute Gallery"].String = "LOGO"
  end
  
  Controls["Audio Stream URL"].String = "http://"..input.."/audio.sdp"


-- Route Evidence to Far End
Controls["Mute Far End"].String = "NORMAL"
end

function setEvidenceFB(input)
  Controls["Source Judge FB"].Boolean = false
  Controls["Source CRD FB"].Boolean = false
  Controls["Source Reporter FB"].Boolean = false
  Controls["Source Podium FB"].Boolean = false
  Controls["Source Doc Cam FB"].Boolean = false
  Controls["Source Attorney Left FB"].Boolean = false
  Controls["Source Attorney Right FB"].Boolean = false
  
    -- Check the input passed in to figure out the feedback
  if input == inputJudge then
    Controls["Source Judge FB"].Boolean = true
  elseif input == inputCRD then
    Controls["Source CRD FB"].Boolean = true
  elseif input == inputReporter then
    Controls["Source Reporter FB"].Boolean = true
  elseif input == inputPodium then
    Controls["Source Podium FB"].Boolean = true
  elseif input == inputDocCam then
    Controls["Source Doc Cam FB"].Boolean = true
  elseif input == inputAttorneyLeft then
    Controls["Source Attorney Left FB"].Boolean = true
  elseif input == inputAttorneyRight then
    Controls["Source Attorney Right FB"].Boolean = true
  end
end

function routeVTC(input)
  --AllRouting() --sets all monitors to normal mode and enables routing
  routingEvidence = false
  routingVTC = true
  Controls["Route Evidence"].Boolean = routingEvidence
  Controls["Route VTC"].Boolean = routingVTC
  setVTCFB(input)
  print("sourceVTC:", sourceVTC)
  sourceVTC = input
  print("Route VTC Called " .. input)
  
  -- Route Judge
  Controls["Output Judge"].String = inputCodec
  Controls["Output Witness"].String = inputCodec
  Controls["Output Witness"].String = inputCodec
  Controls["Output Bench"].String = inputCodec
  Controls["Output Counsel"].String = inputCodec
  Controls["Output Stream"].String = inputCodec
  Controls["Output Gallery"].String = inputCodec
  
  -- Route Evidence to Far End
  Controls["Mute Far End"].String = "NORMAL"
  Controls["Output Far End"].String = input
  print("Routing Far End",input)
  print("updating audio stream",input)
  Controls["Audio Stream URL"].String = "http://"..input.."/audio.sdp"
end

function setVTCFB(input)
  Controls["VTC Source Judge FB"].Boolean = false
  Controls["VTC Source CRD FB"].Boolean = false
  Controls["VTC Source Reporter FB"].Boolean = false
  Controls["VTC Source Podium FB"].Boolean = false
  Controls["VTC Source Doc Cam FB"].Boolean = false
  Controls["VTC Source Attorney Left FB"].Boolean = false
  Controls["VTC Source Attorney Right FB"].Boolean = false
  
    -- Check the input passed in to figure out the feedback
  if input == inputJudge then
    Controls["VTC Source Judge FB"].Boolean = true
  elseif input == inputCRD then
    Controls["VTC Source CRD FB"].Boolean = true
  elseif input == inputReporter then
    Controls["VTC Source Reporter FB"].Boolean = true
  elseif input == inputPodium then
    Controls["VTC Source Podium FB"].Boolean = true
  elseif input == inputDocCam then
    Controls["VTC Source Doc Cam FB"].Boolean = true
  elseif input == inputAttorneyLeft then
    Controls["VTC Source Attorney Left FB"].Boolean = true
  elseif input == inputAttorneyRight then
    Controls["VTC Source Attorney Right FB"].Boolean = true
  end
end

function unrouteAll()
  print("Unrouting")
  --routingEvidence = false
  routingVTC = false
  Controls["Route Evidence"].Boolean = routingEvidence
  Controls["Route VTC"].Boolean = routingVTC
  lastInputRecorded = ''
  sourceEvidence = inputNone
  --sourceVTC = inputNone
  muteWitness = true
  muteJury = true
  --muteAll = true
  --muteall = true              -------------------------------------------------Jake
  Controls["Mute Witness"].Boolean = true
  Controls["Mute All"].Boolean = true
  Controls["Mute All"].Legend = "Audio Muted"
  Controls["Route Bench"].Boolean = false
  Controls["Route Bench"].Legend = unroutedMessage .. "CR Staff"
  Controls["Route Witness"].Boolean = false
  Controls["Route Witness"].Legend = unroutedMessage .. " Witness"
  Controls["Route Counsel"].Boolean = false
  Controls["Route Counsel"].Legend = unroutedMessage .. " Counsel"
  Controls["Route Streaming"].Boolean = false
  Controls["Route Streaming"].Legend = unroutedMessage .. " Streaming"
  Controls["Route Gallery"].Boolean = false
  Controls["Route Gallery"].Legend = unroutedMessage .. " Gallery"
  
  --NormalMode()
  Timer.CallAfter(LogoMode, 0.1)
  
  Controls["Output Judge"].String = inputNone
  Controls["Output Witness"].String = inputNone
  Controls["Output Bench"].String = inputNone
  Controls["Output Counsel"].String = inputNone
  Controls["Output Stream"].String = inputNone
  Controls["Output Gallery"].String = inputNone
  
  Controls["Audio Stream URL"].String = ""
  setEvidenceFB("none")
  setVTCFB("none")
end

function unrouteVTC()
  print("Unrouting VTC")
  sourceVTC = inputNone
  Controls["Mute Far End"].String = "LOGO" 
  
  -- Route MWP in 4
  Controls["Output Far End"].String = inputNone
  
  Controls["Audio Stream URL"].String = ""
  setVTCFB("none")
end

-- Unroute Buttons
Controls["Unroute All"].EventHandler = function() 
                                              unrouteAll() 
                                              Controls["Mute Judge"].String = "LOGO" 
                                              Timer.CallAfter( function() Controls["Mute Far End"].String = "LOGO"  end, 1)
                                              Controls["Output Far End"].String = inputNone 
                                              end
Controls["Unroute VTC"].EventHandler = function() unrouteVTC() end

-- Muting Buttons / Source Layering
Controls["Mute Witness"].EventHandler = function() muteWitness = Controls["Mute Witness"].Boolean if routingEvidence then routeEvidence(sourceEvidence) elseif routingVTC then routeVTC(sourceVTC) end end
Controls["Mute All"].EventHandler = function() 
  --muteall = Controls["Mute All"].Boolean
  print("Mute ALL Pushed",muteall) 
  if Controls["Mute All"].Boolean then
    Controls["Mute All"].Legend = "Audio from Video Muted"
    -- Controls["Route Bench"].Boolean = false
    -- Controls["Route Bench"].Legend = unroutedMessage .. "Bench"
    -- Controls["Route Witness"].Boolean = false
    -- Controls["Route Witness"].Legend = unroutedMessage .. " Witness"
    -- Controls["Route Counsel"].Boolean = false
    -- Controls["Route Counsel"].Legend = unroutedMessage .. " Counsel"
    -- Controls["Route Streaming"].Boolean = false
    -- Controls["Route Streaming"].Legend = unroutedMessage .. " Streaming"
    -- Controls["Route Gallery"].Boolean = false
    -- Controls["Route Gallery"].Legend = unroutedMessage .. " Gallery"
  else
    Controls["Mute All"].Legend = "Audio from Video Unmuted"
  end
  if routingEvidence then 
    print("routing evidence")
    routeEvidence(sourceEvidence) 
  elseif routingVTC then 
    print("routing sourceVTC")
    routeVTC(sourceVTC) end 
  end
  
Controls["Route Bench"].EventHandler = function()
  if muteall == false  and Controls["Route Bench"].Boolean then
    Controls["Mute Bench"].String = "NORMAL"
    Controls["Output Bench"].String = lastInputRecorded
    Controls["Route Bench"].Legend = "CR Staff " .. routedMessage
  else if muteall == false and Controls["Route Bench"].Boolean == false then
    Controls["Mute Bench"].String = "LOGO"
    Controls["Route Bench"].Legend = unroutedMessage .. "CR Staff"
  else if muteall then
    if Controls["Route Bench"].Boolean then
      -- Controls["Mute All"].Boolean = false
      -- Controls["Mute All"].Legend = "Video Unmuted"
      -- muteall = false
      routeEvidence(lastInputRecorded)
    end
  end
  end
  end
end

Controls["Route Witness"].EventHandler = function()
  if muteall == false  and Controls["Route Witness"].Boolean then
    Controls["Mute Witness"].String = "NORMAL"
    Controls["Output Witness"].String = lastInputRecorded
    Controls["Route Witness"].Legend = "Witness " .. routedMessage
  else if muteall == false and Controls["Route Witness"].Boolean == false then
    Controls["Mute Witness"].String = "LOGO"
    Controls["Route Witness"].Legend = unroutedMessage .. " Witness"
  else if muteall then
    if Controls["Route Witness"].Boolean then
      -- Controls["Mute All"].Boolean = false
      -- Controls["Mute All"].Legend = "Video Unmuted"
      -- muteall = false
      routeEvidence(lastInputRecorded)
    end
  end
  end
  end
end

Controls["Route Counsel"].EventHandler = function()
  if muteall == false  and Controls["Route Counsel"].Boolean then
    Controls["Mute Counsel"].String = "NORMAL"
    Controls["Output Counsel"].String = lastInputRecorded
    Controls["Route Counsel"].Legend = "Counsel " .. routedMessage
  else if muteall == false and Controls["Route Counsel"].Boolean == false then
    Controls["Mute Counsel"].String = "LOGO"
    Controls["Route Counsel"].Legend = unroutedMessage .. " Counsel"
  else if muteall then
    if Controls["Route Counsel"].Boolean then
      -- Controls["Mute All"].Boolean = false
      -- Controls["Mute All"].Legend = "Video Unmuted"
      -- muteall = false
      routeEvidence(lastInputRecorded)
    end
  end
  end
  end
end

Controls["Route Streaming"].EventHandler = function()
  if muteall == false  and Controls["Route Streaming"].Boolean then
    Controls["Mute Stream"].String = "NORMAL"
    Controls["Output Stream"].String = lastInputRecorded
    Controls["Route Streaming"].Legend = "Streaming " .. routedMessage
  else if muteall == false and Controls["Route Streaming"].Boolean == false then
    Controls["Mute Stream"].String = "LOGO"
    Controls["Route Streaming"].Legend = unroutedMessage .. " Streaming"
  else if muteall then
    if Controls["Route Streaming"].Boolean then
      -- Controls["Mute All"].Boolean = false
      -- Controls["Mute All"].Legend = "Video Unmuted"
      -- muteall = false
      routeEvidence(lastInputRecorded)
    end
  end
  end
  end
end

Controls["Route Gallery"].EventHandler = function()
print("Gallery Pushed",muteall,Controls["Route Gallery"].Boolean)
  if muteall == false  and Controls["Route Gallery"].Boolean then
    Controls["Mute Gallery"].String = "NORMAL"
    Controls["Output Gallery"].String = lastInputRecorded
    Controls["Route Gallery"].Legend = "Gallery " .. routedMessage
  else if muteall == false and Controls["Route Gallery"].Boolean == false then
    Controls["Mute Gallery"].String = "LOGO"
    Controls["Route Gallery"].Legend = unroutedMessage .. " Gallery"
  else if muteall then
    print("muteall is on")
    if Controls["Route Gallery"].Boolean then
      -- Controls["Mute All"].Boolean = false
      -- Controls["Mute All"].Legend = "Video Unmuted"
      -- muteall = false
      routeEvidence(lastInputRecorded)
    end
  end
  end
  end
end

vtcMode = false
function ExitVTC()
  if vtcMode then
    unrouteAll()
  end
end
-- Routing Buttons from TP EventHandlers
Controls["Route Evidence"].EventHandler = function() if Controls["Route Evidence"].Boolean then 
                                                                                            routeEvidence(sourceEvidence) 
                                                                                            --ExitVTC() 
                                                                                            vtcMode = false
                                                                                            end end
Controls["Route VTC"].EventHandler = function() if Controls["Route VTC"].Boolean then routeVTC(sourceVTC) vtcMode = true end end

-- Routing Evidence Buttons
Controls["Source Judge"].EventHandler = function() routeEvidence(inputJudge) end
Controls["Source CRD"].EventHandler = function() routeEvidence(inputCRD) end
Controls["Source Reporter"].EventHandler = function() print(inputReporter) routeEvidence(inputReporter) end
Controls["Source Podium"].EventHandler = function() routeEvidence(inputPodium) end
Controls["Source Doc Cam"].EventHandler = function() routeEvidence(inputDocCam) end
Controls["Source Attorney Left"].EventHandler = function() routeEvidence(inputAttorneyLeft) end
Controls["Source Attorney Right"].EventHandler = function() routeEvidence(inputAttorneyRight) end

-- Routing VTC Evidence Buttons
Controls["VTC Source Judge"].EventHandler = function() routeVTC(inputJudge) end
Controls["VTC Source CRD"].EventHandler = function() routeVTC(inputCRD) end
Controls["VTC Source Reporter"].EventHandler = function() routeVTC(inputReporter) end
Controls["VTC Source Podium"].EventHandler = function() routeVTC(inputPodium) end
Controls["VTC Source Doc Cam"].EventHandler = function() routeVTC(inputDocCam) end
Controls["VTC Source Attorney Left"].EventHandler = function() routeVTC(inputAttorneyLeft) end
Controls["VTC Source Attorney Right"].EventHandler = function() routeVTC(inputAttorneyRight) end

-- Stream # EventHandlers
Controls["Stream Judge"].EventHandler = function() inputJudge = Controls["Stream Judge"].String end
Controls["Stream CRD"].EventHandler = function() inputCRD = Controls["Stream CRD"].String end
Controls["Stream Reporter"].EventHandler = function() inputReporter = Controls["Stream Reporter"].String end
Controls["Stream Podium"].EventHandler = function() inputPodium = Controls["Stream Podium"].String end
Controls["Stream Doc Cam"].EventHandler = function() inputDocCam = Controls["Stream Doc Cam"].String end
Controls["Stream Attorney Left"].EventHandler = function() inputAttorneyLeft = Controls["Stream Attorney Left"].String end
Controls["Stream Attorney Right"].EventHandler = function() inputAttorneyRight = Controls["Stream Attorney Right"].String end
Controls["Stream Codec"].EventHandler = function() inputCodec = Controls["Stream Codec"].String end

-- Control EventHadlers
Controls["Startup"].EventHandler = function() startup() end
Controls["Logo Mode"].EventHandler = function() 
  NormalMode()
  Timer.CallAfter(LogoMode, 20) 
end

function EnableControls()
  local state = false
  local color = "transparent"
  print("Enable Controls")
  Controls["Mute All"].IsDisabled = state
  Controls["Route Bench"].IsDisabled = state
  Controls["Route Witness"].IsDisabled = state
  Controls["Route Counsel"].IsDisabled = state
  Controls["Route Streaming"].IsDisabled = state
  Controls["Route Gallery"].IsDisabled = state

  Controls["VTC Source Doc Cam"].Color = color
  Controls["VTC Source Judge"].Color = color
  Controls["VTC Source CRD"].Color = color
  Controls["VTC Source Reporter"].Color = color
  Controls["VTC Source Podium"].Color = color
  Controls["VTC Source Attorney Left"].Color = color
  Controls["VTC Source Attorney Right"].Color = color

  Controls["VTC Source Doc Cam"].IsDisabled = state
  Controls["VTC Source Judge"].IsDisabled = state
  Controls["VTC Source CRD"].IsDisabled = state
  Controls["VTC Source Reporter"].IsDisabled = state
  Controls["VTC Source Podium"].IsDisabled = state
  Controls["VTC Source Attorney Left"].IsDisabled = state
  Controls["VTC Source Attorney Right"].IsDisabled = state
end



function DisableControls()
  local state = true
  local color = "red"
  print("Disable Controls")
  Controls["Mute All"].IsDisabled = state
  Controls["Route Bench"].IsDisabled = state
  Controls["Route Witness"].IsDisabled = state
  Controls["Route Counsel"].IsDisabled = state
  Controls["Route Streaming"].IsDisabled = state
  Controls["Route Gallery"].IsDisabled = state

  Controls["VTC Source Doc Cam"].Color = color
  Controls["VTC Source Judge"].Color = color
  Controls["VTC Source CRD"].Color = color
  Controls["VTC Source Reporter"].Color = color
  Controls["VTC Source Podium"].Color = color
  Controls["VTC Source Attorney Left"].Color = color
  Controls["VTC Source Attorney Right"].Color = color

  Controls["VTC Source Doc Cam"].IsDisabled = state
  Controls["VTC Source Judge"].IsDisabled = state
  Controls["VTC Source CRD"].IsDisabled = state
  Controls["VTC Source Reporter"].IsDisabled = state
  Controls["VTC Source Podium"].IsDisabled = state
  Controls["VTC Source Attorney Left"].IsDisabled = state
  Controls["VTC Source Attorney Right"].IsDisabled = state
end

Controls["AV_Disable"].EventHandler = function() 
  disable = Controls["AV_Disable"].Boolean
  if disable then 
    --unrouteAll()
    LogoMode()
    DisableControls()
    Controls["Mute Far End"].String = "LOGO"
  else 
    NormalMode()
    EnableControls()
  end

end


startup()
Editor is loading...