Skip to content

Commit

Permalink
feat: update threadedclass
Browse files Browse the repository at this point in the history
  • Loading branch information
Julusian committed Jun 26, 2020
1 parent b7087c9 commit 8f39d18
Show file tree
Hide file tree
Showing 5 changed files with 329 additions and 882 deletions.
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@
"@types/jest": "^25.2.1",
"@types/node": "^12.7.12",
"@types/sinonjs__fake-timers": "^6.0.0",
"@typescript-eslint/eslint-plugin": "^2.31.0",
"@typescript-eslint/parser": "^2.31.0",
"@typescript-eslint/eslint-plugin": "~2.31.0",
"@typescript-eslint/parser": "~2.31.0",
"codecov": "^3.2.0",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.11.0",
Expand Down Expand Up @@ -114,11 +114,11 @@
"video"
],
"dependencies": {
"eventemitter3": "^4.0.1",
"eventemitter3": "^4.0.4",
"exit-hook": "^2.0.0",
"nanotimer": "^0.3.15",
"threadedclass": "^0.7.0",
"tslib": "^1.10.0",
"threadedclass": "0.8.0-nightly-20200626-190313-597bdf9.0",
"tslib": "^1.13.0",
"wavefile": "^8.4.4"
},
"standard-version": {
Expand All @@ -138,7 +138,7 @@
"*.{ts}": [
"yarn lint --fix --",
"git add"
]
]
},
"resolutions": {
"**/conventional-changelog-angular": "5.0.6",
Expand Down
2 changes: 1 addition & 1 deletion src/atem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export interface AtemOptions {
childProcessTimeout?: number
}

export interface AtemEvents {
export type AtemEvents = {
error: [string]
info: [string]
debug: [string]
Expand Down
4 changes: 2 additions & 2 deletions src/lib/atemSocket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export interface AtemSocketOptions {
childProcessTimeout: number
}

export interface AtemSocketEvents {
export type AtemSocketEvents = {
disconnect: []
info: [string]
debug: [string]
Expand Down Expand Up @@ -114,7 +114,7 @@ export class AtemSocket extends EventEmitter<AtemSocketEvents> {
private async _createSocketProcess(): Promise<Promisify<AtemSocketChild>> {
const socketProcess = await threadedClass<AtemSocketChild, typeof AtemSocketChild>(
'./atemSocketChild',
AtemSocketChild,
'AtemSocketChild',
[
{
address: this._address,
Expand Down
56 changes: 28 additions & 28 deletions src/lib/tally.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,40 +158,40 @@ export function listVisibleInputs(mode: 'program' | 'preview', state: AtemState,
// every time the ATEM's state updates.
lastSize = inputs.size
for (const inputId of Array.from(inputs).slice(lastProcessed)) {
const input = state.inputs[inputId]
if (!input) {
// Data isn't hydrated yet, we'll get 'em next time.
continue
}
const portType = input.internalPortType
switch (portType) {
case Enums.InternalPortType.SuperSource: {
const ssrcId = inputId - 6000
const ssrc = AtemStateUtil.getSuperSource(state, ssrcId)
for (const box of ssrc.boxes) {
if (box && box.enabled) {
inputs.add(box.source)
}
const input = state.inputs[inputId]
if (!input) {
// Data isn't hydrated yet, we'll get 'em next time.
continue
}
const portType = input.internalPortType
switch (portType) {
case Enums.InternalPortType.SuperSource: {
const ssrcId = inputId - 6000
const ssrc = AtemStateUtil.getSuperSource(state, ssrcId)
for (const box of ssrc.boxes) {
if (box && box.enabled) {
inputs.add(box.source)
}
}

if (ssrc.properties) {
inputs.add(ssrc.properties.artFillSource)
if (ssrc.properties.artOption === Enums.SuperSourceArtOption.Foreground) {
inputs.add(ssrc.properties.artCutSource)
}
if (ssrc.properties) {
inputs.add(ssrc.properties.artFillSource)
if (ssrc.properties.artOption === Enums.SuperSourceArtOption.Foreground) {
inputs.add(ssrc.properties.artCutSource)
}
break
}
case Enums.InternalPortType.MEOutput: {
const nestedMeId = (inputId - (inputId % 10) - 10000) / 10 - 1
const nestedMeMode = (inputId - 10000) % 10 === 0 ? 'program' : 'preview'
_calcActiveMeInputs(inputs, nestedMeMode, state, nestedMeId)
break
}
default:
// Do nothing.
break
}
case Enums.InternalPortType.MEOutput: {
const nestedMeId = (inputId - (inputId % 10) - 10000) / 10 - 1
const nestedMeMode = (inputId - 10000) % 10 === 0 ? 'program' : 'preview'
_calcActiveMeInputs(inputs, nestedMeMode, state, nestedMeId)
break
}
default:
// Do nothing.
}
}
lastProcessed = lastSize - 1
} while (inputs.size !== lastSize)

Expand Down
Loading

0 comments on commit 8f39d18

Please sign in to comment.