mardi 14 avril 2020

Finding the value of an array?

I am coding a sequencer that allows you to choose which sound you want to be carried into different parts of the code. I am using an array that holds the sound ID value and if a different sound is selected, the array is reset and the value changes. Initially, I thought using this snippet would work to check what sound has been chosen:

    if(sounds == 1){
    //insert effect of sound value
    }

But, this did nothing. I then tried:

   sounds == [1];

but that had no effect at all. What code should be used when trying to execute code based on the value of an array with a single item (if that makes sense)?

Aucun commentaire:

Enregistrer un commentaire