Skip to content

Commit

Permalink
Merge pull request #274 from tv2/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
olzzon authored Sep 8, 2023
2 parents 663adcf + e773a90 commit 1b7d1ec
Show file tree
Hide file tree
Showing 25 changed files with 769 additions and 553 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,9 @@ To set the state send these OSC commands from you Automation to ProducersAudioMi

#### Set channel faderlevel:

/ch/1/mix/faderlevel - float {between 0 and 1}
(the first defines the fader level)
(if second is missing it will take default fade value)
/ch/1/mix/faderlevel - float {between 0 and 1} - float { fadetime in ms }

#### Set channel label:

Expand Down
2 changes: 1 addition & 1 deletion client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"@types/node": "^18.16.0",
"@types/react-dom": "^18.2.4",
"@types/react-test-renderer": "^18.0.0",
"@babel/core": "^7.21.8",
"@babel/core": "^7.22.10",
"css-loader": "^6.7.3",
"html-webpack-plugin": "^5.5.1",
"react-test-renderer": "^18.2.0",
Expand Down
4 changes: 2 additions & 2 deletions client/src/components/ChanStrip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,15 @@ class ChanStrip extends React.PureComponent<
changeDelay(currentValue: number, addValue: number) {
window.socketIoClient.emit(SOCKET_SET_FX, {
fxParam: fxParamsList.DelayTime,
channel: this.props.faderIndex,
faderIndex: this.props.faderIndex,
level: currentValue + addValue,
})
}

handleFx(fxParam: fxParamsList, event: any) {
window.socketIoClient.emit(SOCKET_SET_FX, {
fxParam: fxParam,
channel: this.props.faderIndex,
faderIndex: this.props.faderIndex,
level: parseFloat(event),
})
}
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/ChanStripEq.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class ChanStripEq extends React.PureComponent<
// window.storeRedux.dispatch(storeFaderFx(fxParam, this.props.faderIndex, parseFloat(level)))
window.socketIoClient.emit(SOCKET_SET_FX, {
fxParam: fxParam,
channel: this.props.faderIndex,
faderIndex: this.props.faderIndex,
level: parseFloat(level),
})
}
Expand Down
4 changes: 2 additions & 2 deletions client/src/components/ChanStripFull.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class ChanStripFull extends React.PureComponent<
changeDelay(currentValue: number, addValue: number) {
window.socketIoClient.emit(SOCKET_SET_FX, {
fxParam: fxParamsList.DelayTime,
channel: this.props.faderIndex,
faderIndex: this.props.faderIndex,
level: currentValue + addValue,
})
}
Expand All @@ -103,7 +103,7 @@ class ChanStripFull extends React.PureComponent<
// window.storeRedux.dispatch(storeFaderFx(fxParam, this.props.faderIndex, parseFloat(level)))
window.socketIoClient.emit(SOCKET_SET_FX, {
fxParam: fxParam,
channel: this.props.faderIndex,
faderIndex: this.props.faderIndex,
level: parseFloat(level),
})
}
Expand Down
1 change: 1 addition & 0 deletions client/src/components/Channel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ class Channel extends React.Component<
nextProps.settings.showChanStrip !=
this.props.settings.showChanStrip ||
nextProps.fader.amixOn != this.props.fader.amixOn ||
nextProps.fader.assignedChannels != this.props.fader.assignedChannels ||
XOR(nextProps.fader.capabilities, this.props.fader.capabilities) ||
XOR(
nextProps.fader.capabilities?.hasAMix,
Expand Down
11 changes: 6 additions & 5 deletions client/src/components/ChannelMonitorOptions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class ChannelMonitorOptions extends React.PureComponent<
if (
window.confirm(
'This will remove all monitor assignments to Aux :' +
String(this.props.fader[this.faderIndex].monitor)
String(this.props.fader[this.faderIndex].monitor)
)
) {
this.props.channel.forEach((channel: any, index: number) => {
Expand All @@ -81,7 +81,7 @@ class ChannelMonitorOptions extends React.PureComponent<
if (
window.confirm(
'Send all channels to Aux: ' +
String(this.props.fader[this.faderIndex].monitor)
String(this.props.fader[this.faderIndex].monitor)
)
) {
this.props.channel.forEach((channel: any, index: number) => {
Expand Down Expand Up @@ -154,10 +154,11 @@ class ChannelMonitorOptions extends React.PureComponent<
/>
<hr />
{this.props.channel.map((channel: any, index: number) => {
let isSelected: boolean =
this.props.channel[index].auxLevel[
let isSelected: boolean = (
channel.auxLevel[
this.props.fader[this.faderIndex].monitor - 1
]
] >= 0
)
return (
<div
key={index}
Expand Down
128 changes: 63 additions & 65 deletions client/src/components/ChannelRouteSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import '../assets/css/ChannelRouteSettings.css'
import { Store } from 'redux'
import { connect } from 'react-redux'
import { storeShowOptions } from '../../../shared/src/actions/settingsActions'
import { SOCKET_SET_ASSIGNED_FADER } from '../../../shared/src/constants/SOCKET_IO_DISPATCHERS'
import { SOCKET_ASSIGN_CH_TO_FADER, SOCKET_REMOVE_ALL_CH_ASSIGNMENTS } from '../../../shared/src/constants/SOCKET_IO_DISPATCHERS'
import { IchMixerConnection } from '../../../shared/src/reducers/channelsReducer'
import { IFader } from '../../../shared/src/reducers/fadersReducer'
import { IChannelReference, IFader } from '../../../shared/src/reducers/fadersReducer'
import { getFaderLabel } from '../utils/labels'

interface IChannelSettingsInjectProps {
Expand All @@ -30,76 +30,60 @@ class ChannelRouteSettings extends React.PureComponent<
this.faderIndex = this.props.faderIndex
}

handleAssignChannel(mixerIndex: number, channel: number, event: any) {
if (event.target.checked === false) {
console.log('Unbinding Channel')
if (
window.confirm(
'Unbind Mixer ' +
String(mixerIndex + 1) +
' Channel ' +
String(channel + 1) +
' from Fader ' +
String(this.faderIndex + 1)
)
) {
window.socketIoClient.emit(SOCKET_SET_ASSIGNED_FADER, {
mixerIndex: mixerIndex,
channel: channel,
faderAssign: -1,
})
}
} else {
console.log('Binding Channel')
if (
window.confirm(
'Bind Mixer ' +
String(mixerIndex + 1) +
' Channel ' +
String(channel + 1) +
' to Fader ' +
String(this.faderIndex + 1) +
'?'
)
) {
window.socketIoClient.emit(SOCKET_SET_ASSIGNED_FADER, {
mixerIndex: mixerIndex,
channel: channel,
faderAssign: this.faderIndex,
handleAssignChannel(mixerIndex: number, channelIndex: number, event: any) {
console.log('Bind/Unbind Channel')
if (
window.confirm(
'Bind/Unbind Mixer ' +
String(mixerIndex + 1) +
' Channel ' +
String(channelIndex + 1) +
' from Fader ' +
String(this.faderIndex + 1)
)
) {
// Check if channel already is assigned to another fader and remove that binding prior to bind it to the new fader
if (event.target.checked) {
this.props.fader.forEach((fader: IFader, index: number) => {
if (fader.assignedChannels.some((assignedChan) => {
return assignedChan.mixerIndex === mixerIndex && assignedChan.channelIndex === channelIndex
})) {
window.socketIoClient.emit(SOCKET_ASSIGN_CH_TO_FADER, {
mixerIndex: mixerIndex,
channel: channelIndex,
faderIndex: index,
assigned: false
})
}
})
}


window.socketIoClient.emit(SOCKET_ASSIGN_CH_TO_FADER, {
mixerIndex: mixerIndex,
channel: channelIndex,
faderIndex: this.faderIndex,
assigned: event.target.checked
})
}
}

handleClearRouting() {
handleClearAllRouting() {
if (window.confirm('REMOVE ALL FADER ASSIGNMENTS????')) {
this.props.chMixerConnections.forEach(
(chMixerConnection: IchMixerConnection, mixerIndex: number) => {
chMixerConnection.channel.forEach(
(channel: any, index: number) => {
window.socketIoClient.emit(
SOCKET_SET_ASSIGNED_FADER,
{
mixerIndex: mixerIndex,
channel: index,
faderAssign: -1,
}
)
}
)
}
)
window.socketIoClient.emit(SOCKET_REMOVE_ALL_CH_ASSIGNMENTS)
}
}

handle11Routing() {
handleOneToOneRouting() {
if (window.confirm('Reassign all Faders 1:1 to Channels????')) {
window.socketIoClient.emit(SOCKET_REMOVE_ALL_CH_ASSIGNMENTS)
this.props.fader.forEach((fader: any, index: number) => {
if (this.props.chMixerConnections[0].channel.length > index) {
window.socketIoClient.emit(SOCKET_SET_ASSIGNED_FADER, {
window.socketIoClient.emit(SOCKET_ASSIGN_CH_TO_FADER, {
mixerIndex: 0,
channel: index,
faderAssign: index,
faderIndex: index,
assigned: true
})
}
})
Expand All @@ -110,6 +94,19 @@ class ChannelRouteSettings extends React.PureComponent<
this.props.dispatch(storeShowOptions(this.faderIndex))
}

getAssignedToFaderIndex = (channel: IChannelReference): number => {
let assignedFaderIndex = -1
this.props.fader.forEach((fader: any, index: number) => {

if (fader.assignedChannels.some((assignedChan: IChannelReference) => {
return assignedChan.channelIndex === channel.channelIndex && assignedChan.mixerIndex === channel.mixerIndex
}))
assignedFaderIndex = index
})
return assignedFaderIndex
}


renderMixer(chMixerConnection: IchMixerConnection, mixerIndex: number) {
return (
<div>
Expand All @@ -118,19 +115,20 @@ class ChannelRouteSettings extends React.PureComponent<
{'MIXER ' + (mixerIndex + 1)}
</p>
{chMixerConnection.channel.map((channel: any, index: number) => {
const assignedFaderIndex = this.getAssignedToFaderIndex({ mixerIndex: mixerIndex, channelIndex: index })
return (
<div
key={index}
className={ClassNames('channel-route-text', {
checked:
channel.assignedFader === this.faderIndex,
assignedFaderIndex === this.faderIndex,
})}
>
{' Channel ' + (index + 1) + ' : '}
<input
type="checkbox"
checked={
channel.assignedFader === this.faderIndex
assignedFaderIndex === this.faderIndex
}
onChange={(event) =>
this.handleAssignChannel(
Expand All @@ -140,10 +138,10 @@ class ChannelRouteSettings extends React.PureComponent<
)
}
/>
{channel.assignedFader >= 0
{assignedFaderIndex >= 0
? ' (Fader ' +
(channel.assignedFader + 1) +
')'
(assignedFaderIndex + 1) +
')'
: ' (not assigned)'}
</div>
)
Expand All @@ -161,13 +159,13 @@ class ChannelRouteSettings extends React.PureComponent<
</button>
<button
className="button"
onClick={() => this.handleClearRouting()}
onClick={() => this.handleClearAllRouting()}
>
CLEAR ALL
</button>
<button
className="button"
onClick={() => this.handle11Routing()}
onClick={() => this.handleOneToOneRouting()}
>
ROUTE 1.Mixer 1:1
</button>
Expand Down
2 changes: 1 addition & 1 deletion server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"typescript": "^5.0.4"
},
"dependencies": {
"@babel/core": "^7.21.8",
"@babel/core": "^7.22.10",
"@tv2media/logger": "^2.0.1",
"atem-connection": "^3.2.0",
"casparcg-connection": "^5.1.0",
Expand Down
Loading

0 comments on commit 1b7d1ec

Please sign in to comment.