Csound Csound-dev Csound-tekno Search About

[Csnd] fltk and sensekey not working ?

Date2009-03-17 12:49
Fromalgodon
Subject[Csnd] fltk and sensekey not working ?
Hello !

I'm having a hard time figuring how to use fltk and sensekey. I tried all
the examples i found but none worked. Is sensekey broken ? I'm using csound
5.10.1 on debian. 

Here is the last code i tried 




; Select audio/midi flags here according to platform
; Audio out   Audio in    No messages
;-odac           -iadc     -d     ;;;RT audio I/O
; For Non-realtime ouput leave only the line below:
; -o FLpanel-sensekey.wav -W ;;; for file output any platform
-odac -b512 -B1024 -d 



; Example by Johnathan Murphy

  sr	    =  44100
  ksmps	    =  1
  nchnls    =  2


	; ikbdcapture flag set to 1
  ikey	    init      1 		
 
	    FLpanel   "sensekey", 740, 340, 100, 250, 2, ikey
  gkasc, giasc	FLbutBank	2, 16, 8, 700, 300, 20, 20, -1
	    FLpanelEnd
	    FLrun

    instr 1

  kkey	    sensekey
  kprint    changed   kkey
	    FLsetVal  kprint, kkey, giasc

    endin




i1 0 60
e


Thanks


-----
http://www.myspace.com/algodonciego
-- 
View this message in context: http://www.nabble.com/fltk-and-sensekey-not-working---tp22558452p22558452.html
Sent from the Csound - General mailing list archive at Nabble.com.


Date2009-03-17 15:28
FromLou Cohen
Subject[Csnd] Re: fltk and sensekey not working ?
I use sensekey all the time with MacCsound, Mac-PPC OS X10.4.11 and earlier,
csound 5.08 and earlier.

It's fine for reporting key-down, but I cannot use it for determining
key-up. 

The following code works for me:

instr 5            ;Poll for computer-key pressed; set globals indicating
what row and key it is.
ilowestLegitValue        init        33                ;corresponds to "!"
ihighestLegitValue    init        126                ;corresponds to "~"
kKey, kkeydown            sensekey            ;get any pressed keyboard key
gkKeyBoardRow    =        -1                ;defaults to -1 if no key
pressed

if( ilowestLegitValue<=kKey && kKey<=ihighestLegitValue && kkeydown==1) then
    gkKeyBoardRow        table    kKey-ilowestLegitValue, 200        ;lookup
row number in table 200
    gkKeyNumber        table    kKey-ilowestLegitValue, 201        ;lookup
key number in table 201
    gkCurrentKey        =        kKey
endif
if(kkeydown!=1)then
    gkKeyBoardRow        =    -1
    gkKeyNumber        =    -1
    gkCurrentKey        =    -1
endif

endin


-Lou

On 3/17/09 8:49, "    algodon"  wrote:

> 
> Hello !
> 
> I'm having a hard time figuring how to use fltk and sensekey. I tried all
> the examples i found but none worked. Is sensekey broken ? I'm using csound
> 5.10.1 on debian.
> 
> Here is the last code i tried
> 
> 
> 
> 
> ; Select audio/midi flags here according to platform
> ; Audio out   Audio in    No messages
> ;-odac           -iadc     -d     ;;;RT audio I/O
> ; For Non-realtime ouput leave only the line below:
> ; -o FLpanel-sensekey.wav -W ;;; for file output any platform
> -odac -b512 -B1024 -d
> 
> 
> 
> ; Example by Johnathan Murphy
> 
> sr        =  44100
> ksmps        =  1
> nchnls    =  2
> 
> 
>   ; ikbdcapture flag set to 1
> ikey        init      1
> 
>       FLpanel   "sensekey", 740, 340, 100, 250, 2, ikey
> gkasc, giasc    FLbutBank    2, 16, 8, 700, 300, 20, 20, -1
>       FLpanelEnd
>       FLrun
> 
>   instr 1
> 
> kkey        sensekey
> kprint    changed   kkey
>       FLsetVal  kprint, kkey, giasc
> 
>   endin
> 
> 
> 
> 
> i1 0 60
> e
> 
> 
> Thanks
> 
> 
> -----


Date2009-03-19 09:43
Fromalgodon
Subject[Csnd] Re: fltk and sensekey not working ?
Thanks for your help but unfortunately i still get nothing.

Can someone tell me if te examples provided in the doc works on their system



; Select audio/midi flags here according to platform
; Audio out   Audio in    No messages
-odac         ; -iadc     -d     ;;;RT audio I/O
; For Non-realtime ouput leave only the line below:
; -o FLpanel-sensekey2.wav -W ;;; for file output any platform


sr =  48000
ksmps =  32
nchnls =  1
; Example by Istvan Varga
; if the FLTK opcodes are commented out, sensekey will read keyboard
; events from stdin
        FLpanel "", 150, 50, 100, 100, 0, 1
        FLlabel 18, 10, 1, 0, 0, 0
        FLgroup "Keyboard Input", 150, 50, 0, 0, 0
        FLgroupEnd
        FLpanelEnd

        FLrun

        instr 1

ktrig1 init 1
ktrig2 init 1
nxtKey1:
k1, k2 sensekey
        if (k1 != -1 || k2 != 0) then
        printf "Key code = %02X, state = %d\n", ktrig1, k1, k2
ktrig1 =  3 - ktrig1
        kgoto nxtKey1
        endif
nxtKey2:
k3 sensekey
        if (k3 != -1) then
        printf "Character = '%c'\n", ktrig2, k3
ktrig2 =  3 - ktrig2
        kgoto nxtKey2
        endif

        endin



i 1 0 3600
e



-----
http://www.myspace.com/algodonciego
-- 
View this message in context: http://www.nabble.com/fltk-and-sensekey-not-working---tp22558452p22596629.html
Sent from the Csound - General mailing list archive at Nabble.com.