I made a program that, every time a sound must be played, it goes through a long list of conditions to determine which specific sound it's going to be. Because all of that happens at the moment a sound is supposed to immediately play, that's very inefficient and often causes lag.
I want to make it so that the program calculates beforehand what sound it's about to play. I assumed I had to work with strings, but I can't figure out how to direct to a string when play a sample ("play a sample" simply opens the databse of samples).
In my attachment is a test project I'm experimenting with. I'm trying to make the button play the sound that is stored in X=1 of the array.
Could someone help me with this? I would really appreciate it.