Beispiel #1
0
std::vector<char> write_osc_event(const core::monitor::message& e)
{
	std::array<char, 4096> buffer;
	::osc::OutboundPacketStream o(buffer.data(), static_cast<unsigned long>(buffer.size()));

	o	<< ::osc::BeginMessage(e.path().c_str());
				
	param_visitor<decltype(o)> pd_visitor(o);
	BOOST_FOREACH(auto data, e.data())
		boost::apply_visitor(pd_visitor, data);
				
	o	<< ::osc::EndMessage;
		
	return std::vector<char>(o.Data(), o.Data() + o.Size());
}
void write_osc_event(byte_vector& destination, const core::monitor::message& e)
{		
	destination.resize(4096);

	::osc::OutboundPacketStream o(reinterpret_cast<char*>(destination.data()), static_cast<unsigned long>(destination.size()));
	o << ::osc::BeginMessage(e.path().c_str());
				
	param_visitor<decltype(o)> param_visitor(o);
	BOOST_FOREACH(const auto& data, e.data())
		boost::apply_visitor(param_visitor, data);
				
	o << ::osc::EndMessage;
		
	destination.resize(o.Size());
}