Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
steve-mackinnon committed Mar 24, 2024
1 parent d28273d commit 445e679
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 28 deletions.
1 change: 0 additions & 1 deletion src/adapters/firestorePersistenceAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { Project } from "../entities/project";
import { Pattern } from "../entities/pattern";
import { Note } from "../entities/note";
import { ScaleType } from "../entities/musicalScale";
import { Song } from "../entities/song";

export interface ProjectPayload {
readers: string[];
Expand Down
8 changes: 2 additions & 6 deletions src/components/SequencerStep.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,6 @@ export function SequencerStep(props: SequencerStepProps): ReactElement {
}
};

const onStepEnableChange = (event: any): void => {
dispatchStepToggleEvent();
};

const inputClassNames: String[] = [styles.SequencerStep];
if (isEffectivelyMuted) {
inputClassNames.push(styles.muted);
Expand All @@ -79,9 +75,9 @@ export function SequencerStep(props: SequencerStepProps): ReactElement {
type="checkbox"
className={inputClassNames.join(" ")}
checked={stepState.enabled}
onChange={onStepEnableChange}
onChange={() => dispatchStepToggleEvent()}
ref={inputRef}
onFocus={(event: React.FocusEvent<HTMLInputElement, Element>) => {
onFocus={() => {
// Hack to fix bug where pressing spacebar for playback toggle
// would toggle a step if had focus.
if (inputRef.current != null) {
Expand Down
6 changes: 3 additions & 3 deletions src/engine/audioEngine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,20 @@ export class AudioEngine {
return;
}
if (playing) {
const notifyPlaybackListeners = (playing: boolean): void => {
const notifyPlaybackListeners = () => {
this._playing = true;
this._playbackListeners.forEach((listener) => listener(true));
};
if (context.state !== "running") {
start()
.then(() => {
notifyPlaybackListeners(true);
notifyPlaybackListeners();
})
.catch((e: any) => {
console.log(e);
});
} else {
notifyPlaybackListeners(true);
notifyPlaybackListeners();
}
} else {
// Transport.stop();
Expand Down
4 changes: 2 additions & 2 deletions src/engine/sequencerEngine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function makeGenerator(
}
}

function makeStepsForTrack(numSteps: number, trackId: number): Step[] {
function makeStepsForTrack(numSteps: number): Step[] {
const steps = new Array<Step>(numSteps);
for (const stepIndex of Array(numSteps).keys()) {
const enabled = Math.random() > 0.5;
Expand Down Expand Up @@ -89,7 +89,7 @@ export class SequencerEngine {
this._masterFX = new Limiter(-4.0).toDestination();

for (const trackIndex of Array(this.numTracks).keys()) {
this._steps[trackIndex] = makeStepsForTrack(this._numSteps, trackIndex);
this._steps[trackIndex] = makeStepsForTrack(this._numSteps);
this._trackStates[trackIndex] = {
muted: false,
generatorType: GeneratorType.SineBleep,
Expand Down
24 changes: 12 additions & 12 deletions src/entities/paramInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export interface ParamInfo {
valueSelector: (state: RootState, trackId: number) => number;
}

function getDecayTimeParamInfo(trackId: number): ParamInfo {
function getDecayTimeParamInfo(): ParamInfo {
return {
name: "decayTime",
displayName: "Decay",
Expand All @@ -23,7 +23,7 @@ function getDecayTimeParamInfo(trackId: number): ParamInfo {
};
}

function getGainParamInfo(trackId: number): ParamInfo {
function getGainParamInfo(): ParamInfo {
return {
name: "gain",
displayName: "Gain",
Expand All @@ -35,7 +35,7 @@ function getGainParamInfo(trackId: number): ParamInfo {
};
}

function getTriggerProbabilityParamInfo(trackId: number): ParamInfo {
function getTriggerProbabilityParamInfo(): ParamInfo {
return {
name: "triggerProbability",
displayName: "Chance",
Expand All @@ -47,11 +47,11 @@ function getTriggerProbabilityParamInfo(trackId: number): ParamInfo {
};
}

function getCommonParamsForTrack(trackId: number): ParamInfo[] {
function getCommonParamsForTrack(): ParamInfo[] {
return [
getGainParamInfo(trackId),
getDecayTimeParamInfo(trackId),
getTriggerProbabilityParamInfo(trackId),
getGainParamInfo(),
getDecayTimeParamInfo(),
getTriggerProbabilityParamInfo(),
];
}

Expand All @@ -60,7 +60,7 @@ export function paramInfoForGeneratorType(
): ParamInfo[] {
switch (generatorType) {
case GeneratorType.Kick:
return getCommonParamsForTrack(GeneratorType.Kick).concat({
return getCommonParamsForTrack().concat({
name: "transientTime",
displayName: "Punch",
min: 0.01,
Expand All @@ -73,12 +73,12 @@ export function paramInfoForGeneratorType(
},
});
case GeneratorType.Snare:
return getCommonParamsForTrack(GeneratorType.Snare);
return getCommonParamsForTrack();
case GeneratorType.ClosedHH:
return getCommonParamsForTrack(GeneratorType.ClosedHH);
return getCommonParamsForTrack();
case GeneratorType.SineBleep:
return getCommonParamsForTrack(GeneratorType.SineBleep);
return getCommonParamsForTrack();
case GeneratorType.SquareBleep:
return getCommonParamsForTrack(GeneratorType.SquareBleep);
return getCommonParamsForTrack();
}
}
2 changes: 1 addition & 1 deletion src/shared-components/EditableLabel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { ReactElement, useState } from "react";
import { TextField, TextFieldProps } from "@mui/material";
import { styled } from "@mui/system";

const StyledTextField = styled(TextField)<TextFieldProps>(({ theme }) => ({
const StyledTextField = styled(TextField)<TextFieldProps>(() => ({
minHeight: 15,
maxHeight: 15,
}));
Expand Down
2 changes: 1 addition & 1 deletion src/shared-components/EmailPasswordForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { Link, useNavigate } from "react-router-dom";
import * as Yup from "yup";

const ContainerForm = styled("form")(
({ theme }) => `
() => `
padding: 1rem;
width: 100%;
justify-content: center;
Expand Down
4 changes: 2 additions & 2 deletions src/shared-components/ParamSlider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export interface ParamSliderProps {
}

const Container = styled("div")(
({ theme }) => `
() => `
display: flex;
flex-direction: row;
width: 200px;
Expand All @@ -35,7 +35,7 @@ export function ParamSlider(props: ParamSliderProps): ReactElement {
const [value, setValue] = useParameter(props.paramInfo);

const onChange = (
event: Event,
_: Event,
value: number | number[],
_thumbIndex: number
): void => {
Expand Down

0 comments on commit 445e679

Please sign in to comment.