forked from tv2/sisyfos-audio-controller
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
232 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
MIT License | ||
|
||
Producers Audio Mixer: Copyright (c) TV2 Denmark | ||
Contributions: Copyright (c) 2019 Norsk rikskringkasting AS | ||
Boilerplate: Copyright (c) Alex Devero <[email protected]> (alexdevero.com) | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
|
@@ -20,3 +21,5 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
|
||
Cogwheel icon by Freepik from www.flaticon.com is licensed by CC 3.0 BY |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
.channel-settings-body { | ||
position: absolute; | ||
top: 50%; | ||
left: 50%; | ||
transform: translate(-50%, -50%); | ||
width: 400px; | ||
overflow: auto; | ||
max-height: 90vh; | ||
background-color: rgb(31, 31, 31); | ||
border-color: rgb(124, 124, 124); | ||
border-style: solid; | ||
border-width: 4px; | ||
text-align: center; | ||
z-index: 1; | ||
|
||
color: #fff; | ||
} | ||
|
||
.channel-settings-body > h2 { | ||
border-bottom: 1px solid #999; | ||
margin: 0; | ||
padding: 10px 0; | ||
line-height: 50px; | ||
} | ||
|
||
.channel-settings-body > .close { | ||
position: absolute; | ||
outline : none; | ||
border-color: rgb(99, 99, 99); | ||
background-color: rgb(27, 27, 27); | ||
border-radius: 100%; | ||
display: block; | ||
color: #fff; | ||
width: 50px; | ||
height: 50px; | ||
font-size: 30px; | ||
line-height: 50px; | ||
top: 9px; | ||
right: 9px; | ||
} | ||
|
||
.channel-settings-group { | ||
border-bottom: 1px solid #999; | ||
} | ||
|
||
.channel-settings-group > button { | ||
line-height: 10px; | ||
|
||
outline : none; | ||
border-color: rgb(99, 99, 99); | ||
background-color: rgb(27, 27, 27); | ||
margin-right: auto; | ||
margin-top: 15px; | ||
margin-bottom: 15px; | ||
margin-left: auto; | ||
border-radius: 7px; | ||
display: block; | ||
color: #fff; | ||
width: 90%; | ||
font-size: 30px; | ||
line-height: 50px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
import React from 'react'; | ||
|
||
import '../assets/css/ChannelSettings.css'; | ||
import { IMixerProtocolGeneric, MixerProtocolPresets, ICasparCGMixerGeometry } from '../constants/MixerProtocolPresets'; | ||
import { Store } from 'redux'; | ||
import { connect } from 'react-redux'; | ||
|
||
interface IChannelSettingsInjectProps { | ||
label: string, | ||
mixerProtocol: string, | ||
} | ||
|
||
interface IChannelProps { | ||
channelIndex: number | ||
} | ||
|
||
class ChannelSettings extends React.PureComponent<IChannelProps & IChannelSettingsInjectProps & Store> { | ||
mixerProtocol: ICasparCGMixerGeometry | undefined; | ||
channelIndex: number; | ||
|
||
constructor(props: any) { | ||
super(props); | ||
this.channelIndex = this.props.channelIndex; | ||
const protocol = MixerProtocolPresets[this.props.mixerProtocol] as ICasparCGMixerGeometry; | ||
if (protocol.sourceOptions) { | ||
this.mixerProtocol = protocol; | ||
} | ||
} | ||
|
||
handleOption = (prop: string, option: string) => { | ||
this.props.dispatch({ | ||
type: 'SET_OPTION', | ||
channel: this.channelIndex, | ||
prop, | ||
option | ||
}); | ||
} | ||
|
||
handleClose = () => { | ||
this.props.dispatch({ | ||
type: 'TOGGLE_SHOW_OPTION', | ||
channel: this.channelIndex | ||
}); | ||
} | ||
|
||
render() { | ||
return ( | ||
<div className="channel-settings-body"> | ||
<h2>{this.props.label || ("CH " + (this.channelIndex + 1))}</h2> | ||
<button className="close" onClick={() => this.handleClose()}>X</button> | ||
{this.mixerProtocol && | ||
this.mixerProtocol.sourceOptions && | ||
Object.getOwnPropertyNames(this.mixerProtocol.sourceOptions.options).map(prop => { | ||
return ( | ||
<div className="channel-settings-group" key={prop}> | ||
{Object.getOwnPropertyNames(this.mixerProtocol!.sourceOptions!.options[prop]).map(option => { | ||
console.log(prop, option) | ||
return <button key={option} className="channel-settings-group-item" onClick={() => this.handleOption(prop, this.mixerProtocol!.sourceOptions!.options[prop][option])}>{option}</button> | ||
}) || null} | ||
</div> | ||
) | ||
})} | ||
</div> | ||
) | ||
} | ||
} | ||
|
||
const mapStateToProps = (state: any, props: any): IChannelSettingsInjectProps => { | ||
console.log(state.channels[0].channel, props.channelIndex); | ||
return { | ||
label: state.channels[0].channel[props.channelIndex].label, | ||
mixerProtocol: state.settings[0].mixerProtocol | ||
} | ||
} | ||
|
||
export default connect<any, IChannelSettingsInjectProps>(mapStateToProps)(ChannelSettings) as any; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters