'use strict';

var gameMusic = null;
var gameSound = null;

function playMusic(musicDirectory) {
  if (gameMusic != null) {
    gameMusic.pause();
    gameMusic = null;
  }
  gameMusic = new Audio(musicDirectory);
  gameMusic.loop = true;
  gameMusic.play();
}

function pauseMusic() {
  gameMusic.pause();
}

function resumeMusic() {
  gameMusic.play();
}

function playSoundEffect(soundDirectory) {
  if (gameSound != null) {
    gameSound.pause();
    gameSound = null;
  }
  gameSound = new Audio(soundDirectory);
  gameSound.play();
}

@@ -8,16 +8,76 @@
 rict';%0A%0A
+var musicEnabled = false;%0Avar soundEffectsEnabled = false;%0A%0A
 var game
@@ -160,33 +160,28 @@
 if (
-gameMusic != null
+musicEnabled
 ) %7B%0A    
 game
@@ -172,24 +172,28 @@
 bled) %7B%0A    
+if (
 gameMusic.pa
@@ -189,26 +189,28 @@
 ameMusic
-.pause();%0A
+ != null)%0A  
     game
@@ -214,29 +214,28 @@
 ameMusic
- = null
+.pause()
 ;%0A  
-%7D%0A
   gameMu
@@ -263,24 +263,26 @@
 Directory);%0A
+  
   gameMusic.
@@ -294,16 +294,18 @@
 = true;%0A
+  
   gameMu
@@ -308,32 +308,36 @@
 meMusic.play();%0A
+  %7D%0A
 %7D%0A%0Afunction paus
@@ -458,24 +458,55 @@
 irectory) %7B%0A
+  if (soundEffectsEnabled) %7B%0A  
   if (gameSo
@@ -517,19 +517,19 @@
 != null)
- %7B%0A
+%0A  
     game
@@ -562,32 +562,8 @@
 nd =
- null;%0A  %7D%0A  gameSound =
  new
@@ -586,16 +586,18 @@
 ctory);%0A
+  
   gameSo
@@ -600,18 +600,22 @@
 meSound.play();%0A
+  %7D%0A
 %7D%0A

create booleans for audio toggle