[Csnd] turning off instances created by a loop

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[Csnd] turning off instances created by a loop

Francesco Porta
Hello All,
i have a situation where an instrument start many instances of another,
something like this:

instr 40

iloop = 10
idur = 5
idx = 0
while idx<iloop do
        schedule 43 + idx/1000, idx*idur, idur*1.1
        idx +=1
od
turnoff
endin

at some time i would like to stop all instances of called instrument (43 in example)
with the possibility of restarting caller instrument (instr 40)

i tried turnoff2 but do not intercept the new created instances (after his activation).
Also tried mute but doesn't stop running instances but only newly created.

I could use both turnoff2 and mute but then if i start a new instance of instr 40
i need to unmute instr 43 and this active again the old (muted) instances.

How can i do?

Thanks,
ciao,
francesco.

Csound mailing list
[hidden email]
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] turning off instances created by a loop

00000008a49663bc-dmarc-request
May this one work?


instr 45
iloop = 10
idx = 0
;turnoff instr 43 istances
while idx<iloop do
    event_i "i", -43 - idx/1000, 0, 0
    idx +=1
od
;turnon instr 40 again
event_i "i", 40, 0, -1
turnoff
endin

Eventually put the activation of instr 40 into an "if" that uses a pfield

;turnon instr 40 again
if p4 > 0 then
    event_i "i", 40, 0, -1
endif

Ciao

Stefano

> Il 3 ottobre 2018 alle 18.02 Francesco Porta <[hidden email]> ha scritto:
>
>
> Hello All,
> i have a situation where an instrument start many instances of another,
> something like this:
>
> instr 40
>
> iloop = 10
> idur = 5
> idx = 0
> while idx<iloop do
> schedule 43 + idx/1000, idx*idur, idur*1.1
> idx +=1
> od
> turnoff
> endin
>
> at some time i would like to stop all instances of called instrument (43 in example)
> with the possibility of restarting caller instrument (instr 40)
>
> i tried turnoff2 but do not intercept the new created instances (after his activation).
> Also tried mute but doesn't stop running instances but only newly created.
>
> I could use both turnoff2 and mute but then if i start a new instance of instr 40
> i need to unmute instr 43 and this active again the old (muted) instances.
>
> How can i do?
>
> Thanks,
> ciao,
> francesco.
>
> Csound mailing list
> [hidden email]
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> Send bugs reports to
>         https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here

Csound mailing list
[hidden email]
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here