VJ Master 1.0
Real-time audio analysis and visualisation.
Loading...
Searching...
No Matches
ST_AudioIOPlaybackBase.h
1// Copyright (c) 2025 Aaron Trotter (ShaderTech). All Rights Reserved.
2
3#pragma once
4
5#include "CoreMinimal.h"
6#include "IO/Base/ST_AudioIOBase.h"
7#include "Main/ST_AudioProcessingSettings.h"
8#include "ST_AudioIOPlaybackBase.generated.h"
9
10struct ma_device;
11struct ma_decoder;
12using ma_uint32 = unsigned int;
13
19UCLASS(BlueprintType, Abstract)
20class ST_AUDIOPROCESSING_API UST_AudioIOPlaybackBase : public UST_AudioIOBase
21{
22 GENERATED_BODY()
23
24public:
29 bool IsPlaying() const;
30
38 static void MA_PlaybackCallBack(ma_device* pDevice, void* pOutput, const void* pInput, ma_uint32 frameCount);
39
45
50 virtual EST_SampleFormat GetAudioFormat() const override;
51
52protected:
53
57 virtual void DeinitializeAudioIO() override;
58
63 virtual ma_decoder* GetPlaybackDecoder() const override;
64
69 void SetIsPlaying(bool value);
70
73
76
77private:
79 bool bIsPlaying = false;
80};
81
83{
84 return bIsPlaying;
85}
86
91
93{
94 bIsPlaying = value;
95}
96
101
102inline EST_SampleFormat UST_AudioIOPlaybackBase::GetAudioFormat() const
103{
104 if (PlaybackDevice == nullptr)
105 {
106 return Super::GetAudioFormat();
107 }
108 return (EST_SampleFormat)PlaybackDevice->playback.format;
109}
UST_AudioIOBase()
Definition ST_AudioIOBase.cpp:18
FAudioIOConfig CachedAudioIOConfig
Cached audio IO configuration.
Definition ST_AudioIOBase.h:226
Base class for audio playback IO operations.
Definition ST_AudioIOPlaybackBase.h:21
ma_decoder * PlaybackDecoder
Pointer to the Miniaudio decoder for reading audio data.
Definition ST_AudioIOPlaybackBase.h:75
void SetIsPlaying(bool value)
Sets whether the system is currently playing audio.
Definition ST_AudioIOPlaybackBase.h:92
virtual ma_decoder * GetPlaybackDecoder() const override
Retrieves the active audio decoder for playback.
Definition ST_AudioIOPlaybackBase.h:87
static void MA_PlaybackCallBack(ma_device *pDevice, void *pOutput, const void *pInput, ma_uint32 frameCount)
Callback for handling audio playback data.
Definition ST_AudioIOPlaybackBase.cpp:30
virtual void DeinitializeAudioIO() override
Deinitializes the audio IO subsystem, including device shutdown.
Definition ST_AudioIOPlaybackBase.cpp:6
FDecoderConfig GetDecoderConfig() const
Returns the configuration of the audio decoder.
Definition ST_AudioIOPlaybackBase.h:97
virtual EST_SampleFormat GetAudioFormat() const override
Returns the current audio format.
Definition ST_AudioIOPlaybackBase.h:102
bool IsPlaying() const
Checks whether audio playback is currently active.
Definition ST_AudioIOPlaybackBase.h:82
ma_device * PlaybackDevice
Pointer to the Miniaudio playback device.
Definition ST_AudioIOPlaybackBase.h:72
Structure that holds configuration for audio decoding.
Definition ST_AudioProcessingSettings.h:1082
Definition miniaudio.h:9918
Definition miniaudio.h:7710