Skip to content

Commit

Permalink
add pcm->wav converter
Browse files Browse the repository at this point in the history
  • Loading branch information
getnamo committed Jan 29, 2024
1 parent 5c236a6 commit bf5927c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion SocketIOClient.uplugin
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"FileVersion": 3,
"Version": 1,
"VersionName": "2.7.4",
"VersionName": "2.7.5",
"EngineVersion": "5.3",
"FriendlyName": "Socket.IO Client",
"Description": "Real-time WebSocket networking via Socket.IO protocol usable from blueprints and c++.",
Expand Down
7 changes: 7 additions & 0 deletions Source/CoreUtility/Private/CUBlueprintLibrary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,13 @@ TArray<uint8> UCUBlueprintLibrary::Conv_OpusBytesToWav(const TArray<uint8>& InBy
return WavBytes;
}

TArray<uint8> UCUBlueprintLibrary::Conv_PCMToWav(const TArray<uint8>& InPCM, int32 SampleRate, int32 Channels)
{
TArray<uint8> WavBytes;
SerializeWaveFile(WavBytes, InPCM.GetData(), InPCM.Num(), Channels, Channels);
return WavBytes;
}

TArray<uint8> UCUBlueprintLibrary::Conv_WavBytesToOpus(const TArray<uint8>& InBytes)
{
//FCUScopeTimer Timer(TEXT("Conv_WavBytesToOpus"));
Expand Down
7 changes: 7 additions & 0 deletions Source/CoreUtility/Public/CUBlueprintLibrary.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,13 @@ class COREUTILITY_API UCUBlueprintLibrary : public UBlueprintFunctionLibrary
UFUNCTION(BlueprintPure, meta = (DisplayName = "To Wav Bytes (Opus Bytes)", BlueprintAutocast), Category = "CoreUtility|Conversion")
static TArray<uint8> Conv_OpusBytesToWav(const TArray<uint8>& InBytes);


/**
* Audio conversion - Convert PCM bytes + definition to wav
*/
UFUNCTION(BlueprintPure, meta = (DisplayName = "To Wav Bytes (PCM Bytes)", BlueprintAutocast), Category = "CoreUtility|Conversion")
static TArray<uint8> Conv_PCMToWav(const TArray<uint8>& InPCM, int32 SampleRate, int32 Channels);

/**
* Audio compression - Convert wav to opus (currently raw serialized)
*/
Expand Down

0 comments on commit bf5927c

Please sign in to comment.