forked from nukeop/nuclear
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request nukeop#296 from charjac/feat.equalizer
feat equalizer
- Loading branch information
Showing
30 changed files
with
775 additions
and
28 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 |
---|---|---|
|
@@ -63,4 +63,6 @@ nuclear.json | |
bundle.electron.js | ||
|
||
# Prettier configuration file | ||
.prettierrc | ||
.prettierrc | ||
|
||
package-lock.json |
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 @@ | ||
package-lock=false |
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,31 @@ | ||
export const UPDATE_EQUALIZER = 'UPDATE_EQUALIZER'; | ||
export const SET_EQUALIZER = 'SET_EQUALIZER'; | ||
export const TOGGLE_VISUALIZATION = 'TOGGLE_VISUALIZATION'; | ||
export const SET_VISUALIZATION_DATA = 'SET_VISUALIZATION_DATA'; | ||
|
||
export function updateEqualizer(payload) { | ||
return { | ||
type: UPDATE_EQUALIZER, | ||
payload | ||
}; | ||
} | ||
|
||
export function setEqualizer(payload) { | ||
return { | ||
type: SET_EQUALIZER, | ||
payload | ||
}; | ||
} | ||
|
||
export function toggleVisualization() { | ||
return { | ||
type: TOGGLE_VISUALIZATION | ||
}; | ||
} | ||
|
||
export function setVisualizationData(payload) { | ||
return { | ||
type: SET_VISUALIZATION_DATA, | ||
payload | ||
}; | ||
} |
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,27 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
|
||
import styles from './index.scss'; | ||
|
||
const PreAmp = ({ | ||
onChange, | ||
value | ||
}) => ( | ||
<input | ||
type='range' | ||
onChange={evt => onChange(Number(evt.target.value))} | ||
value={value} | ||
className={styles.preamp} | ||
min={-10} | ||
max={10} | ||
step={1} | ||
/> | ||
); | ||
|
||
PreAmp.propTypes = { | ||
onChange: PropTypes.func.isRequired, | ||
value: PropTypes.number.isRequired | ||
}; | ||
|
||
export default PreAmp; | ||
|
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,9 @@ | ||
.preamp { | ||
-webkit-appearance: slider-vertical !important; | ||
height: 60%; | ||
margin-top: 30px; | ||
cursor: grab !important; | ||
&:active { | ||
cursor: grabbing !important; | ||
} | ||
} |
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,63 @@ | ||
function getChartOptions(data) { | ||
return { | ||
type: 'line', | ||
data, | ||
options: { | ||
events: ['mousemove', 'mousedown'], | ||
onHover: (event, chartElement) => { | ||
switch (event.type) { | ||
case 'mousedown': | ||
event.target.style.cursor = chartElement[0] ? 'grabbing' : 'default'; | ||
break; | ||
default: | ||
event.target.style.cursor = chartElement[0] ? 'grab' : 'default'; | ||
} | ||
}, | ||
responsive: true, | ||
legend: { | ||
display: false | ||
}, | ||
tooltips: { | ||
enabled: false | ||
}, | ||
animation: { | ||
duration: 1000 | ||
}, | ||
scales: { | ||
xAxes: [{ | ||
display: true, | ||
gridLines: { | ||
display: false | ||
}, | ||
scaleLabel: { | ||
display: true | ||
} | ||
}], | ||
yAxes: [{ | ||
ticks: { | ||
display: false, | ||
min: 0, | ||
max: 20 | ||
}, | ||
gridLines: { | ||
display: false | ||
}, | ||
scaleLabel: { | ||
display: false | ||
} | ||
}] | ||
} | ||
} | ||
}; | ||
} | ||
|
||
function formatLabels(frequencies) { | ||
return frequencies.map(freq => { | ||
return freq > 999 | ||
? `${Math.round(freq / 1000)}KHz` | ||
: `${freq}Hz`; | ||
}); | ||
} | ||
|
||
export { getChartOptions, formatLabels }; | ||
|
Oops, something went wrong.