Skip to content

Conversation

@Julusian
Copy link
Member

About the Contributor

This pull request is posted on behalf of myself

Type of Contribution

This is a: Feature

Current Behavior

Since #157, it has been possible to send commands in batches. This can be necessary when sending many commands to both avoid retransmits, and to minimise the visual staggering of the changes.
157 solved this for the method of manual construction of the command classes, by allowing multiple to be provided to the sender at once which would then group them and send them in fewer packets.

This works, but leaves out the simpler api of the library.

New Behavior

This adds a new and user friendly way to batch the sending of commands.

The approach I have taken is to pull out the command methods into their own class which can be used in multiple class implementations, to minimise the effort going forward.

This can be used by doing:


const atem = new Atem() // or new BasicAtem(). Whatever you usually do.

const batcher = new AtemCommandBatch(atem)

batcher.changeProgramInput(2, 0)
batcher.changeProgramInput(4, 1)

// Send batch and empty queue
batcher.sendQueued().then(() => {
  console.log('commands sent')
})


// Start a new batch
batcher.changePreviewInput(7, 0)
batcher.changePreviewInput(7, 1)

// Send batch
batcher.sendQueued().then(() => {
  console.log('commands sent')
})

Testing Instructions

Other Information

Status

  • PR is ready to be reviewed.
  • The functionality has been tested by the author.
  • Relevant unit tests has been added / updated.
  • Relevant documentation (code comments, system documentation) has been added / updated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants