Loading files
This file is pinned to the selected release. Download the original to open it in your design tool.
/*****************************************************************************
VcvGateOut.cpp
Copyright (c) 2020 Raphael DINGE
*Tab=3***********************************************************************/
/*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
#include "erb/vcvrack/VcvGateOut.h"
#include "erb/vcvrack/VcvModule.h"
namespace erb
{
/*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
/*
==============================================================================
Name : ctor
==============================================================================
*/
VcvGateOut::VcvGateOut (VcvModule & module, const VcvPin & /* pin */)
: VcvOutputBase (module)
, _module (module)
{
}
/*
==============================================================================
Name : on
==============================================================================
*/
void VcvGateOut::on ()
{
_mode = Mode::Constant;
_current = true;
}
/*
==============================================================================
Name : off
==============================================================================
*/
void VcvGateOut::off ()
{
_mode = Mode::Constant;
_current = false;
}
/*
==============================================================================
Name : trigger
==============================================================================
*/
void VcvGateOut::trigger (std::chrono::milliseconds duration)
{
_mode = Mode::Pulse;
_start = _module.now_ms ();
_duration = uint64_t (duration.count ());
_current = true;
}
/*\\\ INTERNAL \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
/*
==============================================================================
Name : impl_notify_audio_buffer_start
==============================================================================
*/
void VcvGateOut::impl_notify_audio_buffer_start ()
{
if (_mode == Mode::Pulse)
{
auto now = _module.now_ms ();
auto elapsed = now - _start;
_current = elapsed < _duration;
}
set_norm_val (float (_current));
}
/*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
/*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
} // namespace erb
/*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
ce1d56493This file is pinned to the selected release. Download the original to open it in your design tool.