Skip to content

Added ME indicator in PVW and PGM bus #7

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion example.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ atem.on('sourceConfiguration', function(id, config, info) {
});

atem.on('programBus', function(source) {
console.log('program bus changed to', source);
console.log('program bus changed to', source.source);
});

atem.ip = "10.1.0.210";
Expand Down
22 changes: 17 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -753,28 +753,40 @@ function Device(atemIpAddress){
});

this.on('PrvI', function(d) {
const source = d.readUInt16BE(2),
const me = d.readUInt8(0);
const source = d.readUInt16BE(2)
inTransition = (d[4] & 1) === 1;

/**
* When the selected preview bus changes this event will be fired.
* @event Device#previewBus
* @property {SourceID} source The new preview source
* @property {number} me 0 for M/E 1, 1 for M/E 2
* @property {number} source The new preview source
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did the numbering of sources change? If yes: please elaborate on the new numbering structure, if not: please use the SourceID instead of number.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My apologies - no reason for me to have changed this!

* @property {boolean} inTransition Is this currently dissolving?
*/
atem.emit('previewBus', source, inTransition);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing the way the data is passed from separate arguments to an one argument object looks nice, but it breaks backwards compatibility though.
I'd suggest to keep the multiple arguments style for now and pass the ME information as a 3rd argument. This way we can release it as a sem-ver minor update. It is possible to release a major update afterwards where we switch to one argument objects but that is for another pull request...

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is true, but you could also argue that since you're still in major version zero, the API isn't set in stone anyway.

That being said, I can also respect your desire to keep it stable even in version zero. Also, since it's your repository, that's your call! I'd be happy to change it to pass the ME information as a 3rd argument if you'd prefer.

atem.emit('previewBus', {
me,
source,
inTransition
});

// todo inspect the other bytes in PrvI
});

this.on('PrgI', function(d) {
const me = d.readUInt8(0);
const source = d.readUInt16BE(2);

/**
* When the selected program bus changes this event will be fired.
* @event Device#programBus
* @property {SourceID} source The new program source
* @property {number} me 0 for M/E 1, 1 for M/E 2
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did the numbering of sources change? If yes: please elaborate on the new numbering structure, if not: please use the SourceID type specifier instead of number.

* @property {number} source The new program source
*/
atem.emit('programBus', source);
atem.emit('programBus', {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the same reason as the previewBus event, keep the multiple arguments style for now and pass the ME information as a 2nd argument.

me,
source
});
// todo inspect the other bytes in PrgI
});

Expand Down
5 changes: 5 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.