Fix eqf value normalization

This commit is contained in:
Jordan Eldredge 2017-06-02 19:43:54 -07:00
parent ea7bd51aed
commit 1e1b5eb628
2 changed files with 9 additions and 2 deletions

View file

@ -95,7 +95,8 @@ export function toggleShuffle() {
return { type: TOGGLE_SHUFFLE };
}
const normalize = hrz => hrz / 63 * 100;
export const normalize = hrz => Math.round((hrz - 1) / 63 * 100);
function setEqFromFile(file) {
return dispatch => {
file.processBuffer(arrayBuffer => {

View file

@ -18,7 +18,8 @@ import {
setEqBand,
setEqToMax,
setEqToMin,
setEqToMid
setEqToMid,
normalize
} from "./actionCreators";
test("stop", () => {
@ -123,3 +124,8 @@ test("setEqToMid", () => {
]);
expect(mockDispatch.mock.calls).toEqual(expectedCalls);
});
test("normalize", () => {
expect(normalize(1)).toBe(0);
expect(normalize(64)).toBe(100);
});