diff --git a/example.js b/example.js index 4064224..e4bf9a1 100644 --- a/example.js +++ b/example.js @@ -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"; diff --git a/index.js b/index.js index 776823e..f3f9151 100644 --- a/index.js +++ b/index.js @@ -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 + * @property {boolean} inTransition Is this currently dissolving? */ - atem.emit('previewBus', source, inTransition); + 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 + * @property {number} source The new program source */ - atem.emit('programBus', source); + atem.emit('programBus', { + me, + source + }); // todo inspect the other bytes in PrgI }); diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..e78269e --- /dev/null +++ b/package-lock.json @@ -0,0 +1,5 @@ +{ + "name": "atem", + "version": "0.1.7", + "lockfileVersion": 1 +}