// ============================================================
// (C) 2017 Harman International Industries, Incorporated.
// Confidential & Proprietary. All Rights Reserved.
// ============================================================
/**
* file AwxAudioObjExt.h
* brief Simple demo object Audio object to start a development of a new audio object- Header file
* details Project Extendable Audio Framework
* copyright Harman/Becker Automotive Systems GmbH
*
2017
*
All rights reserved
* author xAF Team
* date Nov 28, 2023
*/
#ifndef AWXAUDIOOBJEXT_H
#define AWXAUDIOOBJEXT_H
/*!
* xaf mandataory includes
*/
#include "AudioObject.h"
#define AWXAUDIOOBJEXT_VERSION_MAJOR (0x01)
#define AWXAUDIOOBJEXT_VERSION_MINOR (0x01)
#define AWXAUDIOOBJEXT_VERSION_REVISION (0x06)
#define AWXAUDIOOBJEXT_TUNING_VERSION_MAJOR (0x01)
#define AWXAUDIOOBJEXT_TUNING_VERSION_MINOR (0x00)
/** here you can add all required include files required for
the core functionality of your objects
**/
#define AWX_AUDIO_OBJ_EXT_NUM_PARAMS 1
#define FLOAT_ARRAY_SIZE 10
#define NUM_DIMENSION_VAR 1
/**
* brief Simple example object to provide a starting point for a new audio object
*/
class CAwxAudioObjExt : public CAudioObject
{
public:
static AOVersion version;
CAwxAudioObjExt();
virtual ~CAwxAudioObjExt();
/**
* Refer AudioObject.h for description
*/
/*
* It returns the class size of the given audio object.
*/
xUInt32 getSize() const OVERRIDE;
/*
This function initializes all the object variables and parameters. In this method, the object shall initialize all its memory to appropriate values.
*/
void init() OVERRIDE;
void calc(xAFAudio** inputs, xAFAudio** outputs) OVERRIDE;
/**
* brief This method is called when an object receives updated tuning data.
* param subblock index selects the subblock
* param offsetBytes points the offset in param memory (bytes)
* param sizeBytes number of parameters to be updated (bytes)
* param shouldAttemptRamp whether or not this data should be attempt to apply instantly, or AO should attempt ramping
*/
void tuneXTP(xSInt32 subblock, xSInt32 adrBytes, xSInt32 sizeBytes, xBool shouldAttemptRamp) OVERRIDE;
/**
* brief Retrieves pointer to the start of the subblock
* param subBlock subblock number
* return start address of the subblock
*/
xInt8* getSubBlockPtr(xUInt16 subBlock) OVERRIDE;
/**
* Returns the size of the sub block indicated by 'subBlock'
* param subBlock the ID of the state subBlock we want to get the size of
* return size of subBlock
*/
xSInt32 getSubBlockSize(xUInt16 subblock) OVERRIDE;
/**
* Assigns the additional configuration as the object requires.
*/
void assignAdditionalConfig() OVERRIDE;
/**
* Control method to set the new value
* param index - pin index of the object's control input we are writing to
* param value - value we are writing
*/
xSInt32 controlSet(xSInt32 index, xFloat32 param) OVERRIDE;
/**
* brief It reads the array of applied gain values through additional configuration "Max Gain per channel" for each channel.
* param index denotes the channel index
* return Gain value read for each channel.
*/
xFloat32 getMaxGain(xSInt32 index);
enum AddnlVars {MAX_GAIN_PER_CHANNEL, THIRD_PARTY_MEM_BLK , AWX_EXT_NUM_ADD_VARS };
enum Modes { GAIN, GAIN_WITH_CONTROL, AWX_EXT_NUM_MODES };
enum MemAccess { DISABLE_BLOCK, ENABLE_BLOCK };
enum memoryRecords { PARAM, COEFF, FLOATARRAY, NUM_MEM_RECORDS } memRecs;
enum PARAMS { NUM_PARAMS_PER_CHANNEL = 2 };
xInt8 m_EnMemory;
protected:
xFloat32* m_Coeffs; ///< internal pointer to COEFF memrec
xFloat32* m_Params; ///< internal pointer to PARAM memrec
xFloat32* m_MemBlock; ///< internal pointer to FLOATARRAY memrec
private:
/**
* brief for each channel, checks the gain limits and calculates gain coefficient
* param channel channel index
* param gainIndB gain in dB
*/
void calcGain(xSInt32 channelIndex, xFloat32 gainIndB);
};
#endif //AWXAUDIOOBJEXT_H