/*
   HARK Library
   Copyright (C) 2021 Honda Research Institute Japan Inc.
 */

#if !defined(_HARKLIB_NODE_VADPYANNOTE_H_INCLUDED_)
#define _HARKLIB_NODE_VADPYANNOTE_H_INCLUDED_ 1

#if defined(HARKLIB_USES_LIBTORCH)

#include "hark-lib/hark-lib.h"
#include "hark-lib/node.h"

#include "hark-lib/source.h"

namespace hark
{
namespace node
{
    class VADPyAnnote: public NodeDef
    {
    public:
        class BaseImpl {
        public:
            virtual ~BaseImpl() = default;
        };

        struct Score {
            float  s1, s2, sr;
            bool   active;
            size_t duration;
        };

    public:
        VADPyAnnote();
        virtual void reset();
        virtual bool operator () (size_t count, InputDataBundle &input, OutputDataBundle &output);

    private:
        std::vector<std::unique_ptr<BaseImpl>> _channel_impls;

        std::string _model_path;
        size_t _sampling_rate, _advance, _length, _channel_count;
        float _split_period;
        size_t _sincnet_kernel_size, _sincnet_padding;
        float _onset_score_threshold, _offset_score_threshold;
        size_t _split_period_frames, _head_margin_frames, _tail_margin_frames;
        size_t _head_margin_kernels, _tail_margin_kernels;
        size_t _source_sequence;

        std::vector<int> _initial_normalize_counts;
        std::vector<float> _initial_normalize_means, _initial_normalize_sigmas;
    };
}
}

#endif /* #if defined(HARKLIB_USES_LIBTORCH) */
#endif /* #if !defined(_HARKLIB_NODE_VADPYANNOTE_H_INCLUDED_) */

/* end of file */
