Skip to content

Commit

Permalink
feat: Ember Protocol - Subscribe label changes
Browse files Browse the repository at this point in the history
  • Loading branch information
olzzon committed Jun 29, 2019
1 parent fbaf105 commit 5b83282
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions src/utils/EmberMixerConnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,14 @@ export class EmberMixerConnection {
}
})

ch = 1;
this.store.settings[0].numberOfChannelsInType.forEach((numberOfChannels, typeIndex) => {
for (let channelTypeIndex=0; channelTypeIndex < numberOfChannels ; channelTypeIndex++) {
this.subscribeChannelName(ch, typeIndex, channelTypeIndex);
ch++;
}
})

/*
.CHANNEL_VU)){
window.storeRedux.dispatch({
Expand Down Expand Up @@ -100,7 +108,6 @@ export class EmberMixerConnection {
subscribeFaderLevel(ch: number, typeIndex: number, channelTypeIndex: number) {
this.emberConnection.getNodeByPath(this.mixerProtocol.channelTypes[typeIndex].fromMixer.CHANNEL_FADER_LEVEL[0].mixerMessage.replace("{channel}", String(channelTypeIndex+1)))
.then((node: any) => {
console.log("Subscribing to channel :", ch);
this.emberConnection.subscribe(node, (() => {
window.storeRedux.dispatch({
type:'SET_FADER_LEVEL',
Expand All @@ -111,7 +118,20 @@ export class EmberMixerConnection {
if (window.huiRemoteConnection) {
window.huiRemoteConnection.updateRemoteFaderState(ch-1, node.contents.value);
}
console.log("subscription :", node.contents.value)
})
)
})
}

subscribeChannelName(ch: number, typeIndex: number, channelTypeIndex: number) {
this.emberConnection.getNodeByPath(this.mixerProtocol.channelTypes[typeIndex].fromMixer.CHANNEL_NAME[0].mixerMessage.replace("{channel}", String(channelTypeIndex+1)))
.then((node: any) => {
this.emberConnection.subscribe(node, (() => {
window.storeRedux.dispatch({
type:'SET_CHANNEL_LABEL',
channel: ch-1,
level: node.contents.value
});
})
)
})
Expand Down

0 comments on commit 5b83282

Please sign in to comment.