Csound Csound-dev Csound-tekno Search About

Re: [Csnd-dev] [Csnd] FLsetText from udo (fwd)

Date2018-12-09 21:34
Fromjpff
SubjectRe: [Csnd-dev] [Csnd] FLsetText from udo (fwd)
A little further investigation suggests tht this happens when the udo 
instance is reused.  I have tried many variats of writing the udo inline 
(works OK) and replicating the udo with a differenr name anfd using bot 
(fails).

---------- Forwarded message ----------
Date: Sun, 9 Dec 2018 20:31:37 +0000
From: jpff 
Reply-To: A discussion list for users of Csound 
To: CSOUND@LISTSERV.HEANET.IE
Subject: Re: [Csnd] FLsetText from udo

I finally got round to looking at this.  Yes it is very odd.  As you hinted it 
is a udo problem as inserting the code inline in instr 1 corrects the output. 
I think we need Syephen's thougts on this as it looks as if the udo is caching 
data from a previous call.  I will continue to look but really this is not my 
area.

==John


On Fri, 7 Dec 2018, Richard Knight wrote:

> 
> Hello
> I'm trying to set the text of FLboxes from a udo  (the example given below is
> a cut down version, there is a specific reason I want to try and do this from
> a udo).
> Passing the widget handle to the opcode, the FLsetText works on the first
> FLbox but then on the subsequent FLboxes, every one that has had FLsetText
> called on it previously has the text set.
> 
> Looks like a similar thing was mentioned on the list by Dominik K on
> 2017-09-03 but couldn't find any solution. I have tried a few workarounds and
> experienced some unusual behaviour. For example I put the FlsetText in an
> instr, and then called this from the udo using
>     Score sprintf "i98 0 1 \"%s\" %d", StringToSet, ilabelhandle
>     prints Score
>     scoreline Score
> 
> This printed the correct score line, but FLsetText did strange things.
> Sometimes unusual characters were set in the FLbox, once the full score line
> was set, and sometimes "%d" was set.
> 
> Any ideas/suggestions/workarounds appreciated.
> Richard
> 
> 
> 
> 
> -odac
> 
> 
> sr = 44100
> kr = 44100
> nchnls = 2
> 0dbfs = 1
> seed 1
> 
> 
> FLpanel "Example", 200, 200
> 
>     gib1 FLbox "test", 1, 10, 20, 200, 50, 0, 0
>     gib2 FLbox "test", 1, 10, 20, 200, 50, 0, 50
>     gib3 FLbox "test", 1, 10, 20, 200, 50, 0, 100
>     gib4 FLbox "empty", 1, 10, 20, 200, 50, 0, 150
> 
> FLpanelEnd
> FLrun
> 
> 
> opcode update, 0, iS
>     ihandle, Sval xin
>     print ihandle
>     FLsetText Sval, ihandle
> endop
> 
> 
> 
> instr 1
>     Sval strget p4
>     update gib1, Sval
> endin
> 
> 
> instr 2
>     Sval strget p4
>     update gib2, Sval
> endin
> 
> 
> instr 3
>     Sval strget p4
>     update gib3, Sval
> endin
> 
> 
> 
> 
> f0 10
> 
> i1 0 1 "box 1: 1"  ; gib1 shows "box 1: 1" ; ihandle printed = 0
> i1 1 1 "box 1: 2"  ; gib1 shows "box 2: 2" ; ihandle printed = 0
> 
> i2 2 1 "box 2: 1"  ; gib1, gib2 show "box 2: 1" ; ihandle printed = 1
> i2 3 1 "box 2: 2"  ; gib1, gib2 show "box 2: 2" ; ihandle printed = 1
> 
> i3 4 1 "box 3: 1"  ; gib1, gib2, gib3 show "box 3: 1" ; ihandle printed = 2
> i3 5 1 "box 3: 2"  ; gib1, gib2, gib3 show "box 3: 2" ; ihandle printed = 2
> 
> 
> 
> 
> Csound mailing list Csound@listserv.heanet.ie
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to
> https://github.com/csound/csound/issues Discussions of bugs and features can
> be posted here
>

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here