rorywalsh / cabbage

Framework for developing audio plugins with the Csound programming language.
http://cabbageaudio.com
GNU General Public License v3.0
509 stars 35 forks source link

Missing widget macros break parsing #89

Closed tgrey1 closed 4 years ago

tgrey1 commented 4 years ago

It looks like if a widget line uses an undefined macro, the next entry of values on the line gets lost.

In this example, commenting out the color macro loses bounds() for one widget, and items() for the other!

<Cabbage>
form caption("Combobox Example") size(400, 300), pluginID("test")

; commenting out the definition breaks things!
#define COLOR colour(255,0,0,255)

; this one loses it's items
combobox $COLOR items("1", "2", "3"), bounds(100, 100, 150, 30)

; this one loses it's bounds
combobox $COLOR bounds(100, 150, 150, 30), items("1", "2", "3")

</Cabbage>
<CsoundSynthesizer>
<CsOptions>
-n -d -+rtmidi=NULL -M0 -m0d 
</CsOptions>
<CsInstruments>
; Leave most value default, need something to compile
ksmps = 32

</CsInstruments>
<CsScore>
;causes Csound to run for about 7000 years...
f0 z
</CsScore>
</CsoundSynthesizer>

This is how it looks by default: image

And then if you comment out the color macro, which should in theory ONLY lose the color settings for the widgets, it looks like this: image

rorywalsh commented 4 years ago

Using the very latest build, 2.3.56, I don't see any issues?

macroTest

tgrey1 commented 4 years ago

Oi, let me freshen up. I think I'm on an Aug.20 build.

I had an Aug.24 build, but for some reason I stepped back... I don't recall why. Maybe https://github.com/rorywalsh/cabbage/issues/83?

tgrey1 commented 4 years ago

Hrm... I grabbed 20200902.2, and this example still appears to break for me in both full and lite.

tgrey1 commented 4 years ago

Ok... this is interesting. It matters on if it's commented out like: ;#define COLOR colour(255,0,0,255) vs. ; #define COLOR colour(255,0,0,255)

image

image

rorywalsh commented 4 years ago

Interesting! I'll take a deeper look tomorrow..

rorywalsh commented 4 years ago

Should be fixed now in git. Note that I only tested this case, so you might want to quickly run through some other macro heavy .csd files just to make sure my commit doesn't break them. Can you close this out if it passes your tests? Thanks.

tgrey1 commented 4 years ago

I grabbed 20200903.3... something is definitely wrong here. It fixed the original problem, but another has crept in.

Multiple macros don't appear to be working, for example: (editing to update the inline comments, they were from the previous example)

<Cabbage>
form caption("Combobox Example") size(400, 300), pluginID("test")

#define COLOR colour(255,0,0,255)
; this second macro doesn't appear to get set
#define ANOTHER colour(0,255,0,255)

combobox $COLOR items("1", "2", "3"), bounds(100, 100, 150, 30)

combobox $ANOTHER bounds(100, 150, 150, 30), items("1", "2", "3")

</Cabbage>
<CsoundSynthesizer>
<CsOptions>
-n -d -+rtmidi=NULL -M0 -m0d 
</CsOptions>
<CsInstruments>
; Leave most value default, need something to compile
ksmps = 32

</CsInstruments>
<CsScore>
;causes Csound to run for about 7000 years...
f0 z
</CsScore>
</CsoundSynthesizer>

image

rorywalsh commented 4 years ago

Ha, I was afraid of something like that! I had another go at fixing it. Let me know if it works. Both of your csd run fine.

tgrey1 commented 4 years ago

20200903.4 is looking much better! I ran some of my most macro heavy examples, and everything appears to be working exactly as expected.

I'll close this out and reopen if needed, or open a new one if it seems more appropriate to whatever I find. Thanks for taking a look at this!