Skip to content
Snippets Groups Projects
Commit b5e9b248 authored by Jonathan Ehret's avatar Jonathan Ehret
Browse files

improve getplayaction documentation and API and remove debug logging

parent eacf1a87
Branches
No related tags found
1 merge request!9VAServerLauncher Improvement (now also sending reproduction type and ini)
...@@ -146,8 +146,6 @@ bool UVAAudiofileSignalSource::SetPlayAction(const int Action) ...@@ -146,8 +146,6 @@ bool UVAAudiofileSignalSource::SetPlayAction(const int Action)
InterallyStoredPlayAction = Action; InterallyStoredPlayAction = Action;
StorePlayStateInternallyEvent.Send(Action); //also send this to all slaves, so potentially still pending send numbers from GetPlayAction are overwritten StorePlayStateInternallyEvent.Send(Action); //also send this to all slaves, so potentially still pending send numbers from GetPlayAction are overwritten
FVAUtils::LogStuff("set play action to " + FString::FromInt(InterallyStoredPlayAction) + " (and stored internally)");
if (!UVirtualRealityUtilities::IsMaster()) if (!UVirtualRealityUtilities::IsMaster())
{ {
return false; return false;
...@@ -172,12 +170,12 @@ bool UVAAudiofileSignalSource::GetLoop() const ...@@ -172,12 +170,12 @@ bool UVAAudiofileSignalSource::GetLoop() const
return bLoop; return bLoop;
} }
EPlayAction::Type UVAAudiofileSignalSource::GetPlayActionEnum() EPlayAction::Type UVAAudiofileSignalSource::GetPlayActionEnum(bool bDirectOnMaster /*= false*/)
{ {
return EPlayAction::Type(GetPlayAction()); return EPlayAction::Type(GetPlayAction(bDirectOnMaster));
} }
int UVAAudiofileSignalSource::GetPlayAction() int UVAAudiofileSignalSource::GetPlayAction(bool bDirectOnMaster /*= false*/)
{ {
//we return the internally stored action in case this is in cluster and not the master //we return the internally stored action in case this is in cluster and not the master
//but also update the internally stored data by the one which the master can get from the VAServer //but also update the internally stored data by the one which the master can get from the VAServer
...@@ -188,10 +186,11 @@ int UVAAudiofileSignalSource::GetPlayAction() ...@@ -188,10 +186,11 @@ int UVAAudiofileSignalSource::GetPlayAction()
// otherwise (in cluster mode) this emits acluster event, so the internal data will be updated before next Tick // otherwise (in cluster mode) this emits acluster event, so the internal data will be updated before next Tick
int VAServerPlayAction = FVAPlugin::GetSignalSourceBufferPlayAction(ID); int VAServerPlayAction = FVAPlugin::GetSignalSourceBufferPlayAction(ID);
StorePlayStateInternallyEvent.Send(VAServerPlayAction); StorePlayStateInternallyEvent.Send(VAServerPlayAction);
FVAUtils::LogStuff("send " + FString::FromInt(VAServerPlayAction)+ " as cluster event"); if(bDirectOnMaster)
{
return VAServerPlayAction;
}
} }
FVAUtils::LogStuff("returned stored play action " + FString::FromInt(InterallyStoredPlayAction));
return InterallyStoredPlayAction; return InterallyStoredPlayAction;
} }
...@@ -222,6 +221,5 @@ bool UVAAudiofileSignalSource::CopySignalSourceSettings(const std::string& Other ...@@ -222,6 +221,5 @@ bool UVAAudiofileSignalSource::CopySignalSourceSettings(const std::string& Other
void UVAAudiofileSignalSource::StorePlayStateInternally(int PlayAction) void UVAAudiofileSignalSource::StorePlayStateInternally(int PlayAction)
{ {
FVAUtils::LogStuff("set " + FString::FromInt(PlayAction) + " from cluster event");
InterallyStoredPlayAction = PlayAction; InterallyStoredPlayAction = PlayAction;
} }
...@@ -62,8 +62,6 @@ public: ...@@ -62,8 +62,6 @@ public:
bool SetLoop(bool bLoopN); bool SetLoop(bool bLoopN);
UFUNCTION(BlueprintCallable) UFUNCTION(BlueprintCallable)
bool SetPlayBackPosition(float Time); bool SetPlayBackPosition(float Time);
UFUNCTION(BlueprintCallable)
bool SetPlayAction(int Action);
// *** Getter *** // // *** Getter *** //
...@@ -73,12 +71,15 @@ public: ...@@ -73,12 +71,15 @@ public:
UFUNCTION(BlueprintCallable) UFUNCTION(BlueprintCallable)
bool GetLoop() const; bool GetLoop() const;
//CAUTION when used in cluster mode (e.g., CAVE):
// GetPlayActionEnum() might be one tick behind in cluster mode, since the current play action is only synced between master and slaves after this is called // GetPlayActionEnum() might be one tick behind in cluster mode, since the current play action is only synced between master and slaves after this is called
//so make sue to, e.g., call this every frame or at least multiple times (if you, e.g., want to observe a change from play to pause) // so make sure to, e.g., call this every frame or at least multiple times (if you, e.g., want to observe a change from play to pause)
// Alternatively, you can also set the bDirectOnMaster flag to get the status directly from the master, in that case you should make sure
// that everything is synced to the slaves, e.g., using sync components, as data will be delayed on the slaves!!!
UFUNCTION(BlueprintCallable) UFUNCTION(BlueprintCallable)
EPlayAction::Type GetPlayActionEnum(); EPlayAction::Type GetPlayActionEnum(bool bDirectOnMaster = false);
int GetPlayAction();
// *** Events/Delegates *** // // *** Events/Delegates *** //
...@@ -111,6 +112,9 @@ protected: ...@@ -111,6 +112,9 @@ protected:
private: private:
bool SetPlayAction(int Action);
int GetPlayAction(bool bDirectOnMaster=false);
void StorePlayStateInternally(int PlayAction); void StorePlayStateInternally(int PlayAction);
DECLARE_DISPLAY_CLUSTER_EVENT(UVAAudiofileSignalSource, StorePlayStateInternally); DECLARE_DISPLAY_CLUSTER_EVENT(UVAAudiofileSignalSource, StorePlayStateInternally);
int InterallyStoredPlayAction = -1; int InterallyStoredPlayAction = -1;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment