Operating System Simulator Plugin  3.5.1
Unreal Engine plugin that simulates an Operating System Environment
Loading...
Searching...
No Matches
UOperatingSystemAudioPlayer Class Reference

#include "OperatingSystemAudioPlayer.h"

Inheritance diagram for UOperatingSystemAudioPlayer:
[legend]
Collaboration diagram for UOperatingSystemAudioPlayer:
[legend]

Public Member Functions

 UOperatingSystemAudioPlayer ()
 
bool PlayAudio (const float StartTime=0.f) const
 
bool StopAudio () const
 
bool SetVolumeMultiplier (const float NewMultiplier) const
 
bool SetPaused (const bool bPause) const
 
EAudioComponentPlayState GetPlayState () const
 
float GetAudioDuration () const
 
- Public Member Functions inherited from UOperatingSystemBaseProgram
 UOperatingSystemBaseProgram ()
 
UOperatingSystemBaseProgramStartProgram (FGenericError &OutError)
 
bool IsRunning () const
 
bool CanAddToDesktop () const
 
UOperatingSystemGetOperatingSystem () const
 
UOperatingSystemProgramIconWidgetCreateIconWidget ()
 
UOperatingSystemProgramIconWidgetGetIconWidget () const
 
void OpenFile (UOperatingSystemFile *TargetFile, FGenericError &OutError)
 
void CloseProgram (const bool bIsFullClose, FGenericError &OutError)
 
void BringToFront (FGenericError &OutError) const
 
UDraggableWindowGetParentWindow () const
 
void IsCompatibleWithOS (const TWeakObjectPtr< const UOperatingSystem > TestOS, FGenericError &OutError) const
 
bool CanSaveSettings () const
 
void SetParentPartition (TWeakObjectPtr< UOperatingSystemPartition > OwningPartition)
 
void OnProgramWindowStateChanged (const EOperatingSystemProgramViewState &NewState) const
 
bool IsWindowMaximized () const
 Checks whether the window of the operating system base program is maximized.
 
virtual OPERATINGSYSTEMSIMULATOR_API FString GetSaveSlotName () const
 
TOptional< FVector2D > GetWindowPosition () const
 Retrieves the position of the window associated with the operating system program.
 
TWeakObjectPtr< UOperatingSystemPartitionGetParentPartition () const
 Get the parent partition of the current operating system program.
 
TSoftClassPtr< UOperatingSystemProgramIconWidgetGetIconWidgetClass () const
 Retrieves the class of the icon widget for the operating system program.
 
TSoftClassPtr< UOperatingSystemProgramWidgetGetWidgetClass () const
 Retrieves the widget class associated with the operating system base program. This method returns the widget class that should be used to create the program widget for the specific program.
 
TSoftClassPtr< UOperatingSystemProgramSettingsGetSettingsClass () const
 Get the settings class associated with this program. This method returns the class type of the settings object specific to this program.
 
TSoftClassPtr< UOperatingSystemProgramDataGetDataClass () const
 Retrieves the data class associated with the program.
 
TSoftClassPtr< UOperatingSystemTaskbarButtonGetTaskbarButtonClass () const
 Retrieves the taskbar button class associated with the program.
 
TWeakObjectPtr< UOperatingSystemProgramSettingsGetSettings () const
 Get the settings object for the program.
 
TWeakObjectPtr< UOperatingSystemProgramDataGetDataObj () const
 Retrieves the data object associated with the operating system program.
 
TWeakObjectPtr< UOperatingSystemTaskbarButtonGetTaskbarButton () const
 Retrieves the taskbar button associated with the program.
 
UOperatingSystemProgramWidgetGetProgramWidget () const
 Returns the program widget associated with the operating system program.
 
template<class T >
T * GetSettings () const
 Get the settings object of type T.
 
template<class T >
T * GetDataObj () const
 Returns the data object associated with the program.
 
FORCEINLINE FString GetProgramName () const
 Returns the program name as a FString.
 
FORCEINLINE FName GetIdentifier () const
 Returns the identifier of the program. The identifier serves as a unique identification for the program.
 
FORCEINLINE bool IsSingleInstanceProgram () const
 Returns a boolean value indicating whether the program is a single instance program. A single instance program is a program that allows only one instance to run at a time.
 
FORCEINLINE bool IsSystemInstalledProgram () const
 Returns a boolean value indicating whether the program is installed on the system. If the program is installed, it will return true; otherwise, it will return false.
 
FORCEINLINE uint32 GetProcessID () const
 Retrieves the process ID of the current program. This method allows you to obtain the unique process ID of the program.
 
FORCEINLINE float GetSpaceRequiredInMB () const
 Get the space required by the program in megabytes. This method returns the space required by the program in megabytes.
 
FORCEINLINE bool ShouldRememberLastWindowPosition () const
 Indicates whether the program should remember the last window position.
 
OPERATINGSYSTEMSIMULATOR_API FORCEINLINE EOperatingSystemProgramCloseMethod GetCloseMethod () const
 Returns the close method of the operating system program.
 

Public Attributes

FOnOperatingSystemAudioPlayStateChanged OnAudioPlayStateChanged
 
FOnOperatingSystemAudioPlayerPlaybackChanged OnAudioPlaybackChanged
 
FOnOperatingSystemAudioPlaybackFinished OnAudioPlaybackFinished
 
- Public Attributes inherited from UOperatingSystemBaseProgram
FOnOperatingSystemProgramViewStateChanged OnOperatingSystemProgramViewStateChanged
 

Protected Member Functions

virtual void OnOpenFile (UOperatingSystemFile *TargetFile, FGenericError &OutError) override
 
virtual void OnClose (FGenericError &OutError) override
 
- Protected Member Functions inherited from UOperatingSystemBaseProgram
virtual OPERATINGSYSTEMSIMULATOR_API void OnValidate (FGenericError &OutError) const
 OnValidate method for validating program-specific logic.
 
virtual OPERATINGSYSTEMSIMULATOR_API void OnStart (FGenericError &OutError)
 Called when the program starts. It should be overridden in derived classes to provide the necessary functionality for the specific program.
 
virtual OPERATINGSYSTEMSIMULATOR_API void OnThemeChanged (UOperatingSystemSettingModule_Theme *ThemePayload)
 Virtual method called when the theme is changed.
 
void K2_OnCreate ()
 
void K2_OnInstall ()
 
FGenericError K2_OnStart ()
 
void K2_OnClose ()
 
void K2_OnSettingsLoad (UOperatingSystemProgramSettings *LoadedSettings)
 
void K2_OnOpenFile (FGenericError &OutError)
 
void K2_OnValidate (FGenericError &OutError) const
 
FString K2_GetSaveSlotName () const
 

Additional Inherited Members

- Static Public Member Functions inherited from UOperatingSystemBaseProgram
static UE_NODISCARD UOperatingSystemBaseProgramCreateProgram (TWeakObjectPtr< UOperatingSystem > OwningOS, const TSoftClassPtr< UOperatingSystemBaseProgram > &ProgramClass, FGenericError &OutError, const bool bInstalledWithOS=false)
 
static OPERATINGSYSTEMSIMULATOR_API bool IsStoreItemFree (const FOperatingSystemStoreProgramData &ProgramData)
 
- Protected Attributes inherited from UOperatingSystemBaseProgram
FText Name
 
FText Author
 
FText Description
 
FName Identifier
 
FOperatingSystemVersion Version
 
FText StoreDisplayName
 
FText StoreType
 
float StorePrice
 
FGameplayTagContainer SupportedOperatingSystems
 
uint8 bRequireMinOperatingSystemVersion: 1
 
FOperatingSystemVersion MinOperatingSystemVersion
 
TSoftObjectPtr< UObject > IconObject
 
float SpaceRequiredInMB
 
TSoftClassPtr< UOperatingSystemProgramIconWidgetIconWidgetClass
 
TSoftClassPtr< UOperatingSystemProgramWidgetWidgetClass
 
EOperatingSystemProgramCloseMethod CloseMethod
 
EOperatingSystemProgramSaveMethod SaveMethod
 
TSoftClassPtr< UOperatingSystemProgramSettingsSettingsClass
 
TSoftClassPtr< UOperatingSystemProgramDataDataClass
 
uint8 bRequiresData: 1
 
uint8 bAddToDesktop: 1
 
uint8 bCreateNotification: 1
 
uint8 bSingleInstanceOnly: 1
 
uint8 bCanRunOnPortableDevice: 1
 
uint8 bCreateSettingsBeforeStarting: 1
 
uint8 bRememberLastWindowPosition: 1
 
uint8 bAllowDragging: 1
 
uint8 bAllowResizing: 1
 
uint8 bOverrideWindowSize: 1
 
FVector2D OverrideWindowSize
 
FVector2D MinimumWindowResize
 
EOperatingSystemWindowStartupState StartWindowState
 
TSoftClassPtr< UDraggableWindowOverrideWindowClass
 
TSoftClassPtr< UOperatingSystemTaskbarButtonTaskbarButtonClass
 
TWeakObjectPtr< UOperatingSystemPartitionParentPartition
 

Detailed Description

The UOperatingSystemAudioPlayer class is an abstract class that represents an audio player in the operating system. It inherits from UOperatingSystemBaseProgram and provides functionality to play audio files, control playback, and retrieve information about the audio.

This class includes the following features:

  • Playing audio: The PlayAudio method starts the playback of the audio file and triggers the OnAudioPlayStateChanged delegate.
  • Stopping audio: The StopAudio method stops the playback of the audio file and triggers the OnAudioPlaybackFinished and OnAudioPlayStateChanged delegates.
  • Changing volume: The SetVolumeMultiplier method sets the volume multiplier of the audio file.
  • Pausing and unpausing: The SetPaused method toggles the pause state of the audio file and triggers the OnAudioPlayStateChanged delegate.
  • Retrieving play state: The GetPlayState method returns the current play state of the audio file.
  • Retrieving audio duration: The GetAudioDuration method returns the duration of the audio file.
See also
UOperatingSystemBaseProgram

Constructor & Destructor Documentation

◆ UOperatingSystemAudioPlayer()

UOperatingSystemAudioPlayer::UOperatingSystemAudioPlayer ( )

Member Function Documentation

◆ GetAudioDuration()

float UOperatingSystemAudioPlayer::GetAudioDuration ( ) const

Returns the duration of audio component.

Returns
Duration of audio.

◆ GetPlayState()

EAudioComponentPlayState UOperatingSystemAudioPlayer::GetPlayState ( ) const

Returns current play state of audio component.

Returns
Current state of the audio component.

◆ OnClose()

void UOperatingSystemAudioPlayer::OnClose ( FGenericError & OutError)
overrideprotectedvirtual

Handles the event of closing the audio player.

This method is called when the audio player is being closed. It stops the audio playback if it is currently playing and marks the current audio component as garbage. The current audio component is then set to nullptr.

Parameters
OutError(out) The error message, if any.
See also
FGenericError

Reimplemented from UOperatingSystemBaseProgram.

Here is the call graph for this function:

◆ OnOpenFile()

void UOperatingSystemAudioPlayer::OnOpenFile ( UOperatingSystemFile * TargetFile,
FGenericError & OutError )
overrideprotectedvirtual

Handles the event of opening a file in the audio player.

This method is called when a file is opened in the audio player. It creates the audio component and sets up the necessary delegates for playback control. If the file is not supported by the audio player, an error is generated.

Parameters
TargetFileThe file to be opened.
OutError(out) The error message, if any.
See also
UOperatingSystemFile
FGenericError

Reimplemented from UOperatingSystemBaseProgram.

Here is the call graph for this function:

◆ PlayAudio()

bool UOperatingSystemAudioPlayer::PlayAudio ( const float StartTime = 0.f) const

Plays the audio. Triggers 'On Audio Play State Changed' delegate.

Parameters
StartTimeOptional time to start playback from.
Returns
True if playback was started. False otherwise.

◆ SetPaused()

bool UOperatingSystemAudioPlayer::SetPaused ( const bool bPause) const

Toggles pause state. Triggers 'On Audio Play State Changed' delegate.

Parameters
bPauseTrue to pause audio. False to unpause.
Returns
True if the pause state was changed. False otherwise.

◆ SetVolumeMultiplier()

bool UOperatingSystemAudioPlayer::SetVolumeMultiplier ( const float NewMultiplier) const

Sets volume multiplier.

Parameters
NewMultiplierVolume Multiplier (0-1 range).
Returns
True if volume multiplier was set. False otherwise.

◆ StopAudio()

bool UOperatingSystemAudioPlayer::StopAudio ( ) const

Stops audio playback. Triggers 'On Audio Playback Finished' and 'On Audio Play State Changed' delegates.

Returns
True if audio was stopped. False otherwise.
Here is the caller graph for this function:

Member Data Documentation

◆ OnAudioPlaybackChanged

FOnOperatingSystemAudioPlayerPlaybackChanged UOperatingSystemAudioPlayer::OnAudioPlaybackChanged

Delegate that is triggered when the audio playback changes.

Parameters
PlaybackTimeThe current playback time in seconds.
PlaybackPercentThe current playback progress as a percentage (0-1).

◆ OnAudioPlaybackFinished

FOnOperatingSystemAudioPlaybackFinished UOperatingSystemAudioPlayer::OnAudioPlaybackFinished

Delegate that is triggered when the audio playback is finished.

◆ OnAudioPlayStateChanged

FOnOperatingSystemAudioPlayStateChanged UOperatingSystemAudioPlayer::OnAudioPlayStateChanged

Delegate that is triggered when the play state of the audio changes.


The documentation for this class was generated from the following files: