Cabbage Logo
Back to Cabbage Site

CsoundUnity: Combobox and Storing Inspector Values

Hello,

A couple of questions regarding the current CsoundUnity integration

  1. Comboboxes seem to display fine in the Unity inspector but my instrument doesn’t work in Unity if I’m using a chnget to get a combobox channel inside Csound. Are comboboxes not currently supported in the current version of the package?

  2. Whenever I change scenes or reopen Unity, all the Control Channels values set in the Unity inspector are reset. Prefabs also do not store those values permanently. Is there any way those values could be stored inside Unity?

Thanks so much in advance!

This is strange as both things should work.
Just to be sure, are you using the version 3 of the package, imported via PackageManager?
I will do some tests asap (possibly late afternoon) and get back to you.

Edit: I just tested changing scenes and using prefabs, and the values are stored/restored correctly.
Can you send me a minimal csd+csharp that reproduces the issue with the combo boxes?

2 Likes

Thanks for the reply!

Yes, I’m using version 3 imported through the package manager

Here’s a paired down combobox example: ComboboxTest.csd (1.6 KB)

I tested it some more and realized the combobox does work, but I have to change its value at least once in the Unity inspector, otherwise the instrument wont output a sound, and if I have an instrument with multiple comboboxes, I have to change the value for every single one of them for the instrument to work (which is a bit inconvenient xD)

Also the Control Channel values set on the Unity inspector are indeed stored for this instrument but still are not stored for another larger instrument I’m workin with for some reason

Edit: sorry just realized I didn’t send a C# script but I did include a trigger button on the .csd that can be clicked on the inspector at runtime

I think I fixed the issue with the comboboxes. Thanks for finding it! Just reimport the CsoundUnity package to test it.

About the larger instrument, it could be that the serialization fails because it cannot parse correctly some Cabbage widget.
It’s hard to tell without having a look at the csd.
Are all the widgets/channels used in the csd displayed as expected in the CsoundUnity inspector?

1 Like

Just reimported CsoundUnity and my comboboxes are working, thank you so much!

Also figured out what was happening with the larger instrument. I was adapting a cabbage synth vst I had previously made into CsoundUnity and it had the block of code below the line, all the way at the bottom. Removing that solved the value storage issue.

<bsbPanel>
 <label>Widgets</label>
 <objectName/>
 <x>100</x>
 <y>100</y>
 <width>320</width>
 <height>240</height>
 <visible>true</visible>
 <uuid/>
 <bgcolor mode="nobackground">
  <r>255</r>
  <g>255</g>
  <b>255</b>
 </bgcolor>
</bsbPanel>
<bsbPresets>
</bsbPresets>
1 Like

Glad that the combo boxes are working now. It was just a wrong index.
Those lines should come from CsoundQT.
This is very interesting, Thanks for reporting!

@giovannibedettim, I wonder should we guard against this in the parser. Is everything in CsoundQT contained with <bsb.....> tags?

I agree.
I’m not sure if there can be other tags, is there a doc somewhere?
I had a quick search and I only found that they can removed with a setting on CsoundQT.