Skip to content

Commit

Permalink
fix: consistent API for super source methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Balte de Wit committed Aug 5, 2019
1 parent 7e0c2e9 commit 4327660
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
16 changes: 8 additions & 8 deletions src/__tests__/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ test('setSuperSourceProperties - 7.2', async () => {
try {
expect(conn.sendCommand).not.toHaveBeenCalled()

await conn.setSuperSourceProperties(2, {
await conn.setSuperSourceProperties({
artPreMultiplied: true,
artOption: Enums.SuperSourceArtOption.Background
})
}, 2)
expect(conn.sendCommand).toHaveBeenCalledTimes(1)
expect(conn.sendCommand).toHaveBeenNthCalledWith(1, {
rawName: 'CSSc',
Expand All @@ -58,10 +58,10 @@ test('setSuperSourceProperties - 8.0', async () => {
try {
expect(conn.sendCommand).not.toHaveBeenCalled()

await conn.setSuperSourceProperties(2, {
await conn.setSuperSourceProperties({
artPreMultiplied: true,
artOption: Enums.SuperSourceArtOption.Background
})
}, 2)
expect(conn.sendCommand).toHaveBeenCalledTimes(1)
expect(conn.sendCommand).toHaveBeenNthCalledWith(1, {
rawName: 'CSSc',
Expand All @@ -83,10 +83,10 @@ test('setSuperSourceBorder - 7.2', async () => {
try {
expect(conn.sendCommand).not.toHaveBeenCalled()

await conn.setSuperSourceBorder(2, {
await conn.setSuperSourceBorder({
borderBevelSoftness: 12,
borderLuma: 3
})
}, 2)
expect(conn.sendCommand).toHaveBeenCalledTimes(1)
expect(conn.sendCommand).toHaveBeenNthCalledWith(1, {
rawName: 'CSSc',
Expand All @@ -106,10 +106,10 @@ test('setSuperSourceBorder - 8.0', async () => {
try {
expect(conn.sendCommand).not.toHaveBeenCalled()

await conn.setSuperSourceBorder(2, {
await conn.setSuperSourceBorder({
borderBevelSoftness: 12,
borderLuma: 3
})
}, 2)
expect(conn.sendCommand).toHaveBeenCalledTimes(1)
expect(conn.sendCommand).toHaveBeenNthCalledWith(1, {
rawName: 'CSBd',
Expand Down
6 changes: 3 additions & 3 deletions src/atem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -341,15 +341,15 @@ export class Atem extends EventEmitter {
return this.sendCommand(command)
}

setSuperSourceBoxSettings (ssrcId: number, newProps: Partial<SuperSourceBox>, box = 0) {
setSuperSourceBoxSettings (newProps: Partial<SuperSourceBox>, box = 0, ssrcId = 0) {
const command = new Commands.SuperSourceBoxParametersCommand()
command.ssrcId = ssrcId
command.boxId = box
command.updateProps(newProps)
return this.sendCommand(command)
}

setSuperSourceProperties (ssrcId: number, newProps: Partial<SuperSourceProperties>) {
setSuperSourceProperties (newProps: Partial<SuperSourceProperties>, ssrcId = 0) {
if (this.state.info.apiVersion >= Enums.ProtocolVersion.V8_0) {
const command = new Commands.SuperSourcePropertiesV8Command()
command.ssrcId = ssrcId
Expand All @@ -362,7 +362,7 @@ export class Atem extends EventEmitter {
}
}

setSuperSourceBorder (ssrcId: number, newProps: Partial<SuperSourceBorder>) {
setSuperSourceBorder (newProps: Partial<SuperSourceBorder>, ssrcId = 0) {
if (this.state.info.apiVersion >= Enums.ProtocolVersion.V8_0) {
const command = new Commands.SuperSourceBorderCommand()
command.ssrcId = ssrcId
Expand Down

0 comments on commit 4327660

Please sign in to comment.