Yeah the problem is probably in removeSeq. 

        for(int i; i < s.size(); i++) {
            if(i != num) {
                sequences[i] @=> s[i];
            } else {
                sequences[i + 1] @=> s[i];
            }
        }

Here you only hit the i+1 case when you find the seq you are removing ("num"). In the next loop around, you go back to copying sequences[i] to s[i]; sequences[i] at this stage is the same as sequences[i+1] in the previous loop around, so overall you've copied sequences[num+1] twice. 

For simplicity I would refactor this into two loops, one to copy everything before num (sequences[i] @=> s[i];) and one to copy everything after (sequences[i+1] @=> s[i];), but there are a few different ways you could structure it. If ChucK had a list class this would be a lot easier, but so it goes. 

spencer


On Sun, Aug 21, 2016 at 4:50 AM, dude <prosvirnin.arseniy@gmail.com> wrote:
Hello, Chuck users!

I work on chuck program for live performance.
Main goal of program is play and delete sequences,
made from pre-made text file.

All sequences are separate shreds which running and
stoping by SequenceController class; each
sequence is instance of Sequence class.

So my problem is:

For example I have three sequences running.
If I delete sequences in inverse order,
all works fine; other way one of all sequences can not
be deleted and lookup() function shows all
sequences name as name of undeletable sequence.

Here is a link on PasteBin - http://pastebin.com/5Kk8xVKV

I guess problem is in removeSeq function on line 82.

I've got number for sequence from midi controller
and it is an 0 indexed integer.

Thanks for yours assistance.

Phlox.s

_______________________________________________
chuck-users mailing list
chuck-users@lists.cs.princeton.edu
https://lists.cs.princeton.edu/mailman/listinfo/chuck-users





--
Spencer Salazar
Doctoral Candidate
Center for Computer Research in Music and Acoustics
Stanford University

+1 831.277.4654