Skip to main content
Version: 2.x

UOdinAudioCapture

Declaration
UCLASS(ClassGroup = (Odin), Blueprintable, BlueprintType)
class ODIN_API UOdinAudioCapture : public UAudioCapture, public FTickableGameObject
  • Header: #include "OdinAudio/OdinAudioCapture.h"
  • Module: Odin
  • Inherits from: UAudioCapture, FTickableGameObject
  • Blueprint: Blueprint type, Blueprintable · Blueprint reference

Overview​

Functions​

NameDescription
GetCaptureDevicesAvailableReturns all available capture devices with the device id.
GetCurrentAudioCaptureDeviceReturns info on the current capture device.
ChangeToDefaultCaptureDeviceChanges the current capture device to the system default and restarts the capture stream.
ChangeCaptureDeviceByIdUpdates the capture device and restarts the capture stream of the Audio Capture object.
StartCapturingStarts Capturing Audio and returns whether capturing was started successfully.
ChangeCaptureDeviceByNameUpdates the capture device and restarts the capture stream of the Audio Capture object.
IsStreamOpenGet whether the stream is currently open.
GetStreamTimeGet the stream time of the audio capture stream.
RestartCapturingRestart the stream, using CurrentSelectedDeviceIndex as the new capture device.
GetTryRecognizingDeviceDisconnectedWhether capture device disconnect is being recognized automatically.
SetTryRecognizingDeviceDisconnectedSets automatic recognition of capture device disconnects (i.e.

Events​

NameDescription
OnCaptureDeviceResetWill be called, if ODIN recognizes that the selected capture device does not supply data anymore, i.e.
OnDefaultDeviceChangedWill be called, if the Default Device is the currently selected and if the Default Device was switched by the system.
OnCaptureDeviceChangedRaised after the capture device changed, e.g.

Functions​

GetCaptureDevicesAvailable​

Blueprint: Get Capture Devices Available

Returns all available capture devices with the device id. Only usable in GameThread.

IMPORTANT! Should not be used in tick or on a regular basis because it could lead to stuttering.

UFUNCTION(BlueprintPure, Category = "Odin|Audio Capture")
void GetCaptureDevicesAvailable(TArray<FOdinCaptureDeviceInfo>& OutDevices);
ParameterTypeDescription
OutDevicesTArray<FOdinCaptureDeviceInfo>&All available capture devices

GetCurrentAudioCaptureDevice​

Const · Blueprint: Get Current Audio Capture Device

Returns info on the current capture device. Only usable in GameThread.

IMPORTANT! Should not be used in tick or on a regular basis because it could lead to stuttering.

UFUNCTION(BlueprintPure, Category = "Odin|Audio Capture")
void GetCurrentAudioCaptureDevice(FOdinCaptureDeviceInfo& CurrentDevice) const;
ParameterTypeDescription
CurrentDeviceFOdinCaptureDeviceInfo&Info on the current capture device

ChangeToDefaultCaptureDevice​

Blueprint: Change to Default Capture Device

Changes the current capture device to the system default and restarts the capture stream. Only usable in GameThread.

UFUNCTION(BlueprintCallable, Category = "Odin|Audio Capture")
void ChangeToDefaultCaptureDevice();

ChangeCaptureDeviceById​

Blueprint: Change Capture Device by Id

Updates the capture device and restarts the capture stream of the Audio Capture object. Only usable in GameThread.

IMPORTANT! Should not be used in tick or on a regular basis because it could lead to stuttering.

UFUNCTION(BlueprintCallable, Category = "Odin|Audio Capture")
void ChangeCaptureDeviceById(FString NewDeviceId, bool& bSuccess);
ParameterTypeDescription
NewDeviceIdFStringThe id of the targeted capture device.
bSuccessbool&Whether the capture device was successfully changed

StartCapturing​

Blueprint: Start Capturing

Starts Capturing Audio and returns whether capturing was started successfully.

UFUNCTION(BlueprintCallable, Category = "Odin|Audio Capture")
void StartCapturing(bool& bSuccess);
ParameterTypeDescription
bSuccessbool&True if capturing was started successfully.

ChangeCaptureDeviceByName​

Blueprint: Change Capture Device by Name

Updates the capture device and restarts the capture stream of the Audio Capture object. Only usable in GameThread.

IMPORTANT! Should not be used in tick or on a regular basis because it could lead to stuttering.

UFUNCTION(BlueprintCallable, Category = "Odin|Audio Capture")
void ChangeCaptureDeviceByName(FName DeviceName, bool& bSuccess);
ParameterTypeDescription
DeviceNameFNameThe name of the targeted capture device. Needs to be an exact match.
bSuccessbool&Whether or not the capture device was successfully changed

IsStreamOpen​

Const · Blueprint: Is Stream Open

Get whether the stream is currently open. Only usable in GameThread.

UFUNCTION(BlueprintPure, Category = "Odin|Audio Capture")
bool IsStreamOpen() const;

Returns bool – Returns true if capturing audio

GetStreamTime​

Const · Blueprint: Get Stream Time

Get the stream time of the audio capture stream. Only usable in GameThread.

UFUNCTION(BlueprintPure, Category = "Odin|Audio Capture")
float GetStreamTime() const;

Returns float – Time the stream was active.

RestartCapturing​

Blueprint: Restart Capturing

Restart the stream, using CurrentSelectedDeviceIndex as the new capture device. Only usable in GameThread.

UFUNCTION(BlueprintCallable, Category = "Odin|Audio Capture")
bool RestartCapturing(bool bAutomaticallyStartCapture = true);
ParameterTypeDescription
bAutomaticallyStartCaptureboolWhether to auto-start capturing (default true). Default: true.

Returns bool – Success.

GetTryRecognizingDeviceDisconnected​

Const

Whether capture device disconnect is being recognized automatically.

UFUNCTION(BlueprintInternalUseOnly, BlueprintPure, Category = "Odin|Audio Capture")
bool GetTryRecognizingDeviceDisconnected() const;

Returns bool – True, if automatic disconnection recognition is active, false otherwise.

SetTryRecognizingDeviceDisconnected​

Sets automatic recognition of capture device disconnects (i.e. if a capture device was removed). Can accidentally recognize disconnects if app experiences large frame times (greater than AllowedTimeWithoutStreamUpdate value)

UFUNCTION(BlueprintInternalUseOnly, BlueprintCallable, Category = "Odin|Audio Capture")
void SetTryRecognizingDeviceDisconnected(bool bTryRecognizing);
ParameterTypeDescription
bTryRecognizingboolNew value for whether automatic recognition of disconnects is active.

Events​

OnCaptureDeviceReset​

Blueprint: On Capture Device Reset

Will be called, if ODIN recognizes that the selected capture device does not supply data anymore, i.e. if a microphone was unplugged. ODIN will wait for AllowedTimeWithoutStreamUpdate seconds, before trying a stream restart.

UPROPERTY(BlueprintAssignable, Category = "Odin|Audio Capture")
FCaptureDeviceChange OnCaptureDeviceReset;

Signature: FCaptureDeviceChange void() (multicast)

OnDefaultDeviceChanged​

Blueprint: On Default Device Changed

Will be called, if the Default Device is the currently selected and if the Default Device was switched by the system.

UPROPERTY(BlueprintAssignable, Category = "Odin|Audio Capture")
FCaptureDeviceChange OnDefaultDeviceChanged;

Signature: FCaptureDeviceChange void() (multicast)

OnCaptureDeviceChanged​

Blueprint: On Capture Device Changed

Raised after the capture device changed, e.g. through Change Capture Device By Id or after the default device changed.

UPROPERTY(BlueprintAssignable, Category = "Odin|Audio Capture")
FCaptureDeviceChangedWithDetails OnCaptureDeviceChanged;

Signature: FCaptureDeviceChangedWithDetails void(const FOdinCaptureDeviceInfo& PreviousDevice, const FOdinCaptureDeviceInfo& NewDevice) (multicast)