diff --git a/DEVLOG.md b/DEVLOG.md new file mode 100644 index 0000000000000000000000000000000000000000..6f224cb4e415751b4e513d34f2204531ad72097e --- /dev/null +++ b/DEVLOG.md @@ -0,0 +1,104 @@ +# devlog + +## 2018/12/13 + +### done + +* compilation fixed +* classes oscsender and oscreceiver ready to use + +### todo + +* finish the oscmsg (osc message) class to prepare messages in gdscript instead + +### windows compilation + +ended with error in linker: + + link /nologo /dll /out:demo\bin\win64\libgdosc.dll /implib:demo\bin\win64\libgdosc.lib /LIBPATH:godot-cpp\bin godot-cpp.windows.64.lib src\gdlibrary.obj src\oscmsg.obj src\oscreceiver.obj src\oscsender.obj oscpack\osc\OscOutboundPacketStream.obj oscpack\osc\OscPrintReceivedElements.obj oscpack\osc\OscReceivedElements.obj oscpack\osc\OscTypes.obj oscpack\ip\IpEndpointName.obj oscpack\ip\win32\NetworkingUtils.obj oscpack\ip\win32\UdpSocket.obj + Creating library demo\bin\win64\libgdosc.lib and object demo\bin\win64\libgdosc.exp + NetworkingUtils.obj : error LNK2019: unresolved external symbol __imp_ntohl referenced in function "unsigned long __cdecl GetHostByName(char const *)" (?GetHostByName@@YAKPEBD@Z) + UdpSocket.obj : error LNK2001: unresolved external symbol __imp_ntohl + NetworkingUtils.obj : error LNK2019: unresolved external symbol __imp_gethostbyname referenced in function "unsigned long __cdecl GetHostByName(char const *)" (?GetHostByName@@YAKPEBD@Z) + NetworkingUtils.obj : error LNK2019: unresolved external symbol __imp_WSAStartup referenced in function "public: __cdecl NetworkInitializer::NetworkInitializer(void)" (??0NetworkInitializer@@QEAA@XZ) + NetworkingUtils.obj : error LNK2019: unresolved external symbol __imp_WSACleanup referenced in function "public: __cdecl NetworkInitializer::~NetworkInitializer(void)" (??1NetworkInitializer@@QEAA@XZ) + UdpSocket.obj : error LNK2019: unresolved external symbol __imp_timeGetTime referenced in function "private: double __cdecl SocketReceiveMultiplexer::Implementation::GetCurrentTimeMs(void)const " (?GetCurrentTimeMs@Implementation@SocketReceiveMultiplexer@@AEBANXZ) + UdpSocket.obj : error LNK2019: unresolved external symbol __imp_bind referenced in function "public: void __cdecl UdpSocket::Implementation::Bind(class IpEndpointName const &)" (?Bind@Implementation@UdpSocket@@QEAAXAEBVIpEndpointName@@@Z) + UdpSocket.obj : error LNK2019: unresolved external symbol __imp_closesocket referenced in function "public: __cdecl UdpSocket::Implementation::~Implementation(void)" (??1Implementation@UdpSocket@@QEAA@XZ) + UdpSocket.obj : error LNK2019: unresolved external symbol __imp_connect referenced in function "public: void __cdecl UdpSocket::Implementation::Connect(class IpEndpointName const &)" (?Connect@Implementation@UdpSocket@@QEAAXAEBVIpEndpointName@@@Z) + UdpSocket.obj : error LNK2019: unresolved external symbol __imp_ioctlsocket referenced in function "public: void __cdecl SocketReceiveMultiplexer::Implementation::Run(void)" (?Run@Implementation@SocketReceiveMultiplexer@@QEAAXXZ) + UdpSocket.obj : error LNK2019: unresolved external symbol __imp_getsockname referenced in function "public: class IpEndpointName __cdecl UdpSocket::Implementation::LocalEndpointFor(class IpEndpointName const &)const " (?LocalEndpointFor@Implementation@UdpSocket@@QEBA?AVIpEndpointName@@AEBV3@@Z) + UdpSocket.obj : error LNK2019: unresolved external symbol __imp_htonl referenced in function "void __cdecl SockaddrFromIpEndpointName(struct sockaddr_in &,class IpEndpointName const &)" (?SockaddrFromIpEndpointName@@YAXAEAUsockaddr_in@@AEBVIpEndpointName@@@Z) + UdpSocket.obj : error LNK2019: unresolved external symbol __imp_htons referenced in function "void __cdecl SockaddrFromIpEndpointName(struct sockaddr_in &,class IpEndpointName const &)" (?SockaddrFromIpEndpointName@@YAXAEAUsockaddr_in@@AEBVIpEndpointName@@@Z) + UdpSocket.obj : error LNK2019: unresolved external symbol __imp_ntohs referenced in function "class IpEndpointName __cdecl IpEndpointNameFromSockaddr(struct sockaddr_in const &)" (?IpEndpointNameFromSockaddr@@YA?AVIpEndpointName@@AEBUsockaddr_in@@@Z) + UdpSocket.obj : error LNK2019: unresolved external symbol __imp_recvfrom referenced in function "public: unsigned __int64 __cdecl UdpSocket::Implementation::ReceiveFrom(class IpEndpointName &,char *,unsigned __int64)" (?ReceiveFrom@Implementation@UdpSocket@@QEAA_KAEAVIpEndpointName@@PEAD_K@Z) + UdpSocket.obj : error LNK2019: unresolved external symbol __imp_send referenced in function "public: void __cdecl UdpSocket::Implementation::Send(char const *,unsigned __int64)" (?Send@Implementation@UdpSocket@@QEAAXPEBD_K@Z) + UdpSocket.obj : error LNK2019: unresolved external symbol __imp_sendto referenced in function "public: void __cdecl UdpSocket::Implementation::SendTo(class IpEndpointName const &,char const *,unsigned __int64)" (?SendTo@Implementation@UdpSocket@@QEAAXAEBVIpEndpointName@@PEBD_K@Z) + UdpSocket.obj : error LNK2019: unresolved external symbol __imp_setsockopt referenced in function "public: void __cdecl UdpSocket::Implementation::SetAllowReuse(bool)" (?SetAllowReuse@Implementation@UdpSocket@@QEAAX_N@Z) + UdpSocket.obj : error LNK2019: unresolved external symbol __imp_socket referenced in function "public: __cdecl UdpSocket::Implementation::Implementation(void)" (??0Implementation@UdpSocket@@QEAA@XZ) + UdpSocket.obj : error LNK2019: unresolved external symbol __imp_WSAGetLastError referenced in function "public: class IpEndpointName __cdecl UdpSocket::Implementation::LocalEndpointFor(class IpEndpointName const &)const " (?LocalEndpointFor@Implementation@UdpSocket@@QEBA?AVIpEndpointName@@AEBV3@@Z) + UdpSocket.obj : error LNK2019: unresolved external symbol __imp_WSAEventSelect referenced in function "public: void __cdecl SocketReceiveMultiplexer::Implementation::Run(void)" (?Run@Implementation@SocketReceiveMultiplexer@@QEAAXXZ) + demo\bin\win64\libgdosc.dll : fatal error LNK1120: 20 unresolved externals + scons: *** [demo\bin\win64\libgdosc.dll] Error 1120 + scons: building terminated because of errors. + +## 2018/10/25 + +### done + +* all set methods are using Variant instead of typed arguments +* utils contains methods to check variant easily +* registration of methods and properties for gdnative +* adaptation of godot macros ( see GODOT_SUBCLASS ) +* include and SConstruct adaptations, should be cross-platform + +### todo + +* enable OSCreceiver signal in OSCreceiver.cpp, line 285 (crash at compilation) +* verify gdnlib & gdns in demo/bin/ +* debug loadong in gdscript +* make OSCsender & OSCreceiver appears in the object selector in godot + +#### gdscript + +`receiver = load("res://bin/OSCreceiver.gdns").new()` + +result: + + ERROR: poll: res://bin/OSCreceiver.gdns:9 - Parse Error: Can't load cached ext-resource #1 + At: scene/resources/scene_format_text.cpp:587. + + ERROR: _load: Failed loading resource: res://bin/OSCreceiver.gdns + At: core/io/resource_loader.cpp:192. + +## 2018/10/25 + +### done + +* Fix linking oscpack shared object files + +### pitfall + +* SConstruct is definitely not cross-platform friendly, see comment in-file + +### Warnings + +When loading the project, I get this in Godot's output window + +``` + drivers/unix/net_socket_posix.cpp:301 - Method/Function Failed, returning: ERR_UNAVAILABLE + modules/gdnative/gdnative.cpp:480 - No valid library handle, can't get symbol from GDNative object + modules/gdnative/gdnative.cpp:386 - No valid library handle, can't terminate GDNative object + Can't open dynamic library: /home/mis/src/gdnative_osc/demo/bin/x11/libgdosc.so. Error: /home/mis/src/gdnative_osc/demo/bin/x11/libgdosc.so: undefined symbol: nativescript_api +``` + +Also, in the console, possibly related to Frankie's *todo* point #4 +``` +ERROR: _load: Failed loading resource: res://bin/OSCreceiver.gdns +``` + +# links + +* https://gamedevadventures.posthaven.com/using-c-plus-plus-and-gdnative-in-godot-part-1 +* https://godotengine.org/qa/17007/possible-to-export-variables-to-editor-when-using-gdnative +* https://www.sisik.eu/blog/godot/gd-native-calling-gdscript-method-from-cpp-code diff --git a/NEWS.md b/NEWS.md new file mode 100644 index 0000000000000000000000000000000000000000..e6b68dbff38c1075ebf18637ada3208a64efc8bc --- /dev/null +++ b/NEWS.md @@ -0,0 +1,7 @@ +# gdnative OSC changelog +## [0.1.0] - 2018-12-?? + +* all basic functionality of https://github.com/djiamnot/gdosc +* OSC message handling via Variants +* cross-platform friendly building setup +* binaries for Linux, Windows, OSX diff --git a/README.md b/README.md index 8b7ef661cf05bae6dd47ca3af527e132dce5d915..523eed4d03ccbf6abdd19a45d542612b03ab2b82 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,14 @@ The code will compile into a dynamic library, easy to load and use in godot proj * GDnative version of https://github.com/djiamnot/gdosc. * based on https://gitlab.com/frankiezafe/gdnative_template +## about OSC + +Open Sound Control (OSC) is a network protocol commonly used in digital arts, stage and live multimedia performances to exchange information between softwares. Based on UDP protocol, it ensures fast communication and nearly no knowledge about network management. + +This addon is based on the cross-platorm OSC lib [oscpack](http://www.rossbencina.com/code/oscpack). + +[OSC official website](http://opensoundcontrol.org) + ## structure ### demo/ @@ -25,33 +33,27 @@ contains a simple [puredata](http://puredata.info/) patch that emits OSC message contains the sources of the library -## about OSC - -Open Sound Control (OSC) is a network protocol commonly used in digital arts, stage and live multimedia performances to exchange information between softwares. Based on UDP protocol, it ensures fast communication and nearly no knowledge about network management. - -This addon is based on the cross-platorm OSC lib [oscpack](http://www.rossbencina.com/code/oscpack). - -[OSC official website](http://opensoundcontrol.org) - ## compilation ### no headache process #### linux +``` bash git clone https://gitlab.com/frankiezafe/gdnative_osc.git - cd gdnative_template + cd gdnative_osc git submodule init && git submodule update cd godot-cpp/ git submodule init && git submodule update scons platform=linux headers_dir=godot_headers generate_bindings=yes cd ../ scons platform=linux +``` #### osx git clone https://gitlab.com/frankiezafe/gdnative_osc.git - cd gdnative_template + cd gdnative_osc git submodule init && git submodule update cd godot-cpp/ git submodule init && git submodule update @@ -62,7 +64,7 @@ This addon is based on the cross-platorm OSC lib [oscpack](http://www.rossbencin #### windows 10 64bits + vs 2017 git clone https://gitlab.com/frankiezafe/gdnative_osc.git - cd gdnative_template + cd gdnative_osc git submodule init && git submodule update cd godot-cpp/ git submodule init && git submodule update @@ -71,108 +73,3 @@ This addon is based on the cross-platorm OSC lib [oscpack](http://www.rossbencin scons platform=windows for other windows / vs version, refer to https://gitlab.com/frankiezafe/gdnative_template - -## devlog - -### 2018/12/13 - -#### done - -* compilation fixed -* classes oscsender and oscreceiver ready to use - -#### todo - -* finish the oscmsg (osc message) class to prepare messages in gdscript instead - -#### windows compilation - -ended with error in linker: - - link /nologo /dll /out:demo\bin\win64\libgdosc.dll /implib:demo\bin\win64\libgdosc.lib /LIBPATH:godot-cpp\bin godot-cpp.windows.64.lib src\gdlibrary.obj src\oscmsg.obj src\oscreceiver.obj src\oscsender.obj oscpack\osc\OscOutboundPacketStream.obj oscpack\osc\OscPrintReceivedElements.obj oscpack\osc\OscReceivedElements.obj oscpack\osc\OscTypes.obj oscpack\ip\IpEndpointName.obj oscpack\ip\win32\NetworkingUtils.obj oscpack\ip\win32\UdpSocket.obj - Creating library demo\bin\win64\libgdosc.lib and object demo\bin\win64\libgdosc.exp - NetworkingUtils.obj : error LNK2019: unresolved external symbol __imp_ntohl referenced in function "unsigned long __cdecl GetHostByName(char const *)" (?GetHostByName@@YAKPEBD@Z) - UdpSocket.obj : error LNK2001: unresolved external symbol __imp_ntohl - NetworkingUtils.obj : error LNK2019: unresolved external symbol __imp_gethostbyname referenced in function "unsigned long __cdecl GetHostByName(char const *)" (?GetHostByName@@YAKPEBD@Z) - NetworkingUtils.obj : error LNK2019: unresolved external symbol __imp_WSAStartup referenced in function "public: __cdecl NetworkInitializer::NetworkInitializer(void)" (??0NetworkInitializer@@QEAA@XZ) - NetworkingUtils.obj : error LNK2019: unresolved external symbol __imp_WSACleanup referenced in function "public: __cdecl NetworkInitializer::~NetworkInitializer(void)" (??1NetworkInitializer@@QEAA@XZ) - UdpSocket.obj : error LNK2019: unresolved external symbol __imp_timeGetTime referenced in function "private: double __cdecl SocketReceiveMultiplexer::Implementation::GetCurrentTimeMs(void)const " (?GetCurrentTimeMs@Implementation@SocketReceiveMultiplexer@@AEBANXZ) - UdpSocket.obj : error LNK2019: unresolved external symbol __imp_bind referenced in function "public: void __cdecl UdpSocket::Implementation::Bind(class IpEndpointName const &)" (?Bind@Implementation@UdpSocket@@QEAAXAEBVIpEndpointName@@@Z) - UdpSocket.obj : error LNK2019: unresolved external symbol __imp_closesocket referenced in function "public: __cdecl UdpSocket::Implementation::~Implementation(void)" (??1Implementation@UdpSocket@@QEAA@XZ) - UdpSocket.obj : error LNK2019: unresolved external symbol __imp_connect referenced in function "public: void __cdecl UdpSocket::Implementation::Connect(class IpEndpointName const &)" (?Connect@Implementation@UdpSocket@@QEAAXAEBVIpEndpointName@@@Z) - UdpSocket.obj : error LNK2019: unresolved external symbol __imp_ioctlsocket referenced in function "public: void __cdecl SocketReceiveMultiplexer::Implementation::Run(void)" (?Run@Implementation@SocketReceiveMultiplexer@@QEAAXXZ) - UdpSocket.obj : error LNK2019: unresolved external symbol __imp_getsockname referenced in function "public: class IpEndpointName __cdecl UdpSocket::Implementation::LocalEndpointFor(class IpEndpointName const &)const " (?LocalEndpointFor@Implementation@UdpSocket@@QEBA?AVIpEndpointName@@AEBV3@@Z) - UdpSocket.obj : error LNK2019: unresolved external symbol __imp_htonl referenced in function "void __cdecl SockaddrFromIpEndpointName(struct sockaddr_in &,class IpEndpointName const &)" (?SockaddrFromIpEndpointName@@YAXAEAUsockaddr_in@@AEBVIpEndpointName@@@Z) - UdpSocket.obj : error LNK2019: unresolved external symbol __imp_htons referenced in function "void __cdecl SockaddrFromIpEndpointName(struct sockaddr_in &,class IpEndpointName const &)" (?SockaddrFromIpEndpointName@@YAXAEAUsockaddr_in@@AEBVIpEndpointName@@@Z) - UdpSocket.obj : error LNK2019: unresolved external symbol __imp_ntohs referenced in function "class IpEndpointName __cdecl IpEndpointNameFromSockaddr(struct sockaddr_in const &)" (?IpEndpointNameFromSockaddr@@YA?AVIpEndpointName@@AEBUsockaddr_in@@@Z) - UdpSocket.obj : error LNK2019: unresolved external symbol __imp_recvfrom referenced in function "public: unsigned __int64 __cdecl UdpSocket::Implementation::ReceiveFrom(class IpEndpointName &,char *,unsigned __int64)" (?ReceiveFrom@Implementation@UdpSocket@@QEAA_KAEAVIpEndpointName@@PEAD_K@Z) - UdpSocket.obj : error LNK2019: unresolved external symbol __imp_send referenced in function "public: void __cdecl UdpSocket::Implementation::Send(char const *,unsigned __int64)" (?Send@Implementation@UdpSocket@@QEAAXPEBD_K@Z) - UdpSocket.obj : error LNK2019: unresolved external symbol __imp_sendto referenced in function "public: void __cdecl UdpSocket::Implementation::SendTo(class IpEndpointName const &,char const *,unsigned __int64)" (?SendTo@Implementation@UdpSocket@@QEAAXAEBVIpEndpointName@@PEBD_K@Z) - UdpSocket.obj : error LNK2019: unresolved external symbol __imp_setsockopt referenced in function "public: void __cdecl UdpSocket::Implementation::SetAllowReuse(bool)" (?SetAllowReuse@Implementation@UdpSocket@@QEAAX_N@Z) - UdpSocket.obj : error LNK2019: unresolved external symbol __imp_socket referenced in function "public: __cdecl UdpSocket::Implementation::Implementation(void)" (??0Implementation@UdpSocket@@QEAA@XZ) - UdpSocket.obj : error LNK2019: unresolved external symbol __imp_WSAGetLastError referenced in function "public: class IpEndpointName __cdecl UdpSocket::Implementation::LocalEndpointFor(class IpEndpointName const &)const " (?LocalEndpointFor@Implementation@UdpSocket@@QEBA?AVIpEndpointName@@AEBV3@@Z) - UdpSocket.obj : error LNK2019: unresolved external symbol __imp_WSAEventSelect referenced in function "public: void __cdecl SocketReceiveMultiplexer::Implementation::Run(void)" (?Run@Implementation@SocketReceiveMultiplexer@@QEAAXXZ) - demo\bin\win64\libgdosc.dll : fatal error LNK1120: 20 unresolved externals - scons: *** [demo\bin\win64\libgdosc.dll] Error 1120 - scons: building terminated because of errors. - -### 2018/10/25 - -#### done - -* all set methods are using Variant instead of typed arguments -* utils contains methods to check variant easily -* registration of methods and properties for gdnative -* adaptation of godot macros ( see GODOT_SUBCLASS ) -* include and SConstruct adaptations, should be cross-platform - -#### todo - -* enable OSCreceiver signal in OSCreceiver.cpp, line 285 (crash at compilation) -* verify gdnlib & gdns in demo/bin/ -* debug loadong in gdscript -* make OSCsender & OSCreceiver appears in the object selector in godot - -#### gdscript - -`receiver = load("res://bin/OSCreceiver.gdns").new()` - -result: - - ERROR: poll: res://bin/OSCreceiver.gdns:9 - Parse Error: Can't load cached ext-resource #1 - At: scene/resources/scene_format_text.cpp:587. - - ERROR: _load: Failed loading resource: res://bin/OSCreceiver.gdns - At: core/io/resource_loader.cpp:192. - -### 2018/10/25 - -#### done - -* Fix linking oscpack shared object files - -#### pitfall - -* SConstruct is definitely not cross-platform friendly, see comment in-file - -#### Warnings - -When loading the project, I get this in Godot's output window - -``` - drivers/unix/net_socket_posix.cpp:301 - Method/Function Failed, returning: ERR_UNAVAILABLE - modules/gdnative/gdnative.cpp:480 - No valid library handle, can't get symbol from GDNative object - modules/gdnative/gdnative.cpp:386 - No valid library handle, can't terminate GDNative object - Can't open dynamic library: /home/mis/src/gdnative_osc/demo/bin/x11/libgdosc.so. Error: /home/mis/src/gdnative_osc/demo/bin/x11/libgdosc.so: undefined symbol: nativescript_api -``` - -Also, in the console, possibly related to Frankie's *todo* point #4 -``` -ERROR: _load: Failed loading resource: res://bin/OSCreceiver.gdns -``` - -## links - -* https://gamedevadventures.posthaven.com/using-c-plus-plus-and-gdnative-in-godot-part-1 -* https://godotengine.org/qa/17007/possible-to-export-variables-to-editor-when-using-gdnative -* https://www.sisik.eu/blog/godot/gd-native-calling-gdscript-method-from-cpp-code diff --git a/src/oscmsg.cpp b/src/oscmsg.cpp index 21178a75c1e788bd6ffafb022dbdd037f5be394f..3da97f15a83461abc2a640575df2492eb2131572 100644 --- a/src/oscmsg.cpp +++ b/src/oscmsg.cpp @@ -1,13 +1,11 @@ /* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. + * See the LICENSE file at the root directory for license information */ -/* +/* * File: oscmsg.cpp * Author: frankiezafe - * + * * Created on December 10, 2018, 5:52 PM */ @@ -31,10 +29,10 @@ oscmsg::oscmsg() : _buffer_size(1024), _buffer(0), _packet(0), _packet_closed(false) { - + std::cout << this << std::endl; std::cout << this->owner << std::endl; - + } oscmsg::~oscmsg() { @@ -78,7 +76,7 @@ void oscmsg::address(godot::String address) { _packet = new osc::OutboundPacketStream(_buffer, _buffer_size); (*_packet) << osc::BeginBundleImmediate << osc::BeginMessage(std_address.c_str()); - + } void oscmsg::add(godot::Variant var) { @@ -162,16 +160,16 @@ void oscmsg::add(godot::Variant var) { void oscmsg::close() { if (!_packet_closed) { - + (*_packet) << osc::EndMessage << osc::EndBundle; - + _array.resize(0); for ( std::size_t i = 0; i < _buffer_size; ++i ) { _array.push_back( (unsigned char) _packet->Data()[i] ); } - + _packet_closed = true; - + } -} \ No newline at end of file +} diff --git a/src/oscmsg.h b/src/oscmsg.h index b92b4ebf00ebb1da324946e40faabd73fe79bef8..e207d35c8168e788c2ab63c584d6c68792e47805 100644 --- a/src/oscmsg.h +++ b/src/oscmsg.h @@ -1,10 +1,8 @@ /* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. + * See the LICENSE file at the root directory for license information */ -/* +/* * File: oscmsg.h * Author: frankiezafe * @@ -145,4 +143,3 @@ namespace osc { }; #endif /* OSCMSG_H */ - diff --git a/src/oscreceiver.cpp b/src/oscreceiver.cpp index ee2081c3cd6f3b17152aaddad40c3a497e5b66b8..7401395ec6142a906784a1ddd8184adb68a14224 100644 --- a/src/oscreceiver.cpp +++ b/src/oscreceiver.cpp @@ -1,13 +1,11 @@ /* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. + * See the LICENSE file at the root directory for license information */ -/* +/* * File: oscreceiver.cpp * Author: frankiezafe - * + * * Created on December 10, 2018, 5:41 PM */ @@ -222,7 +220,7 @@ void oscreceiver::check_queue() { } void oscreceiver::purge_duplicates() { - + if ( _queue_read->size() < 2 ) { return; } @@ -244,7 +242,7 @@ void oscreceiver::purge_duplicates() { for (; mi != mie; ++mi) { _queue_read->push_back(mi->second); } - + // updating the indices _qread_index = 0; _qread_len = _queue_read->size(); @@ -277,4 +275,4 @@ godot::Dictionary oscreceiver::get_next() { } return _queue_read->at(_qread_index++).data; -} \ No newline at end of file +} diff --git a/src/oscreceiver.h b/src/oscreceiver.h index 2731a618c3a47dca80924010a3d2901b84cdbd5a..5b9dac6ae7a421e0f8a0bf21011c4b9f5ea539f2 100644 --- a/src/oscreceiver.h +++ b/src/oscreceiver.h @@ -1,10 +1,8 @@ /* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. + * See the LICENSE file at the root directory for license information */ -/* +/* * File: oscreceiver.h * Author: frankiezafe * @@ -43,17 +41,17 @@ namespace osc { virtual ~oscreceiver(); void max_queue(int max_queue); - + void avoid_duplicate( bool enabled ); bool setup(unsigned int port); - + bool start(); void stop(); - + bool has_message(); - + godot::Dictionary get_next(); protected: @@ -76,7 +74,7 @@ namespace osc { std::deque* _queue_read; std::size_t _qread_index; std::size_t _qread_len; - + void ProcessMessage( const osc::ReceivedMessage& m, const IpEndpointName& remoteEndpoint); @@ -92,4 +90,3 @@ namespace osc { }; #endif /* OSCRECEIVER_H */ - diff --git a/src/oscsender.cpp b/src/oscsender.cpp index f4f215cbb99888b22bdf0a0f892e6356034936d0..3e51eef846e05c9d7155d8837a73e25511c309a9 100644 --- a/src/oscsender.cpp +++ b/src/oscsender.cpp @@ -1,13 +1,11 @@ /* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. + * See the LICENSE file at the root directory for license information */ -/* +/* * File: oscsender.cpp * Author: frankiezafe - * + * * Created on December 10, 2018, 1:21 PM */ @@ -129,9 +127,9 @@ void oscsender::reset_message() { } void oscsender::msg(godot::String address) { - + reset_message(); - + std::wstring ws = address.unicode_str(); std::string std_address(ws.begin(), ws.end()); @@ -139,7 +137,7 @@ void oscsender::msg(godot::String address) { _packet = new osc::OutboundPacketStream(_buffer, _buffer_size); (*_packet) << osc::BeginBundleImmediate << osc::BeginMessage(std_address.c_str()); - + } void oscsender::add(godot::Variant var) { @@ -234,4 +232,4 @@ void oscsender::send() { } _socket->Send(_packet->Data(), _packet->Size()); -} \ No newline at end of file +} diff --git a/src/oscsender.h b/src/oscsender.h index c347964f1f8f2e14faf481f068204224e7168694..3b94861a25b118a8bf4e45f8f308e7e85ced3d4a 100644 --- a/src/oscsender.h +++ b/src/oscsender.h @@ -1,10 +1,8 @@ /* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. + * See the LICENSE file at the root directory for license information */ -/* +/* * File: oscsender.h * Author: frankiezafe * @@ -29,7 +27,7 @@ namespace osc { static void _register_methods(); oscsender(); - + virtual ~oscsender(); bool setup(godot::String ip, unsigned int port); @@ -37,11 +35,11 @@ namespace osc { bool start(); void stop(); - + void msg( godot::String address ); - + void add( godot::Variant var ); - + void send(); protected: @@ -52,17 +50,16 @@ namespace osc { godot::String _endpoint; bool _ready; bool _running; - + UdpTransmitSocket* _socket; - + char* _buffer; osc::OutboundPacketStream* _packet; bool _packet_closed; - + void reset_message(); }; }; #endif /* OSCSENDER_H */ -