ArrayArrayArrayArrayArray BrainModular BrainModular Users Forum 2016-02-26T15:14:55+02:00 https://www.brainmodular.com/forums/app.php/feed/topic/5328 2016-02-26T15:14:55+02:00 2016-02-26T15:14:55+02:00 https://www.brainmodular.com/forums/viewtopic.php?t=5328&p=34831#p34831 <![CDATA[32 bit integer]]> anyway what is going out of osc receive message will be a float as well, it is no point of hacking the color parameter for a 32 bit bitread module.

it will be 24 bit max.

Statistics: Posted by oli_lab — 26 Feb 2016, 14:14


]]>
2016-02-26T13:09:51+02:00 2016-02-26T13:09:51+02:00 https://www.brainmodular.com/forums/viewtopic.php?t=5328&p=34828#p34828 <![CDATA[32 bit integer]]>
//-----------------------------------------------------------------------------
/// Usine native color format.
typedef ULong TColorUsine;

//-----------------------------------------------------------------------------
/// Type used in all parameters data.
typedef float TPrecision;

I have tried to send colors in an array and high bits get lost due to the floating point precision limits. But Color parameters obviously work.
So if you really need to sent 32 bit values, you could hijack a color parameter.

There was previously talk of using doubles (64 bit float) in Usine, but that was rejected as it would increase processing and memory overhead.

Simon.

Statistics: Posted by sm_jamieson — 26 Feb 2016, 12:09


]]>
2016-02-26T10:31:12+02:00 2016-02-26T10:31:12+02:00 https://www.brainmodular.com/forums/viewtopic.php?t=5328&p=34827#p34827 <![CDATA[32 bit integer]]> I get to the same conclusion as you : everything getting out of the module is float, no int

I made bitRead an bitWrite up to 16 bits, not bad after all.

thanx

Statistics: Posted by oli_lab — 26 Feb 2016, 09:31


]]>
2016-02-26T03:19:05+02:00 2016-02-26T03:19:05+02:00 https://www.brainmodular.com/forums/viewtopic.php?t=5328&p=34824#p34824 <![CDATA[32 bit integer]]>
In a float, bits 24-30 set the exponent value - which multiplies a number by successive powers of two. Bit 31 is always the sign bit, as you have seen.

Not quite sure yet from your code where this is happening, but the SetEvent and GetEvent API calls would be my guess, as those both take float values IIRC - even if the module is set to integer rounding.

Hope you get it fixed.

Statistics: Posted by Trogluddite — 26 Feb 2016, 02:19


]]>
2016-02-25T18:41:58+02:00 2016-02-25T18:41:58+02:00 https://www.brainmodular.com/forums/viewtopic.php?t=5328&p=34821#p34821 <![CDATA[32 bit integer]]> building bitRead and bitWrite modules....

I have trouble with integers !

I'd like to access and set each bit of a 32 bit integer

if I set the bit #31, the output becomes negative

and everything become mixed up...

actually it's behaving weirdly as soon as I set the 25th bit

I could actually limit the module to 24 bits, but as I use OSC and OSC can send 32 bit integers, could be good to manage 32 bits with the bit Write and bitRead modules


in .h

CODE:

...private&#58;//int bitRead&#40;int value, int bit&#41;;int bitWrite&#40;unsigned long int value, int bit, int bitValue&#41;;//-------------------------------------------------------------------------// parameters eventsUsineEventPtr input;UsineEventPtr output;UsineEventPtr bitValue;UsineEventPtr bitOrder;        unsigned long int m_input = 0; int m_bitOrder = 0;int m_bitValue = 0;
in .cpp

CODE:

...void bitwiseMath&#58;&#58;onCallBack&#40;UsineMessage *Message&#41;&#123;if &#40;Message->message == NOTIFY_MSG_USINE_CALLBACK && Message->lParam == MSG_CHANGE&#41;&#123;switch &#40;Message->wParam&#41;&#123;case 0&#58;m_input = sdkGetEvtData&#40;input&#41;;sdkSetEvtData&#40;output, bitWrite&#40;m_input, m_bitOrder,m_bitValue&#41;&#41;;break;case 1&#58;m_bitValue = int&#40;sdkGetEvtData&#40;bitValue&#41;&#41;;sdkSetEvtData&#40;output, bitWrite&#40;m_input, m_bitOrder, m_bitValue&#41;&#41;;break;case 2&#58;m_bitOrder = int&#40;sdkGetEvtData&#40;bitOrder&#41;&#41;;sdkSetEvtData&#40;output, bitWrite&#40;m_input, m_bitOrder, m_bitValue&#41;&#41;;break;// default casedefault&#58;break;&#125;&#125;&#125;...int bitwiseMath&#58;&#58;bitWrite&#40;unsigned long int value, int bit, int bitValue&#41; &#123;if &#40;bitValue == 1&#41; &#123;value = value | &#40;1 << bit&#41;;&#125;else if &#40;bitValue == 0&#41; &#123;value = value & ~&#40;1 << bit&#41;;&#125;else &#123;&#125;return value;&#125;

Statistics: Posted by oli_lab — 25 Feb 2016, 17:41


]]>
BrainModular BrainModular Users Forum 2016-02-26T15:14:55+02:00 https://www.brainmodular.com/forums/app.php/feed/topic/5328 2016-02-26T15:14:55+02:00 2016-02-26T15:14:55+02:00 https://www.brainmodular.com/forums/viewtopic.php?t=5328&p=34831#p34831 <![CDATA[32 bit integer]]> anyway what is going out of osc receive message will be a float as well, it is no point of hacking the color parameter for a 32 bit bitread module.

it will be 24 bit max.

Statistics: Posted by oli_lab — 26 Feb 2016, 14:14


]]>
2016-02-26T13:09:51+02:00 2016-02-26T13:09:51+02:00 https://www.brainmodular.com/forums/viewtopic.php?t=5328&p=34828#p34828 <![CDATA[32 bit integer]]>
//-----------------------------------------------------------------------------
/// Usine native color format.
typedef ULong TColorUsine;

//-----------------------------------------------------------------------------
/// Type used in all parameters data.
typedef float TPrecision;

I have tried to send colors in an array and high bits get lost due to the floating point precision limits. But Color parameters obviously work.
So if you really need to sent 32 bit values, you could hijack a color parameter.

There was previously talk of using doubles (64 bit float) in Usine, but that was rejected as it would increase processing and memory overhead.

Simon.

Statistics: Posted by sm_jamieson — 26 Feb 2016, 12:09


]]>
2016-02-26T10:31:12+02:00 2016-02-26T10:31:12+02:00 https://www.brainmodular.com/forums/viewtopic.php?t=5328&p=34827#p34827 <![CDATA[32 bit integer]]> I get to the same conclusion as you : everything getting out of the module is float, no int

I made bitRead an bitWrite up to 16 bits, not bad after all.

thanx

Statistics: Posted by oli_lab — 26 Feb 2016, 09:31


]]>
2016-02-26T03:19:05+02:00 2016-02-26T03:19:05+02:00 https://www.brainmodular.com/forums/viewtopic.php?t=5328&p=34824#p34824 <![CDATA[32 bit integer]]>
In a float, bits 24-30 set the exponent value - which multiplies a number by successive powers of two. Bit 31 is always the sign bit, as you have seen.

Not quite sure yet from your code where this is happening, but the SetEvent and GetEvent API calls would be my guess, as those both take float values IIRC - even if the module is set to integer rounding.

Hope you get it fixed.

Statistics: Posted by Trogluddite — 26 Feb 2016, 02:19


]]>
2016-02-25T18:41:58+02:00 2016-02-25T18:41:58+02:00 https://www.brainmodular.com/forums/viewtopic.php?t=5328&p=34821#p34821 <![CDATA[32 bit integer]]> building bitRead and bitWrite modules....

I have trouble with integers !

I'd like to access and set each bit of a 32 bit integer

if I set the bit #31, the output becomes negative

and everything become mixed up...

actually it's behaving weirdly as soon as I set the 25th bit

I could actually limit the module to 24 bits, but as I use OSC and OSC can send 32 bit integers, could be good to manage 32 bits with the bit Write and bitRead modules


in .h

CODE:

...private&#58;//int bitRead&#40;int value, int bit&#41;;int bitWrite&#40;unsigned long int value, int bit, int bitValue&#41;;//-------------------------------------------------------------------------// parameters eventsUsineEventPtr input;UsineEventPtr output;UsineEventPtr bitValue;UsineEventPtr bitOrder;        unsigned long int m_input = 0; int m_bitOrder = 0;int m_bitValue = 0;
in .cpp

CODE:

...void bitwiseMath&#58;&#58;onCallBack&#40;UsineMessage *Message&#41;&#123;if &#40;Message->message == NOTIFY_MSG_USINE_CALLBACK && Message->lParam == MSG_CHANGE&#41;&#123;switch &#40;Message->wParam&#41;&#123;case 0&#58;m_input = sdkGetEvtData&#40;input&#41;;sdkSetEvtData&#40;output, bitWrite&#40;m_input, m_bitOrder,m_bitValue&#41;&#41;;break;case 1&#58;m_bitValue = int&#40;sdkGetEvtData&#40;bitValue&#41;&#41;;sdkSetEvtData&#40;output, bitWrite&#40;m_input, m_bitOrder, m_bitValue&#41;&#41;;break;case 2&#58;m_bitOrder = int&#40;sdkGetEvtData&#40;bitOrder&#41;&#41;;sdkSetEvtData&#40;output, bitWrite&#40;m_input, m_bitOrder, m_bitValue&#41;&#41;;break;// default casedefault&#58;break;&#125;&#125;&#125;...int bitwiseMath&#58;&#58;bitWrite&#40;unsigned long int value, int bit, int bitValue&#41; &#123;if &#40;bitValue == 1&#41; &#123;value = value | &#40;1 << bit&#41;;&#125;else if &#40;bitValue == 0&#41; &#123;value = value & ~&#40;1 << bit&#41;;&#125;else &#123;&#125;return value;&#125;

Statistics: Posted by oli_lab — 25 Feb 2016, 17:41


]]>