Csound Csound-dev Csound-tekno Search About

[Csnd] FLTK snapshots

Date2008-01-06 22:18
FromLou Cohen
Subject[Csnd] FLTK snapshots
FLTK snapshots Hi, everyone, and Happy New Year!

I’ve been creating an fltk-based front end to my csound improviser lately. I’ve developed a number of techniques for creating the widgets more or less easily, and the work is showing promise.

However, I ran into a problem with commands FLsavesnap and Flloadsnap. When I invoke the former (by clicking a button in the GUI, which is supposed to fire up instr 1200) a window shows up asking me if I really want to overwrite the file snapsave.txt. This is because I’ve saved the file a few times already. I say “yes” and the window goes away. The file snapsave.txt appears to be created correctly — it’s quite long and I haven’t inspected it all, but I can’t see anything obviously wrong with it.

Then I want to retrieve this file, so I click another button which invokes instr 1205. Here’s what happens, based on the print lines I’ve inserted:

  1. Instrument 1205 runs, and maybe restores the values to the widgets.
  2. Instrument 1200 gets invoked and once again asks me if I’m sure I want overwrite the file snapsave.txt.
  3. If I try to dismiss this window, another identical window shows up, and the console shows that instrument 1200 has been invoked yet again. Each time I click a button in the dialog box, instrument 1205 and 1200 both get executed. See the console printout after the code for the instruments. Notice that “inumsnap” gets incremented; I don’t understand why.
  4. Step 3. above is an infinite loop that I can’t get out of — I must force-quit csound.

Any ideas as to what’s happening? Thanks!

My version of csound (on OS X):
Csound version 5.04.0 (float samples) Nov 10 2006
libsndfile-1.0.16

I have been afraid to update csound because of complications with MacCsound, which I still depend on for performance.

-Lou Cohen

;--------------------------------------------
instr 1200    ;invoked to save a snapshot of fltk setting
index              init 0
ktrigger         init 1
if(ktrigger==1)then
    inumsnap, inumval      FLsetsnap index
    print inumsnap
    print inumval
    FLsavesnap        "snapsave.txt"
    ktrigger = 0
    FLsetVal        ktrigger, 0, gibutsavebtnha
endif
endin
;------------------------------------------------
instr 1205    ;invoked to restore saved snapshot
index              init 0
itrigger         init 1
if(itrigger==1) then
        FLloadsnap         "snapsave.txt"
        inumsnap         FLgetsnap index
        print             inumsnap
        itrigger         = 0
endif
endin

CONSOLE PRINTOUT:
instr 1200:  inumsnap = 0.000
instr 1200:  inumval = 385.000
instr 1205:  inumsnap = 2.000
instr 1200:  inumsnap = 2.000
instr 1200:  inumval = 385.000
------------all lines below are printed after I click “yes” or “no” to the “are you sure...” dialog
instr 1205:  inumsnap = 3.000
instr 1200:  inumsnap = 3.000
instr 1200:  inumval = 385.000
instr 1205:  inumsnap = 4.000
instr 1200:  inumsnap = 4.000
instr 1200:  inumval = 385.000


---------------------------
Permanent email:           loucohen@jolc.net
Music and video:            http://ruccas.org/wiki.pl/Lou_Cohen
More music and video:   http://www.youtube.com/loucohen
Astronomy:                    http://www.jolc.net
----------------------------


Date2008-01-07 02:41
From"Steven Yi"
Subject[Csnd] Re: FLTK snapshots
AttachmentsNone  

Date2008-01-07 10:18
From"Oeyvind Brandtsegg"
Subject[Csnd] Re: Re: FLTK snapshots
AttachmentsNone  

Date2008-01-07 16:56
FromLou Cohen
Subject[Csnd] Re: FLTK snapshots, and a new question -MACRO EXPANSION
[Csnd]Re: FLTK snapshots, and a new question -MACRO EXPANSION Hi, Oeyvind and Steven,

Your observations were exactly correct. I can now save and restore a single snapshot with no problems. I’ll expand that to alternate snapshots sometime in the future, once I get more of the improviser running.

May I ask a further question?

To generate all the sliders, buttons, etc., I have devised a series of orchestra macros. They apparently create thousands of lines of code. So far, whenever I’ve made a mistake I’ve been able, with ingenuity, to find and fix the error. But I was wondering, is there any way to view the expanded orchestra code? This could possibly save me some time in the future.

-Lou


On 1/7/08 5:18, "Oeyvind Brandtsegg     " <obrandts@gmail.com> wrote:

Just an idea,
forgive me if it's too obvious.

Is the state of the FLTK widget used for saving presets recalled when
recalling ?
In that case, when recalling a preset, the FLTK widget for saving will
be triggered and try to execute saving.
If I remember correctly, you can add 10 to the itype parameter of an
FLTK widget opcode, and by doing so that widget will be excluded from
preset recall operations.

best
Oeyvind

2008/1/7, Steven Yi <stevenyi@gmail.com>:
> Hi Lou,
>
> Not knowing your other code nor the FL snapshot opcodes, I did notice
> you have a k-rate trigger in instr 1200 but an i-rate trigger in 1205.
>  You also have a sort of mismatch between a krate signal comparison
> and then the use of i-time opcodes within the body of the block in
> instr 1200 which may cause confusion.
>
> Instead of using the trigger stuff, I think you might be able to not
> use the if comparisons and at the end of your code just add a call to
> turnoff and that should allow your instrument do all i-time calls then
> turn off and therefore should be pretty efficient.
>
> Well, hope that helps!
> steven
>
> On Jan 6, 2008 2:18 PM, Lou Cohen <loucohen@jolc.net> wrote:
> >
> >  Hi, everyone, and Happy New Year!
> >
> >  I've been creating an fltk-based front end to my csound improviser lately.
> > I've developed a number of techniques for creating the widgets more or less
> > easily, and the work is showing promise.
> >
> >  However, I ran into a problem with commands FLsavesnap and Flloadsnap. When
> > I invoke the former (by clicking a button in the GUI, which is supposed to
> > fire up instr 1200) a window shows up asking me if I really want to
> > overwrite the file snapsave.txt. This is because I've saved the file a few
> > times already. I say "yes" and the window goes away. The file snapsave.txt
> > appears to be created correctly — it's quite long and I haven't inspected it
> > all, but I can't see anything obviously wrong with it.
> >
> >  Then I want to retrieve this file, so I click another button which invokes
> > instr 1205. Here's what happens, based on the print lines I've inserted:
> >
> >
> > Instrument 1205 runs, and maybe restores the values to the widgets.
> > Instrument 1200 gets invoked and once again asks me if I'm sure I want
> > overwrite the file snapsave.txt.
> > If I try to dismiss this window, another identical window shows up, and the
> > console shows that instrument 1200 has been invoked yet again. Each time I
> > click a button in the dialog box, instrument 1205 and 1200 both get
> > executed. See the console printout after the code for the instruments.
> > Notice that "inumsnap" gets incremented; I don't understand why.
> > Step 3. above is an infinite loop that I can't get out of — I must
> > force-quit csound.
> >
> >  Any ideas as to what's happening? Thanks!
> >
> >  My version of csound (on OS X):
> >  Csound version 5.04.0 (float samples) Nov 10 2006
> >  libsndfile-1.0.16
> >
> >  I have been afraid to update csound because of complications with
> > MacCsound, which I still depend on for performance.
> >
> >  -Lou Cohen
> >
> >  ;--------------------------------------------
> >  instr 1200    ;invoked to save a snapshot of fltk setting
> >  index              init 0
> >  ktrigger         init 1
> >  if(ktrigger==1)then
> >      inumsnap, inumval      FLsetsnap index
> >      print inumsnap
> >      print inumval
> >      FLsavesnap        "snapsave.txt"
> >      ktrigger = 0
> >      FLsetVal        ktrigger, 0, gibutsavebtnha
> >  endif
> >  endin
> >  ;------------------------------------------------
> >  instr 1205    ;invoked to restore saved snapshot
> >  index              init 0
> >  itrigger         init 1
> >  if(itrigger==1) then
> >          FLloadsnap         "snapsave.txt"
> >          inumsnap         FLgetsnap index
> >          print             inumsnap
> >          itrigger         = 0
> >  endif
> >  endin
> >
> >  CONSOLE PRINTOUT:
> >  instr 1200:  inumsnap = 0.000
> >  instr 1200:  inumval = 385.000
> >  instr 1205:  inumsnap = 2.000
> >  instr 1200:  inumsnap = 2.000
> >  instr 1200:  inumval = 385.000
> >  ------------all lines below are printed after I click "yes" or "no" to the
> > "are you sure..." dialog
> >  instr 1205:  inumsnap = 3.000
> >  instr 1200:  inumsnap = 3.000
> >  instr 1200:  inumval = 385.000
> >  instr 1205:  inumsnap = 4.000
> >  instr 1200:  inumsnap = 4.000
> >  instr 1200:  inumval = 385.000
> >
> >
> >  ---------------------------
> >  Permanent email:           loucohen@jolc.net
> >  Music and video:            http://ruccas.org/wiki.pl/Lou_Cohen
> >  More music and video:   http://www.youtube.com/loucohen
> >  Astronomy:                    http://www.jolc.net
> >  ----------------------------
> >
> >
>
>
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"


Send bugs reports to this list.
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"


---------------------------
Permanent email:           loucohen@jolc.net
Music and video:            http://ruccas.org/wiki.pl/Lou_Cohen
More music and video:   http://www.youtube.com/loucohen
Astronomy:                    http://www.jolc.net
----------------------------


Date2008-01-10 08:46
From"Oeyvind Brandtsegg"
Subject[Csnd] Re: Re: FLTK snapshots, and a new question -MACRO EXPANSION
AttachmentsNone