Skip to content

Commit

Permalink
Fixed an issue with byte array decoding in ue 4.27
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidLiebemann committed Aug 13, 2024
1 parent 79c03ea commit 229b8ef
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Odin.uplugin
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"FileVersion": 2,
"Version": 437,
"Version": 447,
"WhitelistPlatforms": [ "Win64", "Mac", "IOS", "Linux", "LinuxArm64", "Android" ],
"VersionName": "1.8.10",
"VersionName": "1.8.11",
"FriendlyName": "4Players ODIN",
"Description": "Unreal integration plugin to integrate real-time chat technology into your game",
"Category": "Other",
Expand Down
8 changes: 7 additions & 1 deletion Source/Odin/Private/OdinFunctionLibrary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,13 @@ FString UOdinFunctionLibrary::BytesToString(const TArray<uint8>& data)
const UTF8CHAR* UTF8Char = reinterpret_cast<const UTF8CHAR*>(data.GetData());
return FString(data.Num(), UTF8Char);
#else
return UTF8_TO_TCHAR(data.GetData());
// ensure null terminated string is being returned
if (data.Num() > 0 && data[data.Num() - 1] != TEXT('\0')) {
TArray<uint8> NullTerminatedArray = data;
NullTerminatedArray.Add(TEXT('\0'));
return UTF8_TO_TCHAR(NullTerminatedArray.GetData());
}
return FString(data.Num(), UTF8_TO_TCHAR(data.GetData()));
#endif
}

Expand Down
5 changes: 5 additions & 0 deletions Source/Odin/Private/OdinSynthComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,11 @@ void UOdinSynthComponent::AdjustAttenuation(const FSoundAttenuationSettings &InA
Activate(true);
}

UOdinPlaybackMedia *UOdinSynthComponent::GetConnectedPlaybackMedia() const
{
return playback_media_;
}

void UOdinSynthComponent::AddAudioBufferListener(IAudioBufferListener *InAudioBufferListener)
{
AudioBufferListeners.AddUnique(InAudioBufferListener);
Expand Down
7 changes: 7 additions & 0 deletions Source/Odin/Public/OdinSynthComponent.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,13 @@ class ODIN_API UOdinSynthComponent : public USynthComponent
UFUNCTION(BlueprintCallable, Category = "Odin|Sound")
void AdjustAttenuation(const FSoundAttenuationSettings &InAttenuationSettings);

/**
* Retrieves the playback media stream pointer that was assigned to this synth component.
* @return A pointer to the playback media stream that is used to playback audio.
*/
UFUNCTION(BlueprintCallable, BlueprintPure, Category = "Odin")
UOdinPlaybackMedia *GetConnectedPlaybackMedia() const;

// We want to hide the non-virtual function in USynthComponent here!
void AddAudioBufferListener(IAudioBufferListener *InAudioBufferListener);
// We want to hide the non-virtual function in USynthComponent here!
Expand Down

0 comments on commit 229b8ef

Please sign in to comment.