Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update audio detection #119

Merged
merged 1 commit into from Jan 23, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
58 changes: 42 additions & 16 deletions source/appMain.brs
Expand Up @@ -65,8 +65,30 @@ Sub initGlobals()

GetGlobalAA().AddReplace("rokuUniqueId", device.GetDeviceUniqueId())

If (major >= 6 and minor >= 1) or major >= 7 Then
di = CreateObject("roDeviceInfo")
audioDecoders = di.GetAudioDecodeInfo()
modelName = di.GetModelDisplayName()
modelNumber = di.GetModel()

' Check for surround sound codecs:
hasDolbyDigital = audioDecoders.doesexist("AC3")
hasDolbyDTS = audioDecoders.doesexist("DTS")
hasDDPlus = audioDecoders.doesexist("DD+")

if hasDolbyDigital or hasDolbyDTS or hasDDPlus then
GetGlobalAA().AddReplace("surroundSound", true)
else
GetGlobalAA().AddReplace("surroundSound", false)
end if

GetGlobalAA().AddReplace("audioOutput51", hasDolbyDigital)
GetGlobalAA().AddReplace("audioDTS", hasDolbyDTS)
GetGlobalAA().AddReplace("audioDDPlus", hasDDPlus)

' Get model name and audio output
If major > 4 Or (major = 4 And minor >= 8) Then
else
If major > 4 Or (major = 4 And minor >= 8) Then
modelName = device.GetModelDisplayName()
modelNumber = device.GetModel()

Expand All @@ -76,7 +98,7 @@ Sub initGlobals()
else
GetGlobalAA().AddReplace("audioOutput51", false)
end if
Else
Else
modelNumber = device.GetModel()
GetGlobalAA().AddReplace("audioOutput51", false)

Expand Down Expand Up @@ -109,25 +131,32 @@ Sub initGlobals()
models["4210R"] = "Roku 2 (2015)"
models["4230X"] = "Roku 3 (2015)"
models["4230R"] = "Roku 3 (2015)"
models["4400R"] = "Roku 4"
models["4400X"] = "Roku 4"

If models.DoesExist(modelNumber) Then
modelName = models[modelNumber]
Else
modelName = modelNumber
End If
end if
' Check for DTS passthrough support
' roku 3 with firmware 5.1 and higher
if left(modelNumber,1) = "4" and major >= 5 and minor >= 1
GetGlobalAA().AddReplace("audioDTS", true)
else
GetGlobalAA().AddReplace("audioDTS", false)
end if

' Check to see if the box can support surround sound
surroundSound = device.HasFeature("5.1_surround_sound")
GetGlobalAA().AddReplace("surroundSound", surroundSound)
GetGlobalAA().AddReplace("audioDDPlus", false)
End If

GetGlobalAA().AddReplace("rokuModelNumber", modelNumber)
GetGlobalAA().AddReplace("rokuModelName", modelName)

' Check for DTS passthrough support
' roku 3 with firmware 5.1 and higher
if left(modelNumber,2) = "42" and major >= 5 and minor >= 1
GetGlobalAA().AddReplace("audioDTS", true)
else
GetGlobalAA().AddReplace("audioDTS", false)
end if

' Assume everything below major version of 4.0 To be a legacy device
if major < 4
GetGlobalAA().AddReplace("legacyDevice", true)
Expand All @@ -141,8 +170,8 @@ Sub initGlobals()
' Roku 2 has been observed to play all the way up to 16 ReFrames, but
' on at least one test video there were noticeable artifacts as the
' number increased, starting with 8.
if left(modelNumber,4) = "4200" and major >=5 then
GetGlobalAA().AddReplace("maxRefFrames", 12)
if left(modelNumber,1) = "4" and major >=5 then
GetGlobalAA().AddReplace("maxRefFrames", 15)
elseif major >= 4 then
GetGlobalAA().AddReplace("maxRefFrames", 8)
else
Expand All @@ -156,10 +185,6 @@ Sub initGlobals()
GetGlobalAA().AddReplace("isHD", false)
End If

' Check to see if the box can support surround sound
surroundSound = device.HasFeature("5.1_surround_sound")
GetGlobalAA().AddReplace("surroundSound", surroundSound)

' Get display information
GetGlobalAA().AddReplace("displaySize", device.GetDisplaySize())
GetGlobalAA().AddReplace("displayMode", device.GetDisplayMode())
Expand All @@ -173,6 +198,7 @@ Sub initGlobals()

End Sub


'*************************************************************
'** Get a variable from the Global Array
'*************************************************************
Expand Down