示例#1
0
template<class W> void
Analyzer::Base<W>::drawFrame()
{
    EngineBase *engine = EngineController::engine();

    switch( engine->state() )
    {
    case Engine::Playing:
    {
        const Engine::Scope &thescope = engine->scope();
        static Analyzer::Scope scope( 512 );

        for( uint x = 0; (int)x < m_fht->size(); ++x ) scope[x] = double(thescope[x]) / (1<<15);

        transform( scope );
        analyze( scope );

        scope.resize( m_fht->size() );

        break;
    }
    case Engine::Paused:
        paused();
        break;

    default:
        demo();
    }
}
示例#2
0
void
BlockAnalyzer::transform( Analyzer::Scope &s ) //pure virtual
{
    for( uint x = 0; x < s.size(); ++x )
        s[x] *= 2;

    float *front = static_cast<float*>( &s.front() );

    m_fht->spectrum( front );
    m_fht->scale( front, 1.0 / 20 );

    //the second half is pretty dull, so only show it if the user has a large analyzer
    //by setting to m_scope.size() if large we prevent interpolation of large analyzers, this is good!
    s.resize( m_scope.size() <= MAX_COLUMNS/2 ? MAX_COLUMNS/2 : m_scope.size() );
}