Csound Csound-dev Csound-tekno Search About

Re: [Csnd] Another sensekey issue

Date2011-07-27 22:42
From"Art Hunkins"
SubjectRe: [Csnd] Another sensekey issue
Iain,
 
Thanks for the clarification. Avoiding plain goto's when using sensekey is the secret. Why such goto's are not a problem otherwise (my MIDI-controlled versions of .csd's have no problem with them) I do not know. Sensekey versions also have problems with orchestra macros whereas MIDI-controlled do not. And the distinction has nothing to do with being run from the command line or a front end. Go figure.
 
The main reason why I haven't been using if then/else constructions is that it was my impression that they were not dependable on one or more non-Windows systems. Is that no longer true?
 
And, finally, thanks for the tip regarding ENTER; I'd no idea that it was not ASCII 32 on all systems. (We live in a strange world.)
 
Art Hunkins

----- Original Message -----
Sent: Wednesday, July 27, 2011 5:12 AM
Subject: RE: [Csnd] Another sensekey issue

Hi Art,

There is a problem with your printks's being skipped on the init pass. If you change your gotos to kgotos it works. Personally though I find ifs and elesifs easier to follow, easier to debug and more concise:

instr 1
 gkasc,gkdown sensekey
 if gkasc==13&&gkdown==1 then
  printks "ENTER pressed\n",0
 elseif gkasc==32&&gkdown==1 then
  printks "SPACEBAR pressed\n",0
 endif
endin

btw ENTER might not be the best key to use in your application as it has a different ascii value on linux and OSX.

Iain

> From: abhunkin@uncg.edu
> To: csound@lists.bath.ac.uk
> Date: Tue, 26 Jul 2011 21:28:28 -0400
> Subject: [Csnd] Another sensekey issue
>
> On the command line, I need to capture specific ASCII keystrokes to assign
> specific variables. The code below, which attempts to capture ENTER and
> SPACEBAR keystrokes, only captures the first one listed, ENTER.
>
> Can anyone explain why? It would seem to have to do with the way one of the
> goto's is functioning incorrectly.
>
> Art Hunkins
>
>
> <CsoundSynthesizer>
> <CsOptions>
> </CsOptions>
> <CsInstruments>
>
> sr = 44100
> ksmps = 100
> nchnls = 2
>
> instr 1
>
> kvalue init 0
> gkasc,gkdown sensekey
> if gkdown == 0 goto end
> if gkasc != 13 goto skip ; 13 = ENTER
> printks "ENTER pressed\n", 0
> kvalue = 1
> goto end
> skip:
> if gkasc != 32 goto end ; 32 = SPACEBAR, this never registers
> printks "SPACEBAR pressed\n", 0
> kvalue = 2
>
> end: endin
>
>
> </CsInstruments>
>
> <CsScore>
>
> i1 0 30
>
> e
>
> </CsScore>
> </CsoundSynthesizer>
>
>
>
> Send bugs reports to the Sourceforge bug tracker
> https://sourceforge.net/tracker/?group_id=81968&atid=564599
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>