Skip to content

Commit bf5927c

Browse files
committed
add pcm->wav converter
1 parent 5c236a6 commit bf5927c

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

SocketIOClient.uplugin

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"FileVersion": 3,
33
"Version": 1,
4-
"VersionName": "2.7.4",
4+
"VersionName": "2.7.5",
55
"EngineVersion": "5.3",
66
"FriendlyName": "Socket.IO Client",
77
"Description": "Real-time WebSocket networking via Socket.IO protocol usable from blueprints and c++.",

Source/CoreUtility/Private/CUBlueprintLibrary.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,13 @@ TArray<uint8> UCUBlueprintLibrary::Conv_OpusBytesToWav(const TArray<uint8>& InBy
143143
return WavBytes;
144144
}
145145

146+
TArray<uint8> UCUBlueprintLibrary::Conv_PCMToWav(const TArray<uint8>& InPCM, int32 SampleRate, int32 Channels)
147+
{
148+
TArray<uint8> WavBytes;
149+
SerializeWaveFile(WavBytes, InPCM.GetData(), InPCM.Num(), Channels, Channels);
150+
return WavBytes;
151+
}
152+
146153
TArray<uint8> UCUBlueprintLibrary::Conv_WavBytesToOpus(const TArray<uint8>& InBytes)
147154
{
148155
//FCUScopeTimer Timer(TEXT("Conv_WavBytesToOpus"));

Source/CoreUtility/Public/CUBlueprintLibrary.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,13 @@ class COREUTILITY_API UCUBlueprintLibrary : public UBlueprintFunctionLibrary
8282
UFUNCTION(BlueprintPure, meta = (DisplayName = "To Wav Bytes (Opus Bytes)", BlueprintAutocast), Category = "CoreUtility|Conversion")
8383
static TArray<uint8> Conv_OpusBytesToWav(const TArray<uint8>& InBytes);
8484

85+
86+
/**
87+
* Audio conversion - Convert PCM bytes + definition to wav
88+
*/
89+
UFUNCTION(BlueprintPure, meta = (DisplayName = "To Wav Bytes (PCM Bytes)", BlueprintAutocast), Category = "CoreUtility|Conversion")
90+
static TArray<uint8> Conv_PCMToWav(const TArray<uint8>& InPCM, int32 SampleRate, int32 Channels);
91+
8592
/**
8693
* Audio compression - Convert wav to opus (currently raw serialized)
8794
*/

0 commit comments

Comments
 (0)