mirror of
https://github.com/captbaritone/webamp.git
synced 2026-07-22 17:47:16 +00:00
[WIP]
This commit is contained in:
parent
2cd4f7e100
commit
59666b8699
4 changed files with 30 additions and 4 deletions
|
|
@ -8,6 +8,17 @@ const USER_PRESET_TRANSITION_SECONDS = 5.7;
|
|||
const PRESET_TRANSITION_SECONDS = 2.7;
|
||||
const MILLISECONDS_BETWEEN_PRESET_TRANSITIONS = 15000;
|
||||
|
||||
function transitionTimeFromTransitionType(transitionType) {
|
||||
switch (transitionType) {
|
||||
case "DEFAULT":
|
||||
return PRESET_TRANSITION_SECONDS;
|
||||
case "IMMEDIATE":
|
||||
return 0;
|
||||
case "USER_PRESET":
|
||||
return USER_PRESET_TRANSITION_SECONDS;
|
||||
}
|
||||
}
|
||||
|
||||
class Milkdrop extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
|
|
@ -195,7 +206,7 @@ class Milkdrop extends React.Component {
|
|||
this.selectPreset(await this.props.presets.previous(), blendTime);
|
||||
}
|
||||
|
||||
selectPreset(preset, blendTime = 0) {
|
||||
selectPreset(preset, blendTime) {
|
||||
if (preset != null) {
|
||||
this.visualizer.loadPreset(preset, blendTime);
|
||||
this._restartCycling();
|
||||
|
|
@ -265,7 +276,8 @@ class Milkdrop extends React.Component {
|
|||
const mapStateToProps = state => ({
|
||||
trackTitle: Selectors.getCurrentTrackDisplayName(state),
|
||||
presets: Selectors.getPresets(state),
|
||||
butterchurn: Selectors.getButterchurn(state)
|
||||
butterchurn: Selectors.getButterchurn(state),
|
||||
transitionType: Selectors.getPresetTransitionType(state)
|
||||
});
|
||||
|
||||
export default connect(mapStateToProps)(Milkdrop);
|
||||
|
|
|
|||
|
|
@ -4,17 +4,20 @@ import {
|
|||
INITIALIZE_PRESETS,
|
||||
GOT_BUTTERCHURN
|
||||
} from "../actionTypes";
|
||||
import { TransitionType } from "../types";
|
||||
|
||||
export interface MilkdropState {
|
||||
desktop: boolean;
|
||||
presets: any;
|
||||
butterchurn: any;
|
||||
transitionType: TransitionType;
|
||||
}
|
||||
|
||||
const defaultMilkdropState = {
|
||||
desktop: false,
|
||||
presets: null,
|
||||
butterchurn: null
|
||||
butterchurn: null,
|
||||
transitionType: TransitionType.DEFAULT
|
||||
};
|
||||
|
||||
export const milkdrop = (
|
||||
|
|
|
|||
|
|
@ -6,7 +6,8 @@ import {
|
|||
WindowInfo,
|
||||
LoadedURLTrack,
|
||||
WindowPositions,
|
||||
PlaylistStyle
|
||||
PlaylistStyle,
|
||||
TransitionType
|
||||
} from "./types";
|
||||
import { createSelector } from "reselect";
|
||||
import * as Utils from "./utils";
|
||||
|
|
@ -620,3 +621,7 @@ export function getPresets(state: AppState): any {
|
|||
export function getButterchurn(state: AppState): any {
|
||||
return state.milkdrop.butterchurn;
|
||||
}
|
||||
|
||||
export function getPresetTransitionType(state: AppState): TransitionType {
|
||||
return state.milkdrop.transitionType;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -146,6 +146,12 @@ export interface EqfPreset {
|
|||
preamp: number;
|
||||
}
|
||||
|
||||
export enum TransitionType {
|
||||
IMMEDIATE,
|
||||
DEFAULT,
|
||||
USER_PRESET
|
||||
}
|
||||
|
||||
export type Action =
|
||||
| {
|
||||
type: "@@init";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue