Files
bluflame/evoke-64k/trunk/ev10/VUMeter.h
2026-04-18 22:31:51 +02:00

43 lines
596 B
C

#pragma once
struct SVUMeter
{
const static int m_iBufferLength= 441;
float m_fVUData[ m_iBufferLength ];
int m_iLastPos;
SVUMeter()
{
m_iLastPos= 0;
for( int i= 0; i < m_iBufferLength; ++i )
{
m_fVUData[ i ]= 0.0f;
}
}
void Set( int iPos,
float fVal )
{
iPos= iPos % m_iBufferLength;
while( true )
{
m_fVUData[ m_iLastPos ]= fVal;
if( m_iLastPos != iPos )
{
m_iLastPos++;
m_iLastPos= m_iLastPos % m_iBufferLength;
}
else
{
break;
}
}
}
float Get( int iPos )
{
iPos= iPos % m_iBufferLength;
return m_fVUData[ iPos ];
}
};