mirror of
https://github.com/captbaritone/webamp.git
synced 2026-07-22 09:37:17 +00:00
* Revert "Don't re-center windows when loading from serialized state" This reverts commitd778c03f61. * Revert "Clean up comment" This reverts commit8253093a2b. * Revert "Fix spelling of IndexedDB" This reverts commitb34d90e998. * Revert "Add a few more generic assertions about serialized state" This reverts commita8267581d0. * Revert "Refactor debounce and throttle" This reverts commit6ecc5142b5. * Revert "Double check that the serialized state we generated equals the one we have saved" This reverts commit82a81bf584. * Revert "Add many tests for serialization" This reverts commit55603346c2. * Revert "Split serialized state types into their own file" This reverts commit4c9c5b99d3. * Revert "Refactor how we manage window positions" This reverts commitd6a1baece3. * Revert "Fix export" This reverts commit462cf4b42d. * Revert "Clean up selectors file" This reverts commitcdfa99383a. * Revert "Mark serialization methods priviate for now" This reverts commitfc79c77451. * Revert "Add types for WindowManager" This reverts commit0a7f258b64. * Revert "Export Box" This reverts commite94cdef100. * Revert "Use browserSize from state. Make it non-optional" This reverts commit53481ba892. * Revert "Add back resetWindowLayout" This reverts commit35f4004caa. * Revert "Begin tracking window size" This reverts commit96ed2b353c. * Revert "Use namespaced Utils for webamplazy" This reverts commit949a2bc771. * Revert "Use namespaced Utils" This reverts commit3049350701. * Revert "Add initial approach of recovering from bad window positions" This reverts commit1791babf1a. * Revert "Move centerWindowsIfNeeded to an action creatorThis forces us to type it, as a nice side benefit" This reverts commit40e31f0577. * Revert "Make state serialization opt-in (for now)" This reverts commitbef421ebed. * Revert "Persist focus, and handle bad focus" This reverts commit3f1861d4f8. * Revert "Handle the case where `positions` might be an empty object to begin with" This reverts commitf8544ed126. * Revert "Don't center windows when restoring from serialized state" This reverts commitca1cfe3dc6. * Revert "Center windows correctly, even if the windows don't start at 0,0" This reverts commit777d482e73. * Revert "Make hotkeys a function not a singleton class that has side effects when you construct it" This reverts commit87ca43ba45. * Revert "Move global file input out of NPM module" This reverts commit9f726899c7. * Revert "Don't exclude generic windows" This reverts commit245dd166a2. * Revert "Serialize window position as well" This reverts commitb71e09284e. * Revert "Persist window states (exept position)" This reverts commit690f650e4c. * Revert "Serialize media state, and apply equalizer state to on deserialize" This reverts commit94e105b104. * Revert "Add a flag to clear IndexDB state" This reverts commit364ddb7411. * Revert "Serialize state to indexdb" This reverts commit60429b280a.
54 lines
1.3 KiB
TypeScript
54 lines
1.3 KiB
TypeScript
import { BANDS } from "../constants";
|
|
|
|
import { SET_EQ_ON, SET_EQ_OFF, SET_BAND_VALUE } from "../actionTypes";
|
|
import { Band, Dispatchable } from "../types";
|
|
|
|
const BAND_SNAP_DISTANCE = 10;
|
|
const BAND_MID_POINT_VALUE = 50;
|
|
export function setEqBand(band: Band, value: number): Dispatchable {
|
|
if (
|
|
value < BAND_MID_POINT_VALUE + BAND_SNAP_DISTANCE &&
|
|
value > BAND_MID_POINT_VALUE - BAND_SNAP_DISTANCE
|
|
) {
|
|
return { type: SET_BAND_VALUE, band, value: BAND_MID_POINT_VALUE };
|
|
}
|
|
return { type: SET_BAND_VALUE, band, value };
|
|
}
|
|
|
|
function _setEqTo(value: number): Dispatchable {
|
|
return dispatch => {
|
|
Object.values(BANDS).forEach(band => {
|
|
dispatch({
|
|
type: SET_BAND_VALUE,
|
|
value,
|
|
band: band
|
|
});
|
|
});
|
|
};
|
|
}
|
|
|
|
export function setEqToMax(): Dispatchable {
|
|
return _setEqTo(100);
|
|
}
|
|
|
|
export function setEqToMid(): Dispatchable {
|
|
return _setEqTo(50);
|
|
}
|
|
|
|
export function setEqToMin(): Dispatchable {
|
|
return _setEqTo(0);
|
|
}
|
|
|
|
export function setPreamp(value: number): Dispatchable {
|
|
return { type: SET_BAND_VALUE, band: "preamp", value };
|
|
}
|
|
|
|
export function toggleEq(): Dispatchable {
|
|
return (dispatch, getState) => {
|
|
if (getState().equalizer.on) {
|
|
dispatch({ type: SET_EQ_OFF });
|
|
} else {
|
|
dispatch({ type: SET_EQ_ON });
|
|
}
|
|
};
|
|
}
|