
jzhao
USA
Asked
— Edited
Hi , I am programming roli in c#. I want roli speak specified words through the EZB4 soundboard. How can I do that? I used EZ_B.Speakjet.SpeakString(EZ_B.Digital.DigitalPortEnum, System.String), but no sound.
@shaimaabes,
NullReference Exception is very clear, basically you have a NULL object e.g. instance and you try to call or reference a method on it.
looking to the picture:
the class field ezb is not created neither is pointing to a valid reference.
you have two options:
Do it like David mention in the above post, basically you create an EZB instance, connect and you hold it like in a standalone application (remember the other example)
You are building an ARC.plugin, you have access to the ARC.singleton class EZBManager inside this class you have an array of 5 EZBs representing the same 5 EZBs available in the ARC.Connection Control.
the 5 ezbs exists even if they are not connected.
if you prefer you can keep a reference and use the reference:
you can also connect the ezb instance, although i think is not possible to obtain the IP/Address specified in the Connection Box's TextBox
but if you are successful the ARC.Connection Box's Button will turn blue.
if you are building a ARC.plugin you should use the ARC.EZManager to keep the actions in sync with ARC.
Otherwise you will have 2 or more TCP connections to the EZB Controller.
I wouldn't do it like I mentioned, just providing an example showing that the connection has to be established and that the instance of the object has to be established before it's used. More than anything, just showing real quickly that it needs to be setup before it can be used.
@David,
"There's more than one way to skin a cat.", your code works plugin or not.
To be honest i had the idea that only one EZB could be connected (TCP) to the controller, but, it's possible to have 2 or more TCP connections and sending commands.
Although is not possible the EZB use the same TCP channel to initiate a communication and send data (async results), i'm making this deduction based in the WIFI firmare code.
ASFAIK all the EZB controller commands are (sync) initiated from the Host to the controller.
Yeah I'll confirm that this approach contradicts the fantastic and in depth plugin tutorial. Never connect to the ezb in a plugin - there's no reason. Also, you can only have one connection to the ezb at a time.
Original poster, please follow the tutorial that was created to avoid these circumstances.
If you want access to speaker, use the EZBManager.EZBs[0].....
I agree totally. The example was to show why the null reference exception was happening. He was trying to use the object before it was created as it was never created. Also there was some confusion as to if they were making a plugin or if they were making something with the C# SDK. I am of the opinion that they were making something from the C# SDK due to the category and reference to tutorial 61. The confusing thing comes in with the way that the form is inheriting from UCForms.PluginMaster. Not sure still which they are trying to do, but maybe they will come back on and clarify.
Oh, I see now... The original poster wasn't the same person who asked the question today.
It would probably be best to start a new thread with the correct category so that it doesn't confuse those who are trying to help.
All good...
@CochranRobotics
thanks for ur help
it's working
nw I could here my jd <3 thanks alot