UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
SineWaveTableOsc.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "CoreMinimal.h"
6
7namespace Audio
8{
9 class FWaveTableOsc;
10
11
12 // A sinusoidal wave table oscillator class
14 {
15 public:
16 // Constructor
18
19 // Virtual Destructor
21
22 // Initialize the wave table oscillator
23 SIGNALPROCESSING_API void Init(const float InSampleRate, const float InFrequencyHz, const float InPhase);
24
25 // Sets the sample rate of the oscillator.
27
28 // Resets the wave table read indices.
30
31 // Sets the frequency of the wave table oscillator.
33
34 // Returns the frequency of the wave table oscillator.
35 float GetFrequencyHz() const { return FrequencyHz; }
36
37 // Sets the phase of the wave table oscillator.
38 SIGNALPROCESSING_API void SetPhase(const float InPhase);
39
40 // Processes the wave table and fills a buffer
41 SIGNALPROCESSING_API void Generate(float* OutBuffer, const int32 NumSamples);
42
43 // The static sinusoidal wave table
45
46 protected:
48
49 // The wave table buffer
51
52 // The frequency of the output (given the sample rate)
53 float FrequencyHz = 440.0f;
54
55 // The sample rate of the oscillator
56 float SampleRate = 48000.0f;
57
58 // Read index
59 float ReadIndex = 0.0f;
60
61 // The phase increment (based on frequency)
62 float PhaseIncrement = 0.0f;
63
64 // The initial/cached phase, will be clamped to range 0.0 - 1.0f
65 float InitialPhase = 0.0f;
66
67 // The instantaneous phase, clamped to range 0.0 - 1.0f
68 float InstantaneousPhase = 0.0f;
69 };
70}
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
void Init()
Definition LockFreeList.h:4
Definition SineWaveTableOsc.h:14
SIGNALPROCESSING_API void Reset()
Definition SineWaveTableOsc.cpp:35
SIGNALPROCESSING_API FSineWaveTableOsc()
Definition SineWaveTableOsc.cpp:9
float FrequencyHz
Definition SineWaveTableOsc.h:53
float ReadIndex
Definition SineWaveTableOsc.h:59
SIGNALPROCESSING_API void UpdatePhaseIncrement()
Definition SineWaveTableOsc.cpp:71
SIGNALPROCESSING_API void Generate(float *OutBuffer, const int32 NumSamples)
Definition SineWaveTableOsc.cpp:76
static SIGNALPROCESSING_API const TArray< float > & GetWaveTable()
Definition SineWaveTableOsc.cpp:118
float SampleRate
Definition SineWaveTableOsc.h:56
float InitialPhase
Definition SineWaveTableOsc.h:65
SIGNALPROCESSING_API void SetSampleRate(const float InSampleRate)
Definition SineWaveTableOsc.cpp:29
virtual SIGNALPROCESSING_API ~FSineWaveTableOsc()
Definition SineWaveTableOsc.cpp:14
const TArray< float > & WaveTableBuffer
Definition SineWaveTableOsc.h:50
float GetFrequencyHz() const
Definition SineWaveTableOsc.h:35
float PhaseIncrement
Definition SineWaveTableOsc.h:62
float InstantaneousPhase
Definition SineWaveTableOsc.h:68
SIGNALPROCESSING_API void SetPhase(const float InPhase)
Definition SineWaveTableOsc.cpp:50
SIGNALPROCESSING_API void SetFrequencyHz(const float InFrequencyHz)
Definition SineWaveTableOsc.cpp:44
Definition Array.h:670
NO_LOGGING.
Definition AudioMixerPlatformAndroid.cpp:53