////////////////////////////////////////////////////////////////////////// // // Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. // /////////////////////////////////////////////////////////////////////////// // // Public API Voice Activity Detection (VAD) definitions for PryonLite // /////////////////////////////////////////////////////////////////////////// #ifndef PRYON_LITE_VAD_PRL2000_H #define PRYON_LITE_VAD_PRL2000_H #ifdef __cplusplus extern "C" { #endif /// @brief Pryon lite voice activity detection API version #define PRYON_LITE_VAD_API_VERSION "0.1.0" /// /// @brief Handle to a voice activity detection instance /// typedef void* PryonLiteVadHandle; /// Voice activity detection implementation specific settings /// /// @brief Energy Detection Configuration structure /// The energy detection implementation uses the total energy in the /// audio frame to determine if there is voice activity or not. This is /// a very lightweight approach but is susceptible to waking up to any /// loud noise. See the documentation for more details. /// typedef struct PryonLiteEnergyDetectionConfig { int enableGate; ///< When used inline with any other functionality, true to prevent continued downstream processing of non voice frames } PryonLiteEnergyDetectionConfig; /// /// @brief Voice Activity Detection Configuration structure /// typedef struct PryonLiteVadConfig { PryonLiteEnergyDetectionConfig *energyDetection; const char* apiVersion; ///< For header / library version consistency verification. /// Must pass in PRYON_LITE_VAD_API_VERSION as defined in this file. void* userData; ///< User-specified data pointer, to be returned when invoking voice activity detection callbacks } PryonLiteVadConfig; /// /// @brief Voice Activity Detection State /// typedef enum PryonLiteVadState { PRYON_LITE_VAD_INACTIVE = 0, PRYON_LITE_VAD_ACTIVE = 1 } PryonLiteVadState; /// /// @brief Voice Activity Detection Event /// typedef struct PryonLiteVadEvent { PryonLiteVadState vadState; ///< Voice activity detection state (inactive/active) long long beginSampleIndex; ///< Identifies the sample index in the client's source of audio at which /// the voice activity detection event occurs. void* reserved; ///< reserved for future use void* userData; ///< userData passed in via PryonLiteVadConfig during decoder initialization } PryonLiteVadEvent; #ifdef __cplusplus } // extern "C" #endif /// /// @brief Default Configuration to be used to initialize PryonLiteEnergyDetectionConfig struct /// #define PryonLiteEnergyDetectionConfig_Default \ { \ 0, /* enableGate */ \ }; /// /// @brief Default Configuration to be used to initialize PryonLiteVadConfig struct /// #define PryonLiteVadConfig_Default \ { \ NULL, /* energyDetection */ \ PRYON_LITE_VAD_API_VERSION, /* apiVersion */ \ NULL, /* userData */ \ }; /// /// @brief Voice activity detection specific attributes /// typedef struct PryonLiteVadConfigAttributes { const char *vadApiVersion; //< PryonLite voice activity detection API version } PryonLiteVadConfigAttributes; #endif //PRYON_LITE_VAD_PRL2000_H