/*****************************************************************************

      VcvInputBase.cpp
      Copyright (c) 2020 Raphael DINGE

*Tab=3***********************************************************************/



/*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/

#include "erb/vcvrack/VcvInputBase.h"

#include "erb/vcvrack/VcvModule.h"

#include <rack.hpp>



namespace erb
{



/*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/

/*
==============================================================================
Name : ctor
==============================================================================
*/

VcvInputBase::VcvInputBase (VcvModule & module)
{
   module.add (*this);
}



/*
==============================================================================
Name : index
==============================================================================
*/

size_t   VcvInputBase::index () const
{
   return _index;
}



/*
==============================================================================
Name : norm_val
==============================================================================
*/

float VcvInputBase::norm_val () const
{
   return _norm_val;
}



/*\\\ INTERNAL \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/

/*
==============================================================================
Name : impl_bind
==============================================================================
*/

void  VcvInputBase::impl_bind (size_t index, rack::engine::Input & input)
{
   _index = index;
   _input_ptr = &input;
}



/*
==============================================================================
Name : impl_notify_audio_buffer_start
==============================================================================
*/

void  VcvInputBase::impl_notify_audio_buffer_start ()
{
   _norm_val = _input_ptr->getVoltage () * 0.2f;
}



/*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/



/*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/



}  // namespace erb



/*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
