Skip to content

Commit

Permalink
Stop sequencer before removing/adding new steps to prevent duplicate …
Browse files Browse the repository at this point in the history
…notes from being played when they change
  • Loading branch information
brandongregoryscott committed Jan 18, 2022
1 parent 01b3b27 commit 85405d7
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/components/Track.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,14 @@ const TrackConsumer: React.FC<TrackConsumerProps> = ({
);

if (!isEqual) {
sequencer.current.stop();
sequencer.current?.remove(i);
sequencer.current?.add(i, step);
}
});
} else {
// When new steps are less or more then prev, remove all and add new steps
sequencer.current.stop();
sequencer.current.removeAll();
sequencerSteps.forEach((step, i) => {
sequencer.current.add(i, step);
Expand Down

0 comments on commit 85405d7

Please sign in to comment.