Ios step sequence question!

Hello!

I am a student studying Openframeworks in Japan.
Creating a step sequence with OpenFrameWorks now.

when I touch the part another position than the step sequence, the program will be terminated.

I would like to create a button on the part other than the step sequence.
What should I do? Please advise me!

Hi, I think the problem happens if yPos is larger than (seqs.size()-1) or if xPos is larger than (steps.size()-1).

So I think you can replace seqs[yPos]->steps[xPos].pressed(); to

bool isOutOfRange = false; //determine if the touch is outside of sequencer area.

if (yPos < seqs.size()) {
    
    if (xPos < seqs[yPos].steps.size()) {
        
        seqs[yPos]->steps[xPos].pressed();
    }
    else {
        
        isOutOfRange = true;
    }
}
else {
    
    isOutOfRange = true;
}

if (isOutOfRange) { 
    
    //do something if touched outside of sequencer area.
}
1 Like

Thanks! it will be very helpful for my study!!! Arigato!