[Cs-dev] problem with turnoff and setksmps..
Date | 2014-03-19 13:02 |
From | Rory Walsh |
Subject | [Cs-dev] problem with turnoff and setksmps.. |
Attachments | None None |
The following doesn't work as expected. It should continuously turn on and off instr2. If I comment out "setksmps 1" in instr2 it does run as expected. What's more is it will kill whatever audio is running as soon as it tries to turn on instr2 again.
<CsoundSynthesizer> <CsOptions> -g -+rtaudio=jack -odac </CsOptions> <CsInstruments> ksmps = 32 nchnls = 2 ;trigger instr 2 to come and off every half second instr 1 giFt ftgen 1, 0, 2, 2, 0, 1 ; gkPlayStop oscil 1, .5, 1; toggle between 0 and 1 ktrig trigger gkPlayStop,0.5,0 schedkwhen ktrig,0,0,2,0,-1 endin ;comment out setksmps, otherwise problems will arise instr 2 if gkPlayStop==0 then printks "Turning off instr 2\n", 0.1 turnoff endif prints "Started\n" setksmps 1 endin </CsInstruments> <CsScore> i1 0 1000 </CsScore> </CsoundSynthesizer> There is no such problem when using a UDO with "setksmps 1". Rory. |
Date | 2014-03-19 14:13 |
From | Victor Lazzarini |
Subject | Re: [Cs-dev] problem with turnoff and setksmps.. |
unrelated to this, but setksmps should always be the first statement in the instrument. ======================== Dr Victor Lazzarini Senior Lecturer NUI Maynooth, Ireland victor dot lazzarini at nuim dot ie On 19 Mar 2014, at 13:02, Rory Walsh |
Date | 2014-03-19 15:03 |
From | Steven Yi |
Subject | Re: [Cs-dev] problem with turnoff and setksmps.. |
I just tried this with CS5 and CS6. With CS6 I get a segfault. With CS6 I get weird behavior. I looked though and found that the schedkwhen line is using -1 for duration of note. If I change that to 1, I get period lines such as: Started rtevent: T 3.001 TT 3.001 M: 0.0 0.0 Started rtevent: T 5.001 TT 5.001 M: 0.0 0.0 Started rtevent: T 7.001 TT 7.001 M: 0.0 0.0 but I do not get any stops. Adding: printks "GKPlayStop %f\n", 0.1, gkPlayStop to instr 1, I do see the value changing from 0 to 1 and back. If I put that statement in instr2, I see printouts while gkPlayStop == 1, then it stops for a while. If I run with --verbose, I do see notes getting deactivated. On Wed, Mar 19, 2014 at 10:13 AM, Victor Lazzarini |
Date | 2014-03-19 15:15 |
From | Victor Lazzarini |
Subject | Re: [Cs-dev] problem with turnoff and setksmps.. |
How did you test this with CS5? setksmps for instruments is only in CS6? ======================== Dr Victor Lazzarini Senior Lecturer NUI Maynooth, Ireland victor dot lazzarini at nuim dot ie On 19 Mar 2014, at 15:03, Steven Yi |
Date | 2014-03-19 16:33 |
From | Steven Yi |
Subject | Re: [Cs-dev] problem with turnoff and setksmps.. |
I just ran it with CS5 and it compiled, started to run, then segfaulted. setksmps still has an OENTRY in CS5, so it probably compiled it fine. I'm going to guess the segfault came from setksmps not being a real opcode in CS5. On Wed, Mar 19, 2014 at 11:15 AM, Victor Lazzarini |
Date | 2014-03-19 19:10 |
From | Victor Lazzarini |
Subject | Re: [Cs-dev] problem with turnoff and setksmps.. |
setksmps would not work on instruments in Csound5, only UDOs (there is no code to support it there), anything can happen... ======================== Dr Victor Lazzarini Senior Lecturer NUI Maynooth, Ireland victor dot lazzarini at nuim dot ie On 19 Mar 2014, at 16:33, Steven Yi |