printk not initialized, but strangely
Date | 2015-05-09 05:25 |
From | Chuckk Hubbard |
Subject | printk not initialized, but strangely |
Attachments | None None |
Hi there.
This gives "printk not initialized" as is; if I remove the goto statement it works. But what's weird is that, if I put the incrementing of kcount after endif, it works fine. Which is weird because I'd expect the "if" condition with the goto in its results to be skipped on the first pass the way it is, and to execute if I put the incrementing at the end. But either way, the error is raised by the second printk, not the first. I'm just curious, is this normal? Is it wrong to use goto to jump past endif? <CsoundSynthesizer> <CsInstruments> sr = 44100 ksmps = 16 nchnls = 2 instr 1 kdummy init 2 kcount init 0 ktrig metro 4 ;if (ktrig == 1) then ; kcount += 1 ;endif kcount += ktrig if ((kcount % 4) == 0) then printk 2, kdummy, 1 goto skip elseif ((kcount % 4) == 1) then printk 1, kdummy, 1 endif skip: endin </CsInstruments> <CsScore> f0 6 i1 0 5 e </CsScore> </CsoundSynthesizer>
|
Date | 2015-05-09 05:27 |
From | Chuckk Hubbard |
Subject | Re: printk not initialized, but strangely |
Attachments | None None |
Am I right in understanding that "goto" executes at i-time, but the "if" only at k-time? Is this what's happening? -Chuckk On Sat, May 9, 2015 at 7:25 AM, Chuckk Hubbard <badmuthahubbard@gmail.com> wrote:
|
Date | 2015-05-09 12:41 |
From | joachim heintz |
Subject | Re: printk not initialized, but strangely |
yes, i think so. you can see this if you replace "goto" by "igoto": then you get the same error. if you replace it by "kgoto", the error disappears. i'd recommend to always use either igoto or kgoto, to specify whether you want to go anywhere at initialisation or during the performance. if you use goto, the code is unclear, and csound will decide one of the two possibilities. looking at your code, i don't understand why you are using a statement here at all. if the first condition of your if-expression is true, the rest will not be regarded, so it works as you want it to work (if i understand your code right) without any go-to. joachim Am 09.05.2015 um 06:27 schrieb Chuckk Hubbard: > Am I right in understanding that "goto" executes at i-time, but the "if" > only at k-time? Is this what's happening? > > -Chuckk > > On Sat, May 9, 2015 at 7:25 AM, Chuckk Hubbard > |
Date | 2015-05-11 20:58 |
From | Chuckk Hubbard |
Subject | Re: printk not initialized, but strangely |
Attachments | None None |
OK, I understand. There were other things in between in the file I was working with, I took them out to show just the things that were confusing me. Thanks for the info! -Chuckk On Sat, May 9, 2015 at 2:41 PM, joachim heintz <jh@joachimheintz.de> wrote: yes, i think so. you can see this if you replace "goto" by "igoto": |