mirror of
https://github.com/storytold/UE4-OSC.git
synced 2026-10-09 00:09:43 +00:00
breaking change: OSC arguments are now stored as a standard array
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,31 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include "OscDataElemStruct.h"
|
|
||||||
#include "OscDataStruct.generated.h"
|
|
||||||
|
|
||||||
|
|
||||||
USTRUCT()
|
|
||||||
struct FOscDataStruct
|
|
||||||
{
|
|
||||||
GENERATED_USTRUCT_BODY()
|
|
||||||
|
|
||||||
UPROPERTY()
|
|
||||||
int32 Index;
|
|
||||||
|
|
||||||
UPROPERTY()
|
|
||||||
TArray<FOscDataElemStruct> Queue;
|
|
||||||
|
|
||||||
FOscDataStruct() : Index(0)
|
|
||||||
{ }
|
|
||||||
|
|
||||||
FOscDataElemStruct Pop()
|
|
||||||
{
|
|
||||||
const auto idx = std::max(Index, 0);
|
|
||||||
if(idx < Queue.Num())
|
|
||||||
{
|
|
||||||
++Index;
|
|
||||||
return Queue[idx];
|
|
||||||
}
|
|
||||||
return FOscDataElemStruct();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -10,58 +10,70 @@ UOscFunctionLibrary::UOscFunctionLibrary(const class FPostConstructInitializePro
|
|||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
static inline
|
static inline
|
||||||
void PopValueImpl(const FOscDataStruct & input, FOscDataStruct & output, T & Value)
|
void PopValueImpl(const TArray<FOscDataElemStruct> & input, TArray<FOscDataElemStruct> & output, T & Value)
|
||||||
{
|
{
|
||||||
output = input;
|
if(input.Num() > 0)
|
||||||
Value = output.Pop().GetValue<T>();
|
{
|
||||||
|
output.Reserve(input.Num() - 1);
|
||||||
|
for(int32 i=1, n=input.Num(); i!=n; ++i)
|
||||||
|
{
|
||||||
|
output.Add(input[i]);
|
||||||
|
}
|
||||||
|
Value = input[0].GetValue<T>();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
output.Empty();
|
||||||
|
Value = FOscDataElemStruct().GetValue<T>();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UOscFunctionLibrary::PopBool(const FOscDataStruct & input, FOscDataStruct & output, bool & Value)
|
void UOscFunctionLibrary::PopBool(const TArray<FOscDataElemStruct> & input, TArray<FOscDataElemStruct> & output, bool & Value)
|
||||||
{
|
{
|
||||||
PopValueImpl(input, output, Value);
|
PopValueImpl(input, output, Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UOscFunctionLibrary::PopFloat(const FOscDataStruct & input, FOscDataStruct & output, float & Value)
|
void UOscFunctionLibrary::PopFloat(const TArray<FOscDataElemStruct> & input, TArray<FOscDataElemStruct> & output, float & Value)
|
||||||
{
|
{
|
||||||
PopValueImpl(input, output, Value);
|
PopValueImpl(input, output, Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UOscFunctionLibrary::PopInt(const FOscDataStruct & input, FOscDataStruct & output, int32 & Value)
|
void UOscFunctionLibrary::PopInt(const TArray<FOscDataElemStruct> & input, TArray<FOscDataElemStruct> & output, int32 & Value)
|
||||||
{
|
{
|
||||||
PopValueImpl(input, output, Value);
|
PopValueImpl(input, output, Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UOscFunctionLibrary::PopString(const FOscDataStruct & input, FOscDataStruct & output, FName & Value)
|
void UOscFunctionLibrary::PopString(const TArray<FOscDataElemStruct> & input, TArray<FOscDataElemStruct> & output, FName & Value)
|
||||||
{
|
{
|
||||||
PopValueImpl(input, output, Value);
|
PopValueImpl(input, output, Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void UOscFunctionLibrary::PushBool(FOscDataStruct input, bool Value, FOscDataStruct & output)
|
void UOscFunctionLibrary::PushBool(const TArray<FOscDataElemStruct> & input, bool Value, TArray<FOscDataElemStruct> & output)
|
||||||
{
|
{
|
||||||
output = input;
|
output = input;
|
||||||
FOscDataElemStruct elem;
|
FOscDataElemStruct elem;
|
||||||
elem.SetBool(Value);
|
elem.SetBool(Value);
|
||||||
output.Queue.Add(elem);
|
output.Add(elem);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UOscFunctionLibrary::PushFloat(FOscDataStruct input, float Value, FOscDataStruct & output)
|
void UOscFunctionLibrary::PushFloat(const TArray<FOscDataElemStruct> & input, float Value, TArray<FOscDataElemStruct> & output)
|
||||||
{
|
{
|
||||||
output = input;
|
output = input;
|
||||||
FOscDataElemStruct elem;
|
FOscDataElemStruct elem;
|
||||||
elem.SetFloat(Value);
|
elem.SetFloat(Value);
|
||||||
output.Queue.Add(elem);
|
output.Add(elem);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UOscFunctionLibrary::PushInt(FOscDataStruct input, int32 Value, FOscDataStruct & output)
|
void UOscFunctionLibrary::PushInt(const TArray<FOscDataElemStruct> & input, int32 Value, TArray<FOscDataElemStruct> & output)
|
||||||
{
|
{
|
||||||
output = input;
|
output = input;
|
||||||
FOscDataElemStruct elem;
|
FOscDataElemStruct elem;
|
||||||
elem.SetInt(Value);
|
elem.SetInt(Value);
|
||||||
output.Queue.Add(elem);
|
output.Add(elem);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UOscFunctionLibrary::PushString(FOscDataStruct input, FName Value, FOscDataStruct & output)
|
void UOscFunctionLibrary::PushString(const TArray<FOscDataElemStruct> & input, FName Value, TArray<FOscDataElemStruct> & output)
|
||||||
{
|
{
|
||||||
if(Value.GetDisplayNameEntry()->IsWide())
|
if(Value.GetDisplayNameEntry()->IsWide())
|
||||||
{
|
{
|
||||||
@@ -73,10 +85,61 @@ void UOscFunctionLibrary::PushString(FOscDataStruct input, FName Value, FOscData
|
|||||||
output = input;
|
output = input;
|
||||||
FOscDataElemStruct elem;
|
FOscDataElemStruct elem;
|
||||||
elem.SetString(Value);
|
elem.SetString(Value);
|
||||||
output.Queue.Add(elem);
|
output.Add(elem);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UOscFunctionLibrary::SendOsc(FName Address, const FOscDataStruct & Data, int32 TargetIndex)
|
|
||||||
|
bool UOscFunctionLibrary::AsBool(const FOscDataElemStruct & input)
|
||||||
|
{
|
||||||
|
return input.GetValue<bool>();
|
||||||
|
}
|
||||||
|
|
||||||
|
float UOscFunctionLibrary::AsFloat(const FOscDataElemStruct & input)
|
||||||
|
{
|
||||||
|
return input.GetValue<float>();
|
||||||
|
}
|
||||||
|
|
||||||
|
int32 UOscFunctionLibrary::AsInt(const FOscDataElemStruct & input)
|
||||||
|
{
|
||||||
|
return input.GetValue<int32>();
|
||||||
|
}
|
||||||
|
|
||||||
|
FName UOscFunctionLibrary::AsString(const FOscDataElemStruct & input)
|
||||||
|
{
|
||||||
|
return input.GetValue<FName>();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
FOscDataElemStruct UOscFunctionLibrary::FromBool(bool input)
|
||||||
|
{
|
||||||
|
FOscDataElemStruct result;
|
||||||
|
result.SetBool(input);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
FOscDataElemStruct UOscFunctionLibrary::FromFloat(float input)
|
||||||
|
{
|
||||||
|
FOscDataElemStruct result;
|
||||||
|
result.SetFloat(input);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
FOscDataElemStruct UOscFunctionLibrary::FromInt(int32 input)
|
||||||
|
{
|
||||||
|
FOscDataElemStruct result;
|
||||||
|
result.SetInt(input);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
FOscDataElemStruct UOscFunctionLibrary::FromString(FName input)
|
||||||
|
{
|
||||||
|
FOscDataElemStruct result;
|
||||||
|
result.SetString(input);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void UOscFunctionLibrary::SendOsc(FName Address, const TArray<FOscDataElemStruct> & Data, int32 TargetIndex)
|
||||||
{
|
{
|
||||||
if(Address.GetDisplayNameEntry()->IsWide())
|
if(Address.GetDisplayNameEntry()->IsWide())
|
||||||
{
|
{
|
||||||
@@ -90,9 +153,8 @@ void UOscFunctionLibrary::SendOsc(FName Address, const FOscDataStruct & Data, in
|
|||||||
|
|
||||||
osc::OutboundPacketStream output((char *)buffer, sizeof(buffer));
|
osc::OutboundPacketStream output((char *)buffer, sizeof(buffer));
|
||||||
output << osc::BeginMessage(Address.GetPlainANSIString());
|
output << osc::BeginMessage(Address.GetPlainANSIString());
|
||||||
for(int32 i=Data.Index, n=Data.Queue.Num(); i<n; ++i)
|
for(const auto & elem : Data)
|
||||||
{
|
{
|
||||||
const auto & elem = Data.Queue[i];
|
|
||||||
if(elem.IsFloat())
|
if(elem.IsFloat())
|
||||||
{
|
{
|
||||||
output << (float)elem.AsFloatValue();
|
output << (float)elem.AsFloatValue();
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "OscDataStruct.h"
|
#include "OscDataElemStruct.h"
|
||||||
#include "OscFunctionLibrary.generated.h"
|
#include "OscFunctionLibrary.generated.h"
|
||||||
|
|
||||||
|
|
||||||
@@ -11,36 +11,70 @@ class UOscFunctionLibrary : public UBlueprintFunctionLibrary
|
|||||||
|
|
||||||
/// Get the next value from an OSC message as a boolean.
|
/// Get the next value from an OSC message as a boolean.
|
||||||
UFUNCTION(BlueprintPure, Category=OSC)
|
UFUNCTION(BlueprintPure, Category=OSC)
|
||||||
static void PopBool(const FOscDataStruct & input, FOscDataStruct & output, bool & Value);
|
static void PopBool(const TArray<FOscDataElemStruct> & input, TArray<FOscDataElemStruct> & output, bool & Value);
|
||||||
|
|
||||||
/// Get the next value from an OSC message as a floating point.
|
/// Get the next value from an OSC message as a floating point.
|
||||||
UFUNCTION(BlueprintPure, Category=OSC)
|
UFUNCTION(BlueprintPure, Category=OSC)
|
||||||
static void PopFloat(const FOscDataStruct & input, FOscDataStruct & output, float & Value);
|
static void PopFloat(const TArray<FOscDataElemStruct> & input, TArray<FOscDataElemStruct> & output, float & Value);
|
||||||
|
|
||||||
/// Get the next value from an OSC message as a integer.
|
/// Get the next value from an OSC message as a integer.
|
||||||
UFUNCTION(BlueprintPure, Category=OSC)
|
UFUNCTION(BlueprintPure, Category=OSC)
|
||||||
static void PopInt(const FOscDataStruct & input, FOscDataStruct & output, int32 & Value);
|
static void PopInt(const TArray<FOscDataElemStruct> & input, TArray<FOscDataElemStruct> & output, int32 & Value);
|
||||||
|
|
||||||
/// Get the next value from an OSC message as a string.
|
/// Get the next value from an OSC message as a string.
|
||||||
UFUNCTION(BlueprintPure, Category=OSC)
|
UFUNCTION(BlueprintPure, Category=OSC)
|
||||||
static void PopString(const FOscDataStruct & input, FOscDataStruct & output, FName & Value);
|
static void PopString(const TArray<FOscDataElemStruct> & input, TArray<FOscDataElemStruct> & output, FName & Value);
|
||||||
|
|
||||||
|
|
||||||
/// Add a boolean value to an OSC message.
|
/// Add a boolean value to an OSC message.
|
||||||
UFUNCTION(BlueprintPure, Category=OSC)
|
UFUNCTION(BlueprintPure, Category=OSC, meta=(AutoCreateRefTerm = "input"))
|
||||||
static void PushBool(FOscDataStruct input, bool Value, FOscDataStruct & output);
|
static void PushBool(const TArray<FOscDataElemStruct> & input, bool Value, TArray<FOscDataElemStruct> & output);
|
||||||
|
|
||||||
/// Add a floating point value to an OSC message.
|
/// Add a floating point value to an OSC message.
|
||||||
UFUNCTION(BlueprintPure, Category=OSC)
|
UFUNCTION(BlueprintPure, Category=OSC, meta=(AutoCreateRefTerm = "input"))
|
||||||
static void PushFloat(FOscDataStruct input, float Value, FOscDataStruct & output);
|
static void PushFloat(const TArray<FOscDataElemStruct> & input, float Value, TArray<FOscDataElemStruct> & output);
|
||||||
|
|
||||||
/// Add a integer value to an OSC message.
|
/// Add a integer value to an OSC message.
|
||||||
UFUNCTION(BlueprintPure, Category=OSC)
|
UFUNCTION(BlueprintPure, Category=OSC, meta=(AutoCreateRefTerm = "input"))
|
||||||
static void PushInt(FOscDataStruct input, int32 Value, FOscDataStruct & output);
|
static void PushInt(const TArray<FOscDataElemStruct> & input, int32 Value, TArray<FOscDataElemStruct> & output);
|
||||||
|
|
||||||
/// Add a string value to an OSC message.
|
/// Add a string value to an OSC message.
|
||||||
|
UFUNCTION(BlueprintPure, Category=OSC, meta=(AutoCreateRefTerm = "input"))
|
||||||
|
static void PushString(const TArray<FOscDataElemStruct> & input, FName Value, TArray<FOscDataElemStruct> & output);
|
||||||
|
|
||||||
|
|
||||||
|
/// Interpret an OSC argument as a boolean
|
||||||
UFUNCTION(BlueprintPure, Category=OSC)
|
UFUNCTION(BlueprintPure, Category=OSC)
|
||||||
static void PushString(FOscDataStruct input, FName Value, FOscDataStruct & output);
|
static bool AsBool(const FOscDataElemStruct & input);
|
||||||
|
|
||||||
|
/// Interpret an OSC argument as a floating point.
|
||||||
|
UFUNCTION(BlueprintPure, Category=OSC)
|
||||||
|
static float AsFloat(const FOscDataElemStruct & input);
|
||||||
|
|
||||||
|
/// Interpret an OSC argument as a integer.
|
||||||
|
UFUNCTION(BlueprintPure, Category=OSC)
|
||||||
|
static int32 AsInt(const FOscDataElemStruct & input);
|
||||||
|
|
||||||
|
/// Interpret an OSC argument as a string.
|
||||||
|
UFUNCTION(BlueprintPure, Category=OSC)
|
||||||
|
static FName AsString(const FOscDataElemStruct & input);
|
||||||
|
|
||||||
|
|
||||||
|
/// Create an OSC argument from a boolean
|
||||||
|
UFUNCTION(BlueprintPure, Category=OSC)
|
||||||
|
static FOscDataElemStruct FromBool(bool input);
|
||||||
|
|
||||||
|
/// Create an OSC argument from a floating point.
|
||||||
|
UFUNCTION(BlueprintPure, Category=OSC)
|
||||||
|
static FOscDataElemStruct FromFloat(float input);
|
||||||
|
|
||||||
|
/// Create an OSC argument from a integer.
|
||||||
|
UFUNCTION(BlueprintPure, Category=OSC)
|
||||||
|
static FOscDataElemStruct FromInt(int32 input);
|
||||||
|
|
||||||
|
/// Create an OSC argument from a string.
|
||||||
|
UFUNCTION(BlueprintPure, Category=OSC)
|
||||||
|
static FOscDataElemStruct FromString(FName input);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -49,6 +83,6 @@ class UOscFunctionLibrary : public UBlueprintFunctionLibrary
|
|||||||
* @param Data result of successive PushFloat/Int/String/etc.
|
* @param Data result of successive PushFloat/Int/String/etc.
|
||||||
* @param Index index of the destination, -1 for all destinations. (SendTarget list of the plugin settings)
|
* @param Index index of the destination, -1 for all destinations. (SendTarget list of the plugin settings)
|
||||||
*/
|
*/
|
||||||
UFUNCTION(BlueprintCallable, Category=OSC)
|
UFUNCTION(BlueprintCallable, Category=OSC, meta=(AutoCreateRefTerm = "Data"))
|
||||||
static void SendOsc(FName Address, const FOscDataStruct & Data, int32 TargetIndex);
|
static void SendOsc(FName Address, const TArray<FOscDataElemStruct> & Data, int32 TargetIndex);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -78,11 +78,11 @@ void UOscDispatcher::UnregisterReceiver(IOscReceiverInterface * receiver)
|
|||||||
_receivers.Remove(receiver);
|
_receivers.Remove(receiver);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SendMessage(TCircularQueue<std::pair<FName, FOscDataStruct>> & _pendingMessages, const osc::ReceivedMessage & message)
|
static void SendMessage(TCircularQueue<std::pair<FName, TArray<FOscDataElemStruct>>> & _pendingMessages, const osc::ReceivedMessage & message)
|
||||||
{
|
{
|
||||||
const FName address(message.AddressPattern());
|
const FName address(message.AddressPattern());
|
||||||
|
|
||||||
FOscDataStruct data;
|
TArray<FOscDataElemStruct> data;
|
||||||
|
|
||||||
const auto argBegin = message.ArgumentsBegin();
|
const auto argBegin = message.ArgumentsBegin();
|
||||||
const auto argEnd = message.ArgumentsEnd();
|
const auto argEnd = message.ArgumentsEnd();
|
||||||
@@ -113,14 +113,14 @@ static void SendMessage(TCircularQueue<std::pair<FName, FOscDataStruct>> & _pend
|
|||||||
{
|
{
|
||||||
elem.SetString(FName(it->AsStringUnchecked()));
|
elem.SetString(FName(it->AsStringUnchecked()));
|
||||||
}
|
}
|
||||||
data.Queue.Add(elem);
|
data.Add(elem);
|
||||||
}
|
}
|
||||||
|
|
||||||
// save it in pending messages
|
// save it in pending messages
|
||||||
_pendingMessages.Enqueue(std::make_pair(address, data));
|
_pendingMessages.Enqueue(std::make_pair(address, data));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SendBundle(TCircularQueue<std::pair<FName, FOscDataStruct>> & _pendingMessages, const osc::ReceivedBundle & bundle)
|
static void SendBundle(TCircularQueue<std::pair<FName, TArray<FOscDataElemStruct>>> & _pendingMessages, const osc::ReceivedBundle & bundle)
|
||||||
{
|
{
|
||||||
const auto begin = bundle.ElementsBegin();
|
const auto begin = bundle.ElementsBegin();
|
||||||
const auto end = bundle.ElementsEnd();
|
const auto end = bundle.ElementsEnd();
|
||||||
@@ -166,7 +166,7 @@ void UOscDispatcher::Callback(const FArrayReaderPtr& data, const FIPv4Endpoint&)
|
|||||||
|
|
||||||
void UOscDispatcher::CallbackMainThread()
|
void UOscDispatcher::CallbackMainThread()
|
||||||
{
|
{
|
||||||
std::pair<FName, FOscDataStruct> message;
|
std::pair<FName, TArray<FOscDataElemStruct>> message;
|
||||||
while(_pendingMessages.Dequeue(message))
|
while(_pendingMessages.Dequeue(message))
|
||||||
{
|
{
|
||||||
for(auto receiver : _receivers)
|
for(auto receiver : _receivers)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "OscDataStruct.h"
|
#include "OscDataElemStruct.h"
|
||||||
#include "OscDispatcher.generated.h"
|
#include "OscDispatcher.generated.h"
|
||||||
|
|
||||||
class IOscReceiverInterface;
|
class IOscReceiverInterface;
|
||||||
@@ -44,5 +44,5 @@ private:
|
|||||||
std::pair<FIPv4Address, uint32_t> _listening;
|
std::pair<FIPv4Address, uint32_t> _listening;
|
||||||
FSocket * _socket;
|
FSocket * _socket;
|
||||||
FUdpSocketReceiver * _socketReceiver;
|
FUdpSocketReceiver * _socketReceiver;
|
||||||
TCircularQueue<std::pair<FName, FOscDataStruct>> _pendingMessages;
|
TCircularQueue<std::pair<FName, TArray<FOscDataElemStruct>>> _pendingMessages;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include "GameFramework/Actor.h"
|
#include "GameFramework/Actor.h"
|
||||||
#include "OscReceiverInterface.h"
|
#include "OscReceiverInterface.h"
|
||||||
#include "OscDataStruct.h"
|
#include "OscDataElemStruct.h"
|
||||||
#include "OscReceiverActor.generated.h"
|
#include "OscReceiverActor.generated.h"
|
||||||
|
|
||||||
|
|
||||||
@@ -15,7 +15,7 @@ class AOscReceiverActor : public AActor, public IOscReceiverInterface
|
|||||||
FString AddressFilter;
|
FString AddressFilter;
|
||||||
|
|
||||||
UFUNCTION(BlueprintImplementableEvent, Category=OSC)
|
UFUNCTION(BlueprintImplementableEvent, Category=OSC)
|
||||||
void OnOscReceived(const FName & Address, const FOscDataStruct & Data);
|
void OnOscReceived(const FName & Address, const TArray<FOscDataElemStruct> & Data);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
@@ -26,7 +26,7 @@ protected:
|
|||||||
return AddressFilter;
|
return AddressFilter;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void SendEvent(const FName & Address, const FOscDataStruct & Data) override
|
virtual void SendEvent(const FName & Address, const TArray<FOscDataElemStruct> & Data) override
|
||||||
{
|
{
|
||||||
OnOscReceived(Address, Data);
|
OnOscReceived(Address, Data);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,12 +2,12 @@
|
|||||||
|
|
||||||
#include "Components/ActorComponent.h"
|
#include "Components/ActorComponent.h"
|
||||||
#include "OscReceiverInterface.h"
|
#include "OscReceiverInterface.h"
|
||||||
#include "OscDataStruct.h"
|
#include "OscDataElemStruct.h"
|
||||||
#include "OscReceiverComponent.generated.h"
|
#include "OscReceiverComponent.generated.h"
|
||||||
|
|
||||||
|
|
||||||
// declare the OnOscReceived event type
|
// declare the OnOscReceived event type
|
||||||
DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FComponentOscReceivedSignature, const FName &, Address, const FOscDataStruct &, Data);
|
DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FComponentOscReceivedSignature, const FName &, Address, const TArray<FOscDataElemStruct> &, Data);
|
||||||
|
|
||||||
|
|
||||||
UCLASS(meta = (BlueprintSpawnableComponent))
|
UCLASS(meta = (BlueprintSpawnableComponent))
|
||||||
@@ -31,7 +31,7 @@ protected:
|
|||||||
return AddressFilter;
|
return AddressFilter;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void SendEvent(const FName & Address, const FOscDataStruct & Data) override
|
virtual void SendEvent(const FName & Address, const TArray<FOscDataElemStruct> & Data) override
|
||||||
{
|
{
|
||||||
OnOscReceived.Broadcast(Address, Data);
|
OnOscReceived.Broadcast(Address, Data);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,5 +14,5 @@ const FString & IOscReceiverInterface::GetAddressFilter()
|
|||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
void IOscReceiverInterface::SendEvent(const FName & Address, const FOscDataStruct & Data)
|
void IOscReceiverInterface::SendEvent(const FName & Address, const TArray<FOscDataElemStruct> & Data)
|
||||||
{ }
|
{ }
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "OscDataStruct.h"
|
#include "OscDataElemStruct.h"
|
||||||
#include "OscReceiverInterface.generated.h"
|
#include "OscReceiverInterface.generated.h"
|
||||||
|
|
||||||
|
|
||||||
@@ -15,5 +15,5 @@ class IOscReceiverInterface
|
|||||||
GENERATED_IINTERFACE_BODY()
|
GENERATED_IINTERFACE_BODY()
|
||||||
|
|
||||||
virtual const FString & GetAddressFilter();
|
virtual const FString & GetAddressFilter();
|
||||||
virtual void SendEvent(const FName & Address, const FOscDataStruct & Data);
|
virtual void SendEvent(const FName & Address, const TArray<FOscDataElemStruct> & Data);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -23,14 +23,14 @@ Add a OscReceiverComponent to your Blueprint class and bind the OnOscReceived cu
|
|||||||
|
|
||||||
Subclass the OscReceiverActor and bind the OnOscReceived custom event.
|
Subclass the OscReceiverActor and bind the OnOscReceived custom event.
|
||||||
|
|
||||||
Use the PopFloat/Int/Bool/String functions to retrieve the OSC message parameters.
|
Use the PopFloat/Int/Bool/String functions, or standard array functions, to retrieve the OSC message parameters.
|
||||||
|
|
||||||
|
|
||||||
- Sender:
|
- Sender:
|
||||||
|
|
||||||
Set the "send to" addresses in the plugin settings.
|
Set the "send to" addresses in the plugin settings.
|
||||||
|
|
||||||
Use the PushFloat/Int/Bool/String functions to build the OSC message parameters.
|
Use the PushFloat/Int/Bool/String functions, or standard array functions, to build the OSC message parameters.
|
||||||
|
|
||||||
Use the SendOsc function to send the OSC message
|
Use the SendOsc function to send the OSC message
|
||||||
|
|
||||||
|
|||||||
@@ -1,2 +1,3 @@
|
|||||||
|
0.3: [breaking] parameters are stored as a standard array, allowing use of blueprint array functions, as well a Push/Pop functions
|
||||||
0.2: add receiver actor class
|
0.2: add receiver actor class
|
||||||
0.1: receiver component, send function, float integer boolean and string parameters
|
0.1: receiver component, send function, float integer boolean and string parameters
|
||||||
|
|||||||
Reference in New Issue
Block a user