Sensomusic

#1 2018-08-19 10:04:57

imodularsynth
Platinum Member

Hi guys,

I am writing a module on which there is a ptIpAddress input. When I enter a new IP address on the patch, the callback is called correctly, but I am unable to retrieve the IP address, I always get 0.

Moreover, sdkGetEvtSize returns 1, which sounds strange (I was expecting 4, since there are four bytes)

sdkGetEvtData() returns 0 whatever I enter in Usine
Same result with sdkGetEvtArrayData (IPAddrEvent, 0);

The input is declared like this, so I think it's correct :

            pParamInfo->ParamType = ptIpAddress;
            pParamInfo->Caption = "IP";
            pParamInfo->IsStoredInPreset = TRUE;
            pParamInfo->IsInput = TRUE;
            pParamInfo->IsOutput = FALSE;
            pParamInfo->CallBackType = ctImmediate;
            pParamInfo->EventPtr = &IPAddrEvent;

Anybody having an idea about the way to retrieve the IP address entered ?

Thanks

Benoit

Offline

 

#2 2018-08-19 10:47:46

23fx23
Community

one thing i sometimes do when  doubt on pins is open the console (the white one), and hold a wire from a pin, here the console show infos like src_flow_type, src_dispay type ect.
when trying from the osc_receive module ip pin, it says flow type 3, wich is same as purple floats, the 4byte of float are an event of size 1.
if man put a color on the ip, the 4bytes are 255 255 255 255 for full rgba and so is the ip.

didn't try in sdk but what is strange is  sdkGetEventData should work then . pers i never set the     pParamInfo->EventPtr = &IPAddrEvent; thing
if have a   UsineEventPtr my_param;  in the .h,   and  set it in the onSetEventAddress(int ParamIndex, UsineEventPtr pEvent)
switch (ParamIndex)
    {
    case  0:my_param = pEvent; break;
...
like the provided examples
dk if that could be the cause of the problem...

Offline

 

#3 2018-08-19 14:17:31

imodularsynth
Platinum Member

Hey 23fx23,

apparently, you are right : Usine considers an IP address to be one int rather than four bytes.

I have solved my problem by using sdkGetEvtDataAddr function like this :

Addr=(unsigned int*)sdkGetEvtDataAddr (IPAddrEvent);
IP=htonl(*Addr);

and now it works like a charm, I am able to receive the IP address entered on the patch

Benoit

Offline