mariadeanton / oscpack Goto Github PK
View Code? Open in Web Editor NEWgoogle's Oscpack biicode block - a set of C++ classes for packing and unpacking OSC packets.
License: Other
google's Oscpack biicode block - a set of C++ classes for packing and unpacking OSC packets.
License: Other
I tried to build and use the lib witheout success. Im probably doing something wrong but I don't know what.
I'm on mingw (on win7).
I've tried with the makefile and the batch file...
with the makefile and get this error when launched from mingw64:
g++ -Wall -Wextra -O3 -I. -DOSC_DETECT_ENDIANESS -c -o tests/OscUnitTests.o tests/OscUnitTests.cpp tests/OscUnitTests.cpp: In function 'char* osc::AllocateAligned4(long unsigned int)': tests/OscUnitTests.cpp:109:30: error: cast from 'char*' to 'long int' loses precision [-fpermissive] return (char*)((long)(s-1) & (~0x03L)) + 4; ^ tests/OscUnitTests.cpp:109:42: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] return (char*)((long)(s-1) & (~0x03L)) + 4; ^ make: *** [<commande interne>: tests/OscUnitTests.o] Error 1
This one when run from mingw32:
g++ -Wall -Wextra -O3 -I. -DOSC_DETECT_ENDIANESS -c -o tests/OscUnitTests.o tests/OscUnitTests.cpp g++ -Wall -Wextra -O3 -I. -DOSC_DETECT_ENDIANESS -c -o osc/OscOutboundPacketStream.o osc/OscOutboundPacketStream.cpp g++ -Wall -Wextra -O3 -I. -DOSC_DETECT_ENDIANESS -c -o osc/OscReceivedElements.o osc/OscReceivedElements.cpp osc/OscReceivedElements.cpp: In function 'const char* osc::FindStr4End(const char*, const char*)': osc/OscReceivedElements.cpp:67:5: warning: this 'if' clause does not guard... [-Wmisleading-indentation] if( p >= end ) ^~ osc/OscReceivedElements.cpp:70:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if' if( p[0] == '\0' ) // special case for SuperCollider integer address pattern ^~ g++ -Wall -Wextra -O3 -I. -DOSC_DETECT_ENDIANESS -c -o osc/OscPrintReceivedElements.o osc/OscPrintReceivedElements.cpp g++ -o bin/OscUnitTests osc/OscTypes.o tests/OscUnitTests.o osc/OscOutboundPacketStream.o osc/OscReceivedElements.o osc/OscPrintReceivedElements.o osc/OscTypes.o: file not recognized: File format not recognized collect2.exe: error: ld returned 1 exit status make: *** [Makefile:92: bin/OscUnitTests] Error 1
I tried with the batch file too (make.MinGW32) and get an error telling me that ...\bin\oscUnitTest.exe is not a command, a command file or an executable program but the test and oscdump.exe files are created.
I tried to use the osc and ip files in my sources and to use the receive exemple code in it. Then I get ip and osc file in the same directory then my sources and try to use it for a program called "VCV rack" and my code is this.
`#include "liveControl.hpp"
#include
#include
#if defined(BORLANDC) // workaround for BCB4 release build intrinsics bug
namespace std {
using ::strcmp; // avoid error: E2316 'strcmp' is not a member of 'std'.
}
#endif
#include "osc/OscReceivedElements.h"
#include "osc/OscPacketListener.h"
#include "ip/UdpSocket.h"
#define PORT 7000
class ExamplePacketListener : public osc::OscPacketListener {
protected:
virtual void ProcessMessage( const osc::ReceivedMessage& m,
const IpEndpointName& remoteEndpoint )
{
(void) remoteEndpoint; // suppress unused parameter warning
try{
// example of parsing single messages. osc::OsckPacketListener
// handles the bundle traversal.
if( std::strcmp( m.AddressPattern(), "/test1" ) == 0 ){
// example #1 -- argument stream interface
osc::ReceivedMessageArgumentStream args = m.ArgumentStream();
bool a1;
osc::int32 a2;
float a3;
const char *a4;
args >> a1 >> a2 >> a3 >> a4 >> osc::EndMessage;
std::cout << "received '/test1' message with arguments: "
<< a1 << " " << a2 << " " << a3 << " " << a4 << "\n";
}else if( std::strcmp( m.AddressPattern(), "/test2" ) == 0 ){
// example #2 -- argument iterator interface, supports
// reflection for overloaded messages (eg you can call
// (*arg)->IsBool() to check if a bool was passed etc).
osc::ReceivedMessage::const_iterator arg = m.ArgumentsBegin();
bool a1 = (arg++)->AsBool();
int a2 = (arg++)->AsInt32();
float a3 = (arg++)->AsFloat();
const char *a4 = (arg++)->AsString();
if( arg != m.ArgumentsEnd() )
throw osc::ExcessArgumentException();
std::cout << "received '/test2' message with arguments: "
<< a1 << " " << a2 << " " << a3 << " " << a4 << "\n";
}
}catch( osc::Exception& e ){
// any parsing errors such as unexpected argument types, or
// missing arguments get thrown as exceptions.
std::cout << "error while parsing message: "
<< m.AddressPattern() << ": " << e.what() << "\n";
}
}
};
// The clipping function of a transistor pair is approximately tanh(x)
// TODO: Put this in a lookup table. 5th order approx doesn't seem to cut it
struct controller : Module {
enum ParamIds {
};
enum InputIds {
};
enum OutputIds {
};
controller();
//controller() : Module(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS) {}
void step()override;
};
controller::controller(){
//params.resize(NUM_PARAMS);
//inputs.resize(NUM_INPUTS);
//outputs.resize(NUM_OUTPUTS);
}
void controller::step() {
ExamplePacketListener listener;
UdpListeningReceiveSocket s(
IpEndpointName( IpEndpointName::ANY_ADDRESS, PORT ),
&listener );
//std::cout << "press ctrl-c to end\n";
s.RunUntilSigInt();
}`
and it give me a list of error about undefined references (maybe because I haven't compiled the sources)
C:\msys64\rack\plugins\liveControl/src/ip/UdpSocket.h:159: undefined reference to
UdpSocket::UdpSocket()'
C:\msys64\rack\plugins\liveControl/src/ip/UdpSocket.h:159: undefined reference to SocketReceiveMultiplexer::SocketReceiveMultiplexer()' C:\msys64\rack\plugins\liveControl/src/ip/UdpSocket.h:161: undefined reference to
UdpSocket::Bind(IpEndpointName const&)'
C:\msys64\rack\plugins\liveControl/src/ip/UdpSocket.h:162: undefined reference to SocketReceiveMultiplexer::AttachSocketListener(UdpSocket*, PacketListener*)' build/src/Controller.cpp.o: In function
UdpListeningReceiveSocket::RunUntilSigInt()':
`
Can you help?
Thanks a lot,
Raphaël
If incorporating oscpack
through cmake add_subdirectory
compilation will fail because headers are not found.
This is because the include directory does not reference the current directory, ie CMAKE_CURRENT_SOURCE_DIR
.
Line 26 in 1cb90c3
Also consider using target_include_directories(oscpack PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
to directly export the directory to any including projects without having to care much about include paths therein.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.