Skip to content

Commit

Permalink
fix: added missing playStep function
Browse files Browse the repository at this point in the history
  • Loading branch information
spik3s committed Jan 13, 2025
1 parent 3d30e99 commit 03d2596
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,46 @@ document.addEventListener('DOMContentLoaded', () => {
currentStep = (currentStep + 1) % 16;
};

const playStep = (step) => {
// Remove previous step indicator
rows.forEach(rowId => {
const row = document.getElementById(rowId);
const buttons = row.querySelectorAll('.button');
buttons.forEach(button => button.classList.remove('active-step'));

// Add indicator to current step
buttons[step].classList.add('active-step');

// Check button state and play sound if active
const buttonState = buttons[step].dataset.state;
if (buttonState !== 'off' && buttonState !== undefined) {
switch(rowId) {
case 'row-oh':
playOpenHatSound();
break;
case 'row-ch':
playClosedHatSound();
break;
case 'row-hc':
playHandClapSound();
break;
case 'row-lt':
playLowTomSound();
break;
case 'row-sd':
playSnareSound();
break;
case 'row-bd':
playKickSound();
break;
case 'row-acc':
playAccentSound();
break;
}
}
});
};

// Function to start the sequencer
const startSequencer = () => {
isPlaying = true;
Expand Down

0 comments on commit 03d2596

Please sign in to comment.