143 float faceSizeOffset = faceSize * (
cameraSize.
X / 20.0f);
146 float xMaxCamera =
cameraSize.
X - faceSizeMaxX + faceSizeOffset;
306 float xSizeRatio = 1.0f - 0.5f + faceSize * (1.0f / 20.0f);
568 #ifdef NEOTRELLISMENU
Contains the class definition for ProtogenProject, a default project template for handling microphone...
static bool Initialize(uint8_t threshold)
Initializes the APDS9960 sensor.
static bool isBooped()
Checks if the sensor is "booped" (close proximity detected).
void AddParameter(float *parameter)
Adds a parameter to the animation track.
void Play()
Starts or resumes playback of the animation track.
void Reset()
Resets the animation track to its initial state.
void Pause()
Pauses playback of the animation track.
float Update()
Updates the animation track and returns the current parameter value.
void SetRadius(float radius)
Sets the radius for circular gradient patterns.
void SetPosition(Vector2D offset)
Sets the position of the gradient.
void Update(float *readData)
Updates the gradient based on new audio data.
void SetSize(Vector2D size)
Sets the size of the gradient.
void SetRotation(float angle)
Sets the rotation angle of the gradient.
void SetHueAngle(float hueAngle)
Sets the hue angle for color adjustments.
Manages multiple CameraBase objects.
Abstract base class for representing a color with operations for modification and interpolation.
Base class for managing brightness and display operations of lighting controllers.
virtual void Initialize()=0
Initializes the controller.
void AddParameterFrame(uint16_t dictionaryValue, float value) override
Adds a single frame value for a parameter.
void Update() override
Updates the animator, advancing all animations.
void SetInterpolationMethod(uint16_t dictionaryValue, InterpolationMethod interpMethod) override
Sets the interpolation method for a specific parameter.
void AddParameter(float *parameter, uint16_t dictionaryValue, uint16_t frames, float basis, float goal) override
Adds a parameter to the animator.
float GetViseme(MouthShape viseme)
Retrieves the probability of a specific viseme.
void SetThreshold(float threshold)
Sets the threshold for formant calculations.
void Update(float *peaks, float maxFrequency)
Updates the viseme probabilities based on new FFT data.
void Initialize()
Initializes the fan controller by setting up the pin for PWM output.
void SetPWM(uint8_t pwm)
Sets the PWM value to control the fan speed.
void SetGradient(RGBColor color, uint8_t colorIndex)
Sets a specific gradient color.
void Update(float ratio)
Updates the material's state based on the provided time ratio.
void SetPeriod(float period)
Sets the period of the waveform.
float Update()
Updates and calculates the next value of the waveform.
void UpdateGradient(RGBColor *rgbColors)
Updates the colors of the gradient.
void SetEffect(Effect *effect)
Sets the sub-effect to be applied to the display.
void SetFaceMin(Vector2D faceMin)
Sets the minimum face rendering coordinates.
void Initialize()
Initializes the display and related components.
void SetFaceMax(Vector2D faceMax)
Sets the maximum face rendering coordinates.
void Update()
Updates the display content based on the current state.
void Update(float ratio)
Updates the gradient animation based on the provided time ratio.
InterpolationMethod
Enumeration of interpolation methods for animations.
@ Linear
Straight linear interpolation.
void AddMaterial(Material::Method method, Material *material, uint16_t frames, float minOpacity, float maxOpacity)
Adds a material to the animation with specified properties.
void SetBaseMaterial(Material::Method method, Material *material)
Sets the base material for the animation.
void AddMaterialFrame(Material &material, float opacity)
Adds a specific frame for a material in the animation.
void Update()
Updates the animator, advancing the transitions.
Abstract base class for rendering materials.
Method
Defines blending methods for combining colors.
@ Add
Adds colors together.
@ Replace
Replaces the base color.
static float GetCurrentMagnitude()
Retrieves the current signal magnitude.
static float GetSampleRate()
Retrieves the current sampling rate.
static float * GetSamples()
Retrieves the raw input samples.
static float * GetFourierFiltered()
Retrieves the filtered FFT output data.
static void Initialize(uint8_t pin, uint32_t sampleRate, float minDB, float maxDB)
Initializes the microphone and FFT system with basic parameters.
static void Update()
Updates the microphone system, processing new samples and performing FFT.
Represents a 3D object with geometry, material, and transformation data.
Handles aligning and transforming 3D objects to fit within specified 2D camera bounds.
void SetEdgeMargin(float edgeMargin)
Sets the margin to keep from the edges when aligning objects.
void AlignObjectNoScale(Object3D *obj)
Aligns a single Object3D within the camera bounds without applying the object's scaling factor.
@ Stretch
Attempt to scale the object(s) to fill the entire area.
Transform GetTransform(Object3D *obj)
Computes the final Transform for aligning a single Object3D within the camera bounds.
void SetJustification(Justification jst)
Sets the justification mode for alignment.
void SetPlaneOffsetAngle(float offsetPlaneAngle)
Sets the additional rotation offset (plane offset angle), in degrees or radians, that will be applied...
void AlignObjectsNoScale(Object3D **objs, uint8_t numObjects)
Aligns multiple objects without applying the object's scaling factor.
void AlignObject(Object3D *obj)
Aligns a single Object3D within the camera bounds, including applying scale factors as necessary.
void SetCameraMax(Vector2D camMax)
Updates the maximum bounds for the 2D camera region.
void AlignObjects(Object3D **objs, uint8_t numObjects)
Aligns multiple objects within the camera bounds, including scale factors.
void SetMirrorX(bool mirrorX)
Enables or disables mirroring along the X-axis for the aligned objects.
void SetCameraMin(Vector2D camMin)
Updates the minimum bounds for the 2D camera region.
void SetPosition(Vector2D offset)
Sets the position of the oscilloscope visualization.
void SetSize(Vector2D size)
Sets the size of the oscilloscope visualization.
void Update(float *data)
Updates the oscilloscope visualization based on new audio data.
void SetHueAngle(float hueAngle)
Sets the hue angle for color adjustments.
Manages animations, rendering, and display operations.
Scene scene
The Scene object representing the rendered environment.
Controller * controller
Pointer to the Controller for controlling the display.
void SetMenuWiggleSpeed(float multiplierX, float multiplierY, float multiplierR)
Adjusts the menu's wiggle speed along X, Y, and rotation.
SimpleMaterial greenMaterial
Solid green material.
FunctionGenerator fGenMatYMove
BlinkTrack< 2 > blink
Blink track handler.
uint8_t buttonPin
Pin for the button input.
SpectrumAnalyzer sA
Audio-reactive materials.
Vector3D GetWiggleOffset()
Computes and returns a Vector3D offset for a "wiggle" effect using function generators.
uint8_t offsetFaceInd
Index for generic face offset in EasyEaseAnimator.
void Initialize() override
Initializes the ProtogenProject, setting up sensors, menus, and hardware.
SimpleMaterial redMaterial
Solid red material.
virtual void SpectrumAnalyzerCallback()=0
Callback invoked when the Spectrum Analyzer face is enabled/updated.
void UpdateKeyFrameTracks()
Updates any keyframe tracks (e.g., blink track).
void SetCameraMain(Vector2D min, Vector2D max)
Sets the camera bounds for the main (front) view.
void EnableBlinking()
Enables blinking (resets and plays the blink track).
RainbowSpiral rainbowSpiral
Spiral rainbow animated material.
bool isBooped
Flag to indicate if the APDS9960 sensor has detected a "boop".
SimpleMaterial blackMaterial
Solid black material.
SimpleMaterial blueMaterial
Solid blue material.
void AudioReactiveGradientFace()
Enables the Audio Reactive Gradient on the face, updating offsets and calling callbacks.
virtual void AudioReactiveGradientCallback()=0
Callback invoked when the Audio Reactive Gradient face is enabled/updated.
FanController fanController
Fan controller for controlling a fan's PWM.
void SetMenuOffset(Vector2D offset)
Sets the menu's position offset.
void AlignObjectsFace(Object3D **objects, uint8_t objectCount, float rotation=0.0f, float margin=2.0f, bool mirror=true)
Aligns multiple Object3D objects to the "face" camera bounds with scaling.
void SetMenuSize(Vector2D size)
Sets the menu's size.
float xOffset
Offsets used for small "wiggle" or motion in the scene.
SimpleMaterial yellowMaterial
Solid yellow material.
bool blinkSet
Flag to indicate if the blink parameter has been set.
void UpdateFFTVisemes()
Updates FFT-based visemes for voice detection and mouth shape animations.
void AlignObjectNoScaleRear(Object3D *obj, float rotation=0.0f, float margin=2.0f, bool mirror=true)
Aligns a single Object3D to the rear camera bounds without scaling.
void AddBackgroundMaterialFrame(Color color, float opacity=0.8f)
Adds a material frame to the background from a color enum.
float yOffset
Y-axis offset.
void OscilloscopeFace()
Enables the Oscilloscope on the face, updating offsets and calling callbacks.
Vector2D camMaxRear
Rear camera maximum bounds.
float offsetFaceARG
Offset for AudioReactiveGradient face.
void UpdateFace(float ratio)
Updates the face's rendered content, reading any user input and applying changes.
void AlignObjectRear(Object3D *obj, float rotation=0.0f, float margin=2.0f, bool mirror=true)
Aligns a single Object3D to the rear camera bounds with scaling.
void SetMaterialColor()
Sets the material color based on menu selection, applying color changes.
MaterialAnimator< 20 > backgroundMaterial
Handles layering of background materials.
FlowNoise flowNoise
Noise-based animated material.
void SetWiggleSpeed(float multiplier)
Sets the overall wiggle speed for both X and Y function generators.
Vector2D camMin
Minimum and maximum bounds for the primary (front) camera view.
EasyEaseAnimator< 60 > eEA
Animator that eases parameter transitions.
GradientMaterial< 2 > gradientMat
bool IsBooped()
Checks if the sensor has detected a boop.
float offsetFaceSA
Offset for SpectrumAnalyzer face.
void SpectrumAnalyzerFace()
Enables the Spectrum Analyzer on the face, updating offsets and calling callbacks.
Background background
Background object and associated 3D model.
void SetBaseMaterial(Material *material)
Sets the base material for the face material animator.
void AddParameter(uint8_t index, float *parameter, uint16_t transitionFrames, IEasyEaseAnimator::InterpolationMethod interpolationMethod=IEasyEaseAnimator::InterpolationMethod::Overshoot, bool invertDirection=false)
Adds a parameter to the EasyEaseAnimator for interpolation.
void SetMaterialLayers()
Sets up the initial layering of materials for both the face and background.
void AddMaterial(Material::Method method, Material *material, uint16_t frames=20, float minOpacity=0.0f, float maxOpacity=1.0f)
Adds a new material to the face's MaterialAnimator with given parameters.
ObjectAlign objAOther
Generic alignment object.
APDS9960 boop
Gesture sensor used for detecting "boops.".
float offsetFace
Facial offset parameters for layering advanced materials (e.g., Spectrum Analyzer).
void DisableBlinking()
Disables blinking (pauses and resets the blink track).
MaterialAnimator< 20 > materialAnimator
Material animators for face and background layering.
SimpleMaterial orangeMaterial
Solid orange material.
void AlignObjectFace(Object3D *obj, float rotation=0.0f, float margin=2.0f, bool mirror=true)
Aligns a single Object3D to the "face" camera bounds with scaling.
void AlignObjectsNoScale(Vector2D min, Vector2D max, Object3D **objects, uint8_t objectCount, float rotation=0.0f, float margin=2.0f, bool mirror=true)
Aligns multiple Object3D objects without scaling.
uint8_t faceCount
Total number of faces available (e.g., for UI or animations).
Vector2D cameraSize
The size of the camera used for rendering calculations.
void AlignObjectNoScale(Vector2D min, Vector2D max, Object3D *obj, float rotation=0.0f, float margin=2.0f, bool mirror=true)
Aligns a single Object3D without scaling.
float GetFaceScale()
Computes the face scaling based on a user-defined face size.
FunctionGenerator fGenMatXMove
Function generators for X/Y wiggle movements.
void AddViseme(Viseme::MouthShape visemeName, float *parameter)
Adds a viseme parameter to the animator (for mouth shapes).
void SetCameraRear(Vector2D min, Vector2D max)
Sets the camera bounds for the rear view.
SimpleMaterial purpleMaterial
Solid purple material.
ObjectAlign objA
Object alignment for the front, rear, and an additional alignment object.
float offsetFaceOSC
Offset for Oscilloscope face.
@ CRAINBOWNOISE
Flow noise (rainbow noise).
@ CHORIZONTALRAINBOW
Horizontal rainbow effect.
@ CRAINBOW
Rainbow spiral.
uint8_t offsetFaceIndSA
Index for SpectrumAnalyzer offset in EasyEaseAnimator.
HorizontalRainbow hRainbow
Horizontal rainbow animated material.
TimeStep frameLimiter
A TimeStep object to limit frames (e.g., to 120 FPS).
FFTVoiceDetection< 128 > voiceDetection
Voice detection system based on FFT data.
HeadsUpDisplay hud
Heads-up display (HUD) for the face overlay or additional data.
void AddMaterialFrame(Color color, float opacity=0.8f)
Adds a new material frame to the face's MaterialAnimator from a color enum.
ObjectAlign objARear
Alignment for the rear camera.
ObjectAlign * GetObjectAlignFace()
Gets the ObjectAlign instance for the face camera.
RGBColor gradientSpectrum[2]
Gradient used for color transitions.
Vector2D camMinRear
Minimum and maximum bounds for the rear camera view.
void HideFace()
Hides the face by setting its offset parameter.
virtual void OscilloscopeCallback()=0
Callback invoked when the Oscilloscope face is enabled/updated.
void AlignObjectNoScaleFace(Object3D *obj, float rotation=0.0f, float margin=2.0f, bool mirror=true)
Aligns a single Object3D to the "face" camera bounds without scaling.
uint8_t offsetFaceIndOSC
Index for Oscilloscope offset in EasyEaseAnimator.
void AddBlinkParameter(float *blinkParameter)
Adds a float parameter to the blink track for controlling blinking.
Material * GetBackgroundMaterial()
Retrieves the current background material animator.
ObjectAlign * GetObjectAlignRear()
Gets the ObjectAlign instance for the rear camera.
void AlignObjectsNoScaleRear(Object3D **objects, uint8_t objectCount, float rotation=0.0f, float margin=2.0f, bool mirror=true)
Aligns multiple Object3D objects to the rear camera bounds without scaling.
void LinkParameters()
Links internal parameters to the EasyEaseAnimator or other controllers.
uint8_t microphonePin
Pin assignments and face count.
void AlignObjectsRear(Object3D **objects, uint8_t objectCount, float rotation=0.0f, float margin=2.0f, bool mirror=true)
Aligns multiple Object3D objects to the rear camera bounds with scaling.
Vector2D camMax
Front camera maximum bounds.
void AddParameterFrame(uint16_t ProjectIndex, float target)
Adds a frame target to a previously added parameter.
Transform GetAlignmentTransform(Vector2D min, Vector2D max, Object3D *obj, float rotation=0.0f, float margin=2.0f)
Computes a transform for aligning a single Object3D within the given bounds.
Material * GetFaceMaterial()
Retrieves the current face material animator.
void AlignObjects(Vector2D min, Vector2D max, Object3D **objects, uint8_t objectCount, float rotation=0.0f, float margin=2.0f, bool mirror=true)
Aligns multiple Object3D objects, applying scaling.
SimpleMaterial whiteMaterial
Solid white material.
uint8_t offsetFaceIndARG
Index for AudioReactiveGradient offset in EasyEaseAnimator.
ObjectAlign * GetObjectAlign()
Gets the generic ObjectAlign instance.
void AddBackgroundMaterial(Material::Method method, Material *material, uint16_t frames=20, float minOpacity=0.0f, float maxOpacity=1.0f)
Adds a new material to the background's MaterialAnimator with given parameters.
void AlignObjectsNoScaleFace(Object3D **objects, uint8_t objectCount, float rotation=0.0f, float margin=2.0f, bool mirror=true)
Aligns multiple Object3D objects to the "face" camera bounds without scaling.
AudioReactiveGradient aRG
void AlignObject(Vector2D min, Vector2D max, Object3D *obj, float rotation=0.0f, float margin=2.0f, bool mirror=true)
Aligns a single Object3D within the given bounds, applying scaling.
ProtogenProject(CameraManager *cameras, Controller *controller, uint8_t numObjects, Vector2D camMin, Vector2D camMax, uint8_t microphonePin, uint8_t buttonPin, uint8_t faceCount)
Constructs a ProtogenProject instance.
Represents an RGB color and provides methods for manipulation.
RGBColor HueShift(const float &hueDeg)
Shifts the hue of the color by a specified angle in degrees.
void Update(float ratio)
Updates the material animation based on the time ratio.
void SetEffect(Effect *effect)
Sets the screen-space effect for the scene.
void AddObject(Object3D *object)
Adds a 3D object to the scene.
void EnableEffect()
Enables the screen-space effect for the scene.
void SetPosition(Vector2D offset)
Sets the position of the visualization area.
void SetMirrorYState(bool state)
Sets the mirroring state for the visualization.
void Update(float *readData)
Updates the spectrum visualization with new audio data.
void SetFlipYState(bool state)
Sets the flipping state for the visualization.
void SetSize(Vector2D size)
Sets the size of the visualization area.
void SetHueAngle(float hueAngle)
Sets the hue adjustment angle for the spectrum colors.
bool IsReady()
Checks if the specified time interval has elapsed.
Represents a 2D vector (X, Y) and provides methods for vector arithmetic.
Vector2D Multiply(const Vector2D &vector) const
Multiplies this vector by another Vector2D component-wise.
float X
The X-component of the 2D vector.
float Y
The Y-component of the 2D vector.
Represents a 3D vector (X, Y, Z) and provides methods for vector arithmetic.
MouthShape
Enumerates the possible mouth shapes for viseme detection.
@ ER
Mouth shape corresponding to the "ER" sound.
@ OO
Mouth shape corresponding to the "OO" sound.
@ AH
Mouth shape corresponding to the "AH" sound.
@ UH
Mouth shape corresponding to the "UH" sound.
@ AR
Mouth shape corresponding to the "AR" sound.
@ SS
Mouth shape corresponding to the "SS" sound (optional).
@ EE
Mouth shape corresponding to the "EE" sound.