Skip to content

Commit

Permalink
1.8.15: Updated default channel and sample rate settings
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidLiebemann committed Dec 20, 2024
1 parent b8c728b commit a1db29f
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 17 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": 527,
"Version": 532,
"PlatformAllowList": [ "Win64", "Mac", "IOS", "Linux", "LinuxArm64", "Android"],
"VersionName": "1.8.14",
"VersionName": "1.8.15",
"FriendlyName": "4Players ODIN",
"Description": "Unreal integration plugin to integrate real-time chat technology into your game",
"Category": "Other",
Expand Down
7 changes: 3 additions & 4 deletions Source/Odin/Private/OdinAudioCapture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,10 @@ void UOdinAudioCapture::AsyncGetCaptureDevicesAvailable(FGetCaptureDeviceDelegat
TArray<FOdinCaptureDeviceInfo> Devices;
WeakThisPtr->GetCaptureDevicesAvailable(Devices);

FOdinCaptureDeviceInfo CurrentDevice;
if (WeakThisPtr->CurrentSelectedDeviceIndex >= 0
&& WeakThisPtr->CurrentSelectedDeviceIndex < Devices.Num()) {
FOdinCaptureDeviceInfo CurrentDevice = FOdinCaptureDeviceInfo();
if (Devices.IsValidIndex(WeakThisPtr->CurrentSelectedDeviceIndex)) {
CurrentDevice = Devices[WeakThisPtr->CurrentSelectedDeviceIndex];
} else {
} else if (Devices.Num() > 0) {
CurrentDevice = Devices[0];
}

Expand Down
6 changes: 4 additions & 2 deletions Source/Odin/Private/OdinInitializationSubsystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ void UOdinInitializationSubsystem::Initialize(FSubsystemCollectionBase& Collecti
{
Super::Initialize(Collection);

// default Initialization with 48khz Mono
IsInitialized = odin_startup(ODIN_VERSION);
UE_LOG(Odin, Log, TEXT("Odin initializing with Channel Count %d, Sample Rate %d"), ChannelCount,
SampleRate);
IsInitialized = odin_startup_ex(
ODIN_VERSION, OdinAudioStreamConfig{(uint32_t)SampleRate, (uint8_t)ChannelCount});

if (!IsOdinInitialized()) {
UE_LOG(Odin, Warning, TEXT("Odin startup failed."));
Expand Down
4 changes: 2 additions & 2 deletions Source/Odin/Private/OdinSynthComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

bool UOdinSynthComponent::Init(int32& SampleRate)
{
NumChannels = 1;
SampleRate = 48000;
NumChannels = ODIN_DEFAULT_CHANNEL_COUNT;
SampleRate = ODIN_DEFAULT_SAMPLE_RATE;

if (GetWorld() && GetWorld()->GetGameInstance()) {
const UOdinInitializationSubsystem* OdinInitSubsystem =
Expand Down
2 changes: 2 additions & 0 deletions Source/Odin/Public/Odin.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
DECLARE_LOG_CATEGORY_EXTERN(Odin, Log, All);

#define ODIN_GENERAL_CLIENT_ERROR_CODE (7u << 29)
#define ODIN_DEFAULT_SAMPLE_RATE 48000
#define ODIN_DEFAULT_CHANNEL_COUNT 2

class ODIN_API FOdinModule : public IModuleInterface
{
Expand Down
7 changes: 4 additions & 3 deletions Source/Odin/Public/OdinCaptureMedia.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#pragma once

#include "AudioCapture.h"
#include "Odin.h"
#include "CoreMinimal.h"
#include "OdinMediaBase.h"
#include "odin_sdk.h"
Expand Down Expand Up @@ -101,7 +102,7 @@ class ODIN_API UOdinCaptureMedia : public UOdinMediaBase
*/
UPROPERTY(BlueprintGetter = GetEnableMonoMixing, BlueprintSetter = SetEnableMonoMixing,
Category = "Odin|Audio Capture")
bool bEnableMonoMixing = true;
bool bEnableMonoMixing = false;

/**
* @brief Represents the audio capture object used for capturing microphone data
Expand Down Expand Up @@ -138,8 +139,8 @@ class ODIN_API UOdinCaptureMedia : public UOdinMediaBase

TWeakObjectPtr<UOdinRoom> connected_room_;

int32 stream_sample_rate_ = 48000;
int32 stream_num_channels_ = 1;
int32 stream_sample_rate_ = ODIN_DEFAULT_SAMPLE_RATE;
int32 stream_num_channels_ = ODIN_DEFAULT_CHANNEL_COUNT;

FThreadSafeBool bIsBeingReset = false;

Expand Down
5 changes: 3 additions & 2 deletions Source/Odin/Public/OdinInitializationSubsystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#pragma once

#include "CoreMinimal.h"
#include "Odin.h"
#include "Subsystems/GameInstanceSubsystem.h"
#include "OdinInitializationSubsystem.generated.h"

Expand Down Expand Up @@ -31,7 +32,7 @@ class ODIN_API UOdinInitializationSubsystem : public UGameInstanceSubsystem
bool IsOdinInitialized() const;

private:
int32 SampleRate = 48000;
int32 ChannelCount = 1;
int32 SampleRate = ODIN_DEFAULT_SAMPLE_RATE;
int32 ChannelCount = ODIN_DEFAULT_CHANNEL_COUNT;
bool IsInitialized = false;
};
5 changes: 3 additions & 2 deletions Source/Odin/Public/OdinSubmixListener.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#pragma once

#include "Odin.h"
#include "Runtime/Launch/Resources/Version.h"
#include "odin_sdk.h"
#include "SampleBuffer.h"
Expand Down Expand Up @@ -102,8 +103,8 @@ class ODIN_API FOdinSubmixBufferListenerImplementation
OdinRoomHandle CurrentRoomHandle;
FOnSubmixBufferListenerError ErrorCallback;

int32 OdinSampleRate = 48000;
int32 OdinNumChannels = 1;
int32 OdinSampleRate = ODIN_DEFAULT_SAMPLE_RATE;
int32 OdinNumChannels = ODIN_DEFAULT_CHANNEL_COUNT;

int32 FromSampleRate = 0;
int32 FromNumChannels = 0;
Expand Down

0 comments on commit a1db29f

Please sign in to comment.