Skip to content

Commit

Permalink
Merge pull request #82 from olzzon/develop
Browse files Browse the repository at this point in the history
Individual VO fadeTime, and Route-All buttons
  • Loading branch information
olzzon authored Oct 11, 2019
2 parents 8d8a766 + 09ae478 commit 148a856
Show file tree
Hide file tree
Showing 7 changed files with 142 additions and 58 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
"build-now": "webpack --config webpack.build.config.js --mode production",
"package": "yarn run build",
"postpackage": "electron-packager --overwrite ./ --out=./builds --overwrite",
"package-linux": "electron-packager . sisyfos-audio-controller --overwrite --asar=true --platform=linux --arch=x64 --prune=true --out=builds",
"package-win": "electron-packager . sisyfos-audio-controller --overwrite --asar=true --platform=win32 --arch=x64 --prune=true --out=builds",
"package-linux": "electron-packager . sisyfos-audio-controller --overwrite --asar --platform=linux --arch=x64 --prune=true --out=builds",
"package-win": "electron-packager . sisyfos-audio-controller --overwrite --asar --platform=win32 --arch=x64 --prune=true --out=builds",
"package-release": "yarn package && yarn package-win && yarn package-linux"
},
"dependencies": {
Expand Down
3 changes: 2 additions & 1 deletion src/assets/css/Channel.css
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,10 @@
width: 460px;
margin-top: 260px;
transform: translate(-160px, 0px) rotate(270deg);

/*do same for other browsers if required*/
background-color: rgb(39, 39, 39);

-webkit-overflow-scrolling: touch;
}

.channel-body.with-snaps .channel-volume-slider {
Expand Down
30 changes: 10 additions & 20 deletions src/assets/css/ChannelRouteSettings.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.channel-settings-body {
.channel-route-body {
position: absolute;
top: 50%;
left: 50%;
Expand All @@ -16,7 +16,7 @@
color: #fff;
}

.channel-settings-body > h2 {
.channel-route-body > h2 {
border-bottom: 1px solid #999;
margin: 0;
padding: 10px 0;
Expand All @@ -26,7 +26,7 @@
}


.channel-settings-body > h4 {
.channel-route-body > h4 {
margin: 0;
margin-left: 40px;
padding: 0px 0;
Expand All @@ -35,7 +35,7 @@
font-size: 110%;
}

.channel-settings-body > .close {
.channel-route-body > .close {
position: absolute;
outline : none;
border-color: rgb(99, 99, 99);
Expand All @@ -47,32 +47,22 @@
height: 50px;
font-size: 30px;
line-height: 50px;
top: 9px;
top: -5px;
right: 9px;
}

.channel-settings-group {
border-bottom: 1px solid #999;
}

.channel-settings-group > button {
.channel-route-body > button {
line-height: 10px;

outline : none;
border-color: rgb(99, 99, 99);
background-color: rgb(27, 27, 27);
margin-right: auto;
margin-right: 10px;
margin-top: 15px;
margin-bottom: 15px;
margin-left: auto;
margin-left: 10px;
border-radius: 7px;
display: block;
color: #fff;
width: 90%;
font-size: 30px;
width: 34%;
font-size: 10px;
line-height: 50px;
}

.channel-settings-group > button.active {
border-color: rgb(17, 0, 255);
}
110 changes: 83 additions & 27 deletions src/components/ChannelRouteSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ import CcgChannelSettings from './CcgChannelSettings';
const { dialog } = require('electron').remote;

interface IChannelSettingsInjectProps {
label: string,
label: string,
selectedProtocol: string,
numberOfChannelsInType: Array<number>,
channel: Array<any>
fader: Array<any>
}

interface IChannelProps {
faderIndex: number
faderIndex: number
}

class ChannelRouteSettings extends React.PureComponent<IChannelProps & IChannelSettingsInjectProps & Store> {
Expand All @@ -26,21 +26,21 @@ class ChannelRouteSettings extends React.PureComponent<IChannelProps & IChannelS

constructor(props: any) {
super(props);
this.faderIndex = this.props.faderIndex;
this.mixerProtocol = MixerProtocolPresets[this.props.selectedProtocol];
this.faderIndex = this.props.faderIndex;
this.mixerProtocol = MixerProtocolPresets[this.props.selectedProtocol];
}

handleAssignChannel(channel: number, event: any) {
let faderAssign = this.faderIndex
let assignedFader = this.props.channel[channel].assignedFader
let assignedFaderLabel = (assignedFader >= 0)
? this.props.fader[assignedFader].label
let assignedFaderLabel = (assignedFader >= 0)
? this.props.fader[assignedFader].label
: 'undefined'
assignedFaderLabel = (assignedFaderLabel === '')
assignedFaderLabel = (assignedFaderLabel === '')
? String(assignedFader + 1)
: assignedFaderLabel

if (event.target.checked === false) {
if (event.target.checked === false) {
const options = {
type: 'question',
buttons: ['Yes', 'Cancel'],
Expand All @@ -56,8 +56,8 @@ class ChannelRouteSettings extends React.PureComponent<IChannelProps & IChannelS
faderAssign = -1
} else {
let detail = (assignedFader < 0) ? 'NOT CURRENTLY ASSIGNED'
: 'CHANNEL ' + String(channel + 1) + ' IS CURRENTLY CONNECTED TO FADER ' + String(assignedFaderLabel)
: 'CHANNEL ' + String(channel + 1) + ' IS CURRENTLY CONNECTED TO FADER ' + String(assignedFaderLabel)

const options = {
type: 'question',
buttons: ['Yes', 'Cancel'],
Expand All @@ -80,36 +80,92 @@ class ChannelRouteSettings extends React.PureComponent<IChannelProps & IChannelS
return true;
}

handleClose = () => {
this.props.dispatch({
type: 'TOGGLE_SHOW_OPTION',
channel: this.faderIndex
});
}
handleClearRouting() {
const options = {
type: 'question',
buttons: ['Yes', 'Cancel'],
defaultId: 1,
title: 'WARNING',
message: 'WARNING!!!!!',
detail: 'This will remove all Fader-Channel assignments',
};
let response = dialog.showMessageBoxSync(options)
if (response === 0) {
this.props.channel.forEach((channel: any, index: number) => {
this.props.dispatch({
type: 'SET_ASSIGNED_FADER',
channel: index,
faderNumber: -1
});
})
}
return true
}

handle11Routing() {
const options = {
type: 'question',
buttons: ['Yes', 'Cancel'],
defaultId: 1,
title: 'WARNING',
message: 'WARNING!!!!!',
detail: 'This will reassign all Faders 1:1 to Channels',
};
let response = dialog.showMessageBoxSync(options)
if (response === 0) {
this.props.fader.forEach((fader: any, index: number) => {
if (this.props.channel.length > index) {
this.props.dispatch({
type: 'SET_ASSIGNED_FADER',
channel: index,
faderNumber: index
});
}
})
}
return true
}

handleClose = () => {
this.props.dispatch({
type: 'TOGGLE_SHOW_OPTION',
channel: this.faderIndex
});
}

render() {
if (this.props.selectedProtocol.includes("caspar")) {
return (
<CcgChannelSettings channelIndex= {this.props.faderIndex}/>
)
}
<CcgChannelSettings channelIndex={this.props.faderIndex} />
)
}
else {
return (
<div className="channel-settings-body">
<div className="channel-route-body">
<h2>{this.props.label || ("FADER " + (this.faderIndex + 1))}</h2>
<button className="close" onClick={() => this.handleClose()}>X</button>


<button
className="close"
onClick={() => this.handleClose()}
>X</button>
<button
className="button"
onClick={() => this.handleClearRouting()}
>CLEAR ALL</button>
<button
className="button"
onClick={() => this.handle11Routing()}
>ROUTE 1:1</button>
<hr />
{this.props.channel.map((channel: any, index: number) => {
return <h4 key={index}>
{(" Channel " + (index + 1) + " : " )}
{(" Channel " + (index + 1) + " : ")}
<input
type="checkbox"
checked={ this.props.channel[index].assignedFader === this.faderIndex }
checked={this.props.channel[index].assignedFader === this.faderIndex}
onChange={(event) => this.handleAssignChannel(index, event)}
/>
{this.props.channel[index].assignedFader >=0
? ( " (Fader " + (this.props.channel[index].assignedFader + 1) + ")")
{this.props.channel[index].assignedFader >= 0
? (" (Fader " + (this.props.channel[index].assignedFader + 1) + ")")
: ' (not assigned)'}
</h4>
})
Expand Down
16 changes: 14 additions & 2 deletions src/components/Settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -316,8 +316,15 @@ class Settings extends React.PureComponent<IAppProps & Store, IState> {
</label>
<br/>
<label className="settings-input-field">
FADE TIME IN ms :
FADE TIME :
<input name="fadeTime" type="text" value={this.state.settings.fadeTime} onChange={this.handleChange} />
ms
</label>
<br/>
<label className="settings-input-field">
VOICE OVER FADE TIME :
<input name="voFadeTime" type="text" value={this.state.settings.voFadeTime} onChange={this.handleChange} />
ms
</label>
<br/>
<label className="settings-input-field">
Expand All @@ -326,7 +333,12 @@ class Settings extends React.PureComponent<IAppProps & Store, IState> {
%
</label>
<br/>

<label className="settings-input-field">
AUTORESET LEVEL :
<input name="autoResetLevel" type="text" value={this.state.settings.autoResetLevel} onChange={this.handleChange} />
%
</label>
<br/>
<label className="settings-input-field">
PROTOCOL LATENCY :
<input name="protocolLatency" type="text" value={this.state.settings.protocolLatency} onChange={this.handleChange} />
Expand Down
14 changes: 9 additions & 5 deletions src/reducers/settingsReducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export interface ISettings {
localOscPort: number,
deviceIp: string,
devicePort: number,
protocolLatency: number,
protocolLatency: number, // If a protocol has latency and feedback, the amount of time before enabling receiving data from channel again
enableRemoteFader: boolean,
mixerMidiInputPort: string,
mixerMidiOutputPort: string,
Expand All @@ -20,9 +20,11 @@ export interface ISettings {
numberOfChannelsInType: Array<number>,
numberOfFaders: number,
numberOfSnaps: number,
fadeTime: number,
voLevel: number,
automationMode: boolean,
fadeTime: number, // Default fade time for PGM ON - OFF
voFadeTime: number, // Default fade time for VO ON - OFF
voLevel: number, // Relative level of PGM in %
autoResetLevel: number, // Autoreset before pgm on, if level is lower than in %
automationMode: boolean,
showPfl: boolean
}

Expand All @@ -48,8 +50,10 @@ const defaultSettingsReducerState: Array<ISettings> = [
numberOfFaders: 8,
numberOfSnaps: DEFAULTS.NUMBER_OF_SNAPS,
voLevel: 20,
autoResetLevel: 10,
automationMode: true,
fadeTime: 60, //Time in ms
fadeTime: 60,
voFadeTime: 200,
showPfl: false
},
];
Expand Down
23 changes: 22 additions & 1 deletion src/utils/MixerConnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,15 @@ export class MixerGenericConnection {
});
}

updateOutLevel(faderIndex: number, fadeTime: number = this.store.settings[0].fadeTime) {
updateOutLevel(faderIndex: number, fadeTime: number = -1) {
if (fadeTime === -1) {
if (this.store.faders[0].fader[faderIndex].voOn) {
fadeTime = this.store.settings[0].voFadeTime
} else {
fadeTime = this.store.settings[0].fadeTime
}
}

this.store.channels[0].channel.map((channel: IChannel, index: number) => {
if (faderIndex === channel.assignedFader) {
this.fadeInOut(index, fadeTime);
Expand Down Expand Up @@ -123,6 +131,19 @@ export class MixerGenericConnection {
fadeUp(channelIndex: number, fadeTime: number, faderIndex: number) {
let outputLevel = parseFloat(this.store.channels[0].channel[channelIndex].outputLevel);
let targetVal = parseFloat(this.store.faders[0].fader[faderIndex].faderLevel);

// Reset targetVal if it´s lower than AutoReset threshold:
if (targetVal < (this.store.settings[0].autoResetLevel/100)
&& this.store.channels[0].channel[channelIndex].outputLevel === this.mixerProtocol.fader.min
) {
targetVal = this.mixerProtocol.fader.zero
window.storeRedux.dispatch({
type:'SET_FADER_LEVEL',
channel: faderIndex,
level: targetVal
});
}

if (this.store.faders[0].fader[faderIndex].voOn) {
targetVal = targetVal * (100-parseFloat(this.store.settings[0].voLevel))/100
}
Expand Down

0 comments on commit 148a856

Please sign in to comment.