function updateChecker() {

    doesElementExist = document.getElementById('stereoFixer'); //grabs stereoFixer Element from html if it exists

    if(doesElementExist !== null){




//TODO:Simpifly this mess underneath (SliderInput functions), create 1 function that does of the things and just call it for each oninput (06/15/2017)
//----------------Left Channel Slider/Input-------------------//

 //assigns slider value to the input number box as you slide it
  document.getElementById("leftslider").oninput = function() {

  var Value = document.getElementById('leftslider').value;
  document.getElementById('leftInputValue').value = Value;
  leftGain.gain.value = Value/100; //sets the volume of left Channel
  console.log( leftGain.gain.value);

  if(initialValue) { //only do it once if u move sliders or change input value
    output.connect(audioCtx.destination); //connecting here before disconnecting because of line 432, so no errors occur
     output.disconnect(audioCtx.destination); //have to disconnect orginial output first or else you can't fully turn down the volume
     output.connect(splitter,0,0); //NOTE- connecting the splitter to output with the extra parameter of 0,0 makes it stereo sound aka officially making the sliders non boosted and individually controlled :)
     merger.connect(audioCtx.destination); //connect the merger to destination so we can hear the sound
     initialValue = false;
  }

      };

   //assigns input number value to slider
   document.getElementById("leftInputValue").oninput = function() {

     var Value = document.getElementById('leftInputValue').value;
    document.getElementById('leftslider').value = Value;
       leftGain.gain.value = Value/100; //sets the volume of left Channel
        console.log( leftGain.gain.value);
        if(initialValue) { //only do it once if u move sliders or change input value
          output.connect(audioCtx.destination); //connecting here before disconnecting because of line 432, so no errors occur
           output.disconnect(audioCtx.destination); //have to disconnect orginial output first or else you can't fully turn down the volume
           output.connect(splitter,0,0); //0,0 means stereo :)
           merger.connect(audioCtx.destination); //connect the merger to destination so we can hear the sound
           initialValue = false;
        }

   };

//----------------Right Channel Slider/Input-------------------//

   //assigns slider value to the input number box as you slide it
    document.getElementById("rightslider").oninput = function() {

  var Value = document.getElementById('rightslider').value;
  document.getElementById('rightInputValue').value = Value;
  rightGain.gain.value = Value/100; //sets the volume of right Channel
  console.log( rightGain.gain.value);
  if(initialValue) { //only do it once if u move sliders or change input value
    output.connect(audioCtx.destination); //connecting here before disconnecting because of line 432, so no errors occur
     output.disconnect(audioCtx.destination); //have to disconnect orginial output first or else you can't fully turn down the volume
     output.connect(splitter,0,0); //0,0 means stereo :)
     merger.connect(audioCtx.destination); //connect the merger to destination so we can hear the sound
     initialValue = false;
  }

        };

//assigns input number value to slider
     document.getElementById("rightInputValue").oninput = function() {

     var Value = document.getElementById('rightInputValue').value;
     document.getElementById('rightslider').value = Value;
     rightGain.gain.value = Value/100; //sets the volume of right Channel
     console.log( rightGain.gain.value);

  if(initialValue) { //only do it once if u move sliders or change input value
    output.connect(audioCtx.destination); //connecting here before disconnecting because of line 432, so no errors occur
     output.disconnect(audioCtx.destination); //have to disconnect orginial output first or else you can't fully turn down the volume
     output.connect(splitter,0,0); //0,0 means stereo :)
     merger.connect(audioCtx.destination); //connect the merger to destination so we can hear the sound
     initialValue = false;
  }
     };




if(document.getElementsByClassName('monoBox')[0].checked) //true mono
{
	if(gainConnected){

   output.connect(audioCtx.destination); //connecting here before disconnecting, so no errors occur
   output.disconnect(audioCtx.destination); //disconnect regular sound as it distorts this shit

   //splitter.connect(leftGain,0); //connect the left channel volume to splitter //NOTE - SEE 453
   //splitter.connect(rightGain,1); //connect the right channel volume to splitter


   //NOTE- SEE 453 for the reason why this is commented out
   // splitter.connect(leftGain,1); //connect the left channel volume to splitter
   // splitter.connect(rightGain,0); //connect the right channel volume to splitter

   // //merge both channels into 1 audio source
   //leftGain.disconnect(merger, 0, 0);	//merge, audio source index, channel 0 is left 1 is right
   //rightGain.disconnect(merger,0,1);
splitter.disconnect(leftGain,0);
splitter.disconnect(rightGain,1);

		//This will create a mono sound without having to test for decibels :)
	gain.channelCount = 1; //toggles mono
  //the gain has to connect here or else it messes with the merger




//NOTE --07/03 2am ---- dual mono + sliders working together ? --YES !
gain.connect(splitter,0,0); //0,0 means stereo :)
gain.connect(leftGain,0);
gain.connect(rightGain,0);






  //splitter.connect(gain,0,0); //NOTE -TODO -NOTE- this alone makes a wierd ass constant buzz noise :X - sidenote - gain.connect(splitter,0,0) has to be on as well


  merger.connect(audioCtx.destination); //connect the merger to destination so we can hear the sound
  //gain.connect(audioCtx.destination); //This is so you could actually hear the sound :) //NOTE - 07/03 -- COMMENTED THIS OUT AND CONNECTED SPLITTER TO GAIN AND THEN MERGED THE SOUND //NOTE (DUAL MONO?) --this allows me to manupilate the sliders as well.
	console.log(gain.channelCount);
	console.log("mono is checked");
  gainConnected = false;
	}

}


else if(!document.getElementsByClassName('monoBox')[0].checked) //false
{

if(!gainConnected)
	{
//NOTE -- added 2 lines below for dual mono disconnect

    gain.disconnect(leftGain,0);
    gain.disconnect(rightGain,0);
    gain.disconnect(splitter,0,0); //0,0 means stereo :)
    merger.disconnect(audioCtx.destination); //connect the merger to destination so we can hear the sound

    //needed to reconnect this in order for regular sound to go back to the way it was
    splitter.connect(leftGain,0);
    splitter.connect(rightGain,1);


		gain.channelCount = 2; //this defaults back to stereo
		console.log(gain.channelCount);
    output.connect(splitter,0,0);
      //gain.disconnect(audioCtx.destination); //This is so you could actually hear the sound :)
         merger.connect(audioCtx.destination); //reconnect merger to back to regular audio instead of output.connect() -NOTE- helps fix transition of on/off switching the mono when sliders have been moved
		gainConnected = true;
			console.log("mono is unchecked");
}

}
if (document.getElementsByClassName('symBox')[0].checked) //true symmetric
{
 if(gain2Connected){
   output.connect(audioCtx.destination); //connecting here before disconnecting because of line 432, so no errors occur
   output.disconnect(audioCtx.destination); //disconnect regular sound as it distorts this shit

   //adding symmetric
   splitter.connect(leftGain,1); //connect the left channel volume to splitter
   splitter.connect(rightGain,0); //connect the right channel volume to splitter

 output.connect(splitter,0,0); //connect the splitter to the audio source --NOTE -- 07/03 -- this was without the 0,0
merger.connect(audioCtx.destination); //connect the merger to destination so we can hear the sound
gain2Connected = false;
 }

}
else if (!document.getElementsByClassName('symBox')[0].checked) //false symmetric
{
 if(!gain2Connected){
 //disconnecting symmetric
  splitter.disconnect(leftGain,1); //connect the left channel volume to splitter
  splitter.disconnect(rightGain,0); //connect the right channel volume to splitter
  output.disconnect(splitter);
  merger.disconnect(audioCtx.destination);
 //NOTE -- the below was added to remedy the slider + symmetric (on/off) interference
  output.connect(splitter,0,0); //0,0 means stereo :)
  merger.connect(audioCtx.destination); //connect the merger to destination so we can hear the sound
//output.connect(audioCtx.destination); //reconnect the regular sound //NOTE (07/03/2017) -- commented this out to fix the interference issue with slider + symmetric (on/off switched)
//merger.connect(audioCtx.destination); //connect the merger to destination so we can hear the sound
  gain2Connected = true;
 }

}




}
else
     {
       console.log("hello");

       addElement();
    }
}
//checking for changes such as checking or unchecking checkboxes, moving sliders, etc...

checking for changes such as checking or unchecking checkboxes, moving sliders, etc
checking for changes such as checking or unchecking checkboxes moving sliders etc
function updateChecker() {
    doesElementExist = document.getElementById('stereoFixer'); 
    if(doesElementExist !== null){
  document.getElementById("leftslider").oninput = function() {
  var Value = document.getElementById('leftslider').value;
  document.getElementById('leftInputValue').value = Value;
  leftGain.gain.value = Value/100; 
  console.log( leftGain.gain.value);
  if(initialValue) { 
    output.connect(audioCtx.destination); 
     output.disconnect(audioCtx.destination); 
     output.connect(splitter,0,0); 
     merger.connect(audioCtx.destination); 
     initialValue = false;
  }
      };
   document.getElementById("leftInputValue").oninput = function() {
     var Value = document.getElementById('leftInputValue').value;
    document.getElementById('leftslider').value = Value;
       leftGain.gain.value = Value/100; 
        console.log( leftGain.gain.value);
        if(initialValue) { 
          output.connect(audioCtx.destination); 
           output.disconnect(audioCtx.destination); 
           output.connect(splitter,0,0); 
           merger.connect(audioCtx.destination); 
           initialValue = false;
        }
   };
    document.getElementById("rightslider").oninput = function() {
  var Value = document.getElementById('rightslider').value;
  document.getElementById('rightInputValue').value = Value;
  rightGain.gain.value = Value/100; 
  console.log( rightGain.gain.value);
  if(initialValue) { 
    output.connect(audioCtx.destination); 
     output.disconnect(audioCtx.destination); 
     output.connect(splitter,0,0); 
     merger.connect(audioCtx.destination); 
     initialValue = false;
  }
        };
     document.getElementById("rightInputValue").oninput = function() {
     var Value = document.getElementById('rightInputValue').value;
     document.getElementById('rightslider').value = Value;
     rightGain.gain.value = Value/100; 
     console.log( rightGain.gain.value);
  if(initialValue) { 
    output.connect(audioCtx.destination); 
     output.disconnect(audioCtx.destination); 
     output.connect(splitter,0,0); 
     merger.connect(audioCtx.destination); 
     initialValue = false;
  }
     };
if(document.getElementsByClassName('monoBox')[0].checked) 
{
	if(gainConnected){
   output.connect(audioCtx.destination); 
   output.disconnect(audioCtx.destination); 
splitter.disconnect(leftGain,0);
splitter.disconnect(rightGain,1);
	gain.channelCount = 1; 
gain.connect(splitter,0,0); 
gain.connect(leftGain,0);
gain.connect(rightGain,0);
  merger.connect(audioCtx.destination); 
	console.log(gain.channelCount);
	console.log("mono is checked");
  gainConnected = false;
	}
}
else if(!document.getElementsByClassName('monoBox')[0].checked) 
{
if(!gainConnected)
	{
    gain.disconnect(leftGain,0);
    gain.disconnect(rightGain,0);
    gain.disconnect(splitter,0,0); 
    merger.disconnect(audioCtx.destination); 
    splitter.connect(leftGain,0);
    splitter.connect(rightGain,1);
		gain.channelCount = 2; 
		console.log(gain.channelCount);
    output.connect(splitter,0,0);
         merger.connect(audioCtx.destination); 
		gainConnected = true;
			console.log("mono is unchecked");
}
}
if (document.getElementsByClassName('symBox')[0].checked) 
{
 if(gain2Connected){
   output.connect(audioCtx.destination); 
   output.disconnect(audioCtx.destination); 
   splitter.connect(leftGain,1); 
   splitter.connect(rightGain,0); 
 output.connect(splitter,0,0); 
merger.connect(audioCtx.destination); 
gain2Connected = false;
 }
}
else if (!document.getElementsByClassName('symBox')[0].checked) 
{
 if(!gain2Connected){
  splitter.disconnect(leftGain,1); 
  splitter.disconnect(rightGain,0); 
  output.disconnect(splitter);
  merger.disconnect(audioCtx.destination);
  output.connect(splitter,0,0); 
  merger.connect(audioCtx.destination); 
//merger.connect(audioCtx.destination); 
  gain2Connected = true;
 }
}
}
else
     {
       console.log("hello");
       addElement();
    }
}
function updateChecker ( ) { doesElementExist = document . getElementById ( 'stereoFixer' ) ; if ( doesElementExist !== null ) { document . getElementById ( "leftslider" ) . oninput = function ( ) { var Value = document . getElementById ( 'leftslider' ) . value ; document . getElementById ( 'leftInputValue' ) . value = Value ; leftGain . gain . value = Value / 100 ; console . log ( leftGain . gain . value ) ; if ( initialValue ) { output . connect ( audioCtx . destination ) ; output . disconnect ( audioCtx . destination ) ; output . connect ( splitter , 0 , 0 ) ; merger . connect ( audioCtx . destination ) ; initialValue = false ; } } ; document . getElementById ( "leftInputValue" ) . oninput = function ( ) { var Value = document . getElementById ( 'leftInputValue' ) . value ; document . getElementById ( 'leftslider' ) . value = Value ; leftGain . gain . value = Value / 100 ; console . log ( leftGain . gain . value ) ; if ( initialValue ) { output . connect ( audioCtx . destination ) ; output . disconnect ( audioCtx . destination ) ; output . connect ( splitter , 0 , 0 ) ; merger . connect ( audioCtx . destination ) ; initialValue = false ; } } ; document . getElementById ( "rightslider" ) . oninput = function ( ) { var Value = document . getElementById ( 'rightslider' ) . value ; document . getElementById ( 'rightInputValue' ) . value = Value ; rightGain . gain . value = Value / 100 ; console . log ( rightGain . gain . value ) ; if ( initialValue ) { output . connect ( audioCtx . destination ) ; output . disconnect ( audioCtx . destination ) ; output . connect ( splitter , 0 , 0 ) ; merger . connect ( audioCtx . destination ) ; initialValue = false ; } } ; document . getElementById ( "rightInputValue" ) . oninput = function ( ) { var Value = document . getElementById ( 'rightInputValue' ) . value ; document . getElementById ( 'rightslider' ) . value = Value ; rightGain . gain . value = Value / 100 ; console . log ( rightGain . gain . value ) ; if ( initialValue ) { output . connect ( audioCtx . destination ) ; output . disconnect ( audioCtx . destination ) ; output . connect ( splitter , 0 , 0 ) ; merger . connect ( audioCtx . destination ) ; initialValue = false ; } } ; if ( document . getElementsByClassName ( 'monoBox' ) [ 0 ] . checked ) { if ( gainConnected ) { output . connect ( audioCtx . destination ) ; output . disconnect ( audioCtx . destination ) ; splitter . disconnect ( leftGain , 0 ) ; splitter . disconnect ( rightGain , 1 ) ; gain . channelCount = 1 ; gain . connect ( splitter , 0 , 0 ) ; gain . connect ( leftGain , 0 ) ; gain . connect ( rightGain , 0 ) ; merger . connect ( audioCtx . destination ) ; console . log ( gain . channelCount ) ; console . log ( "mono is checked" ) ; gainConnected = false ; } } else if ( ! document . getElementsByClassName ( 'monoBox' ) [ 0 ] . checked ) { if ( ! gainConnected ) { gain . disconnect ( leftGain , 0 ) ; gain . disconnect ( rightGain , 0 ) ; gain . disconnect ( splitter , 0 , 0 ) ; merger . disconnect ( audioCtx . destination ) ; splitter . connect ( leftGain , 0 ) ; splitter . connect ( rightGain , 1 ) ; gain . channelCount = 2 ; console . log ( gain . channelCount ) ; output . connect ( splitter , 0 , 0 ) ; merger . connect ( audioCtx . destination ) ; gainConnected = true ; console . log ( "mono is unchecked" ) ; } } if ( document . getElementsByClassName ( 'symBox' ) [ 0 ] . checked ) { if ( gain2Connected ) { output . connect ( audioCtx . destination ) ; output . disconnect ( audioCtx . destination ) ; splitter . connect ( leftGain , 1 ) ; splitter . connect ( rightGain , 0 ) ; output . connect ( splitter , 0 , 0 ) ; merger . connect ( audioCtx . destination ) ; gain2Connected = false ; } } else if ( ! document . getElementsByClassName ( 'symBox' ) [ 0 ] . checked ) { if ( ! gain2Connected ) { splitter . disconnect ( leftGain , 1 ) ; splitter . disconnect ( rightGain , 0 ) ; output . disconnect ( splitter ) ; merger . disconnect ( audioCtx . destination ) ; output . connect ( splitter , 0 , 0 ) ; merger . connect ( audioCtx . destination ) ; gain2Connected = true ; } } } else { console . log ( "hello" ) ; addElement ( ) ; } }
checking for changes such as checking or unchecking checkboxes, moving sliders, etc...
checking for changes such as checking or unchecking checkboxes moving sliders etc ...
//grabs stereoFixer Element from html if it exists
 //TODO:Simpifly this mess underneath (SliderInput functions), create 1 function that does of the things and just call it for each oninput (06/15/2017)
 //----------------Left Channel Slider/Input-------------------//
 //assigns slider value to the input number box as you slide it
 //sets the volume of left Channel
 //only do it once if u move sliders or change input value
 //connecting here before disconnecting because of line 432, so no errors occur
 //have to disconnect orginial output first or else you can't fully turn down the volume
 //NOTE- connecting the splitter to output with the extra parameter of 0,0 makes it stereo sound aka officially making the sliders non boosted and individually controlled :)
 //connect the merger to destination so we can hear the sound
 //assigns input number value to slider
 //sets the volume of left Channel
 //only do it once if u move sliders or change input value
 //connecting here before disconnecting because of line 432, so no errors occur
 //have to disconnect orginial output first or else you can't fully turn down the volume
 //0,0 means stereo :)
 //connect the merger to destination so we can hear the sound
 //----------------Right Channel Slider/Input-------------------//
 //assigns slider value to the input number box as you slide it
 //sets the volume of right Channel
 //only do it once if u move sliders or change input value
 //connecting here before disconnecting because of line 432, so no errors occur
 //have to disconnect orginial output first or else you can't fully turn down the volume
 //0,0 means stereo :)
 //connect the merger to destination so we can hear the sound
 //assigns input number value to slider
 //sets the volume of right Channel
 //only do it once if u move sliders or change input value
 //connecting here before disconnecting because of line 432, so no errors occur
 //have to disconnect orginial output first or else you can't fully turn down the volume
 //0,0 means stereo :)
 //connect the merger to destination so we can hear the sound
 //true mono
 //connecting here before disconnecting, so no errors occur
 //disconnect regular sound as it distorts this shit
 //splitter.connect(leftGain,0); //connect the left channel volume to splitter //NOTE - SEE 453
 //splitter.connect(rightGain,1); //connect the right channel volume to splitter
 //NOTE- SEE 453 for the reason why this is commented out
 // splitter.connect(leftGain,1); //connect the left channel volume to splitter
 // splitter.connect(rightGain,0); //connect the right channel volume to splitter
 // //merge both channels into 1 audio source
 //leftGain.disconnect(merger, 0, 0);	//merge, audio source index, channel 0 is left 1 is right
 //rightGain.disconnect(merger,0,1);
 //This will create a mono sound without having to test for decibels :)
 //toggles mono
 //the gain has to connect here or else it messes with the merger
 //NOTE --07/03 2am ---- dual mono + sliders working together ? --YES !
 //0,0 means stereo :)
 //splitter.connect(gain,0,0); //NOTE -TODO -NOTE- this alone makes a wierd ass constant buzz noise :X - sidenote - gain.connect(splitter,0,0) has to be on as well
 //connect the merger to destination so we can hear the sound
 //gain.connect(audioCtx.destination); //This is so you could actually hear the sound :) //NOTE - 07/03 -- COMMENTED THIS OUT AND CONNECTED SPLITTER TO GAIN AND THEN MERGED THE SOUND //NOTE (DUAL MONO?) --this allows me to manupilate the sliders as well.
 //false
 //NOTE -- added 2 lines below for dual mono disconnect
 //0,0 means stereo :)
 //connect the merger to destination so we can hear the sound
 //needed to reconnect this in order for regular sound to go back to the way it was
 //this defaults back to stereo
 //gain.disconnect(audioCtx.destination); //This is so you could actually hear the sound :)
 //reconnect merger to back to regular audio instead of output.connect() -NOTE- helps fix transition of on/off switching the mono when sliders have been moved
 //true symmetric
 //connecting here before disconnecting because of line 432, so no errors occur
 //disconnect regular sound as it distorts this shit
 //adding symmetric
 //connect the left channel volume to splitter
 //connect the right channel volume to splitter
 //connect the splitter to the audio source --NOTE -- 07/03 -- this was without the 0,0
 //connect the merger to destination so we can hear the sound
 //false symmetric
 //disconnecting symmetric
 //connect the left channel volume to splitter
 //connect the right channel volume to splitter
 //NOTE -- the below was added to remedy the slider + symmetric (on/off) interference
 //0,0 means stereo :)
 //connect the merger to destination so we can hear the sound
 //output.connect(audioCtx.destination); //reconnect the regular sound //NOTE (07/03/2017) -- commented this out to fix the interference issue with slider + symmetric (on/off switched)
 //merger.connect(audioCtx.destination); //connect the merger to destination so we can hear the sound
