Page 2 of 2

Re: OSC (OpenSoundControl) and PB

Posted: Mon May 27, 2019 9:20 pm
by HeX0R

Code: Select all

Structure _FLOAT_SWAPPER_
	StructureUnion
		b.b[4]
		f.f
	EndStructureUnion
EndStructure

*ba._FLOAT_SWAPPER_ = ?Stream
Swap *ba\b[0], *ba\b[3]
Swap *ba\b[1], *ba\b[2]
Debug *ba\f


DataSection
	Stream:
	Data.b $3D,  $B4,  $2D,  $0B
EndDataSection

Re: OSC (OpenSoundControl) and PB

Posted: Tue May 28, 2019 8:08 am
by Simo_na
Thank you HeX0R
it is correct in this syntax ?

Code: Select all

EnableExplicit

Structure myfloat
StructureUnion
b.b[4]
f.f
EndStructureUnion
EndStructure

Global Dim mydata.myfloat(4)
Global *ba.myfloat

mydata(0)\b[0]=$3D
mydata(0)\b[1]=$B4
mydata(0)\b[2]=$2D
mydata(0)\b[3]=$0B

*ba.myfloat = mydata(0)
Swap *ba\b[0], *ba\b[3]
Swap *ba\b[1], *ba\b[2]
Debug *ba\f

;DataSection
;   Stream:
;   Data.b $3D,  $B4,  $2D,  $0B
;EndDataSection

Re: OSC (OpenSoundControl) and PB

Posted: Tue May 28, 2019 7:23 pm
by infratec
My solution:

Code: Select all

Procedure.f GetBigEndianFloat(*Ptr.Byte)
  
  Protected Result.f, *Result.Byte, i.i
  
  *Result = @Result + 3
  
  For i = 0 To 3
    *Result\b = *Ptr\b
    *Result - 1
    *Ptr + 1
  Next i
  
  ProcedureReturn Result
  
EndProcedure


Debug GetBigEndianFloat(?Stream)


DataSection
   Stream:
   Data.b $3D,  $B4,  $2D,  $0B
EndDataSection

Re: OSC (OpenSoundControl) and PB

Posted: Tue May 28, 2019 8:45 pm
by Mijikai
Try this :)

Code: Select all

Procedure.f GetBigEndianFloat(*Pointer)
  Protected result.f
  !mov rax,[p.p_Pointer]
  !mov eax,dword[rax]
  !bswap eax
  !mov dword[p.v_result],eax
  ProcedureReturn result
EndProcedure

Debug GetBigEndianFloat(?dummy)

DataSection
  dummy:
  !db 0x3D, 0xB4, 0x2D, 0x0B
EndDataSection

Re: OSC (OpenSoundControl) and PB

Posted: Tue May 28, 2019 9:18 pm
by infratec
ThumpUp !!!

Re: OSC (OpenSoundControl) and PB

Posted: Wed May 29, 2019 2:49 pm
by Simo_na
:shock:

Thank you

Re: OSC (OpenSoundControl) and PB

Posted: Wed Jun 05, 2019 6:27 pm
by Simo_na
Hi

i want to send this osc compliant

/info~~~,~~~

when '~' is '00'

which in practice becomes

Size = BuildMessage(*message, "/info~~~","~~~")

In that case, the number of ~ characters accurately represent the number of Null bytes (or \0)
sent along with the command to respect the formatting imposed by the OSC protocol.

is possible to modifying the build procedure ??

Code: Select all

Procedure.i Build Message(*Buffer, adc.s, typeTag.s, val.f)


Thank you

Re: OSC (OpenSoundControl) and PB

Posted: Thu Aug 25, 2022 10:19 pm
by DannyWeijermans
infratec wrote: Sat May 25, 2019 4:07 pm Use somethig like this after your SendNetwork stuff:

Code: Select all

Timeout = 100
*Buffer = AllocateMemory(2048, #PB_Memory_NoClear)
If *Buffer
  Repeat
    
    NetEv = NetworkClientEvent(Con)
    Select NetEv
      Case #PB_NetworkEvent_None
        Delay(10)
        Timeout - 1
      Case #PB_NetworkEvent_Data
        RcvLen = ReceiveNetworkData(Con, *Buffer, MemorySize(*Buffer))
        If RcvLen
          ShowMemoryViewer(*Buffer, RcvLen)
          Break
        EndIf
    EndSelect
    
  Until Timeout = 0
  FreeMemory(*Buffer)
EndIf
I'm testing this software in OSX:
NetEv always stays 0.
is there anything special/different for the 'Con' (connection) ?