Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

not possible to skip audio output in UDO? #1808

Open
joachimheintz opened this issue Jan 15, 2024 · 3 comments
Open

not possible to skip audio output in UDO? #1808

joachimheintz opened this issue Jan 15, 2024 · 3 comments

Comments

@joachimheintz
Copy link
Contributor

when i have a csound instrument, i can skip a certain number of k-cycles by a loop like this:

  kCount init 0
  skip:
  (do something)
  kCount += 1
  if (kCount < iTimeToSkip*kr) kgoto skip

this works inside an instrument, but not inside a UDO:

opcode Play,a,Si
  Sfile,iTimeToSkip xin
  kCount init 0
  skip:
  aOut = poscil:a(0.2,expon:k(400,2,1600))
  kCount += 1
  if (kCount < iTimeToSkip*kr) kgoto skip
  xout(aOut)  
endop

instr 1 // works
  iTimeToSkip = p4
  kCount init 0
  skip:
  aOut = poscil:a(0.2,expon:k(400,2,1600))
  kCount += 1
  if (kCount < iTimeToSkip*kr) kgoto skip
  outall(aOut)
endin
schedule(1,0,1,0)
schedule(1,2,1,1) ;skips the first second 

instr 2 // does not work
  iTimeToSkip = p4
  aOut = poscil:a(0.2,expon:k(400,2,1600))
  outall(aOut)
endin
schedule(2,4,1,0)
schedule(2,6,1,1) ;does NOT skip the first second

is this expected behaviour? or is it a bug?

@vlazzarini
Copy link
Member

maybe I am getting some wires crossed but I can't seen in instr 2 any code to skip anything (ie. the UDO is not called?)

@joachimheintz
Copy link
Contributor Author

joachimheintz commented Jan 15, 2024 via email

@vlazzarini
Copy link
Member

There s a problem somewhere and I think I have seen it before. If you make the small change

opcode Play,a,Si
  Sfile,iTimeToSkip xin
  kCount init 0
  kgoto nxt
  skip:
  nxt:
  aOut = poscil:a(0.2,expon:k(400,2,1600))
  kCount += 1
  if (kCount < iTimeToSkip*kr) kgoto skip
  xout(aOut)  
endop

you get the expected result. If I remember it properly, the problem was that the label was not found inside the UDO and the code jump did not work. Adding another label seems to force it to be found. I thought we had fixed this. @jpffitch do you remember this issue from another time? I can't recall what we did with it,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants