MCPcopy Create free account
hub / github.com/LMMS/lmms / processAudioBuffer

Method processAudioBuffer

plugins/SpectrumAnalyzer/SpectrumAnalyzer.cpp:75–156  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

73
74
75bool SpectrumAnalyzer::processAudioBuffer( sampleFrame* _buf, const fpp_t _frames )
76{
77 if( !isEnabled() || !isRunning () )
78 {
79 return false;
80 }
81
82 if( !m_saControls.isViewVisible() )
83 {
84 return true;
85 }
86
87 fpp_t f = 0;
88 if( _frames > FFT_BUFFER_SIZE )
89 {
90 m_framesFilledUp = 0;
91 f = _frames - FFT_BUFFER_SIZE;
92 }
93
94 const int cm = m_saControls.m_channelMode.value();
95
96 switch( cm )
97 {
98 case MergeChannels:
99 for( ; f < _frames; ++f )
100 {
101 m_buffer[m_framesFilledUp] =
102 ( _buf[f][0] + _buf[f][1] ) * 0.5;
103 ++m_framesFilledUp;
104 }
105 break;
106 case LeftChannel:
107 for( ; f < _frames; ++f )
108 {
109 m_buffer[m_framesFilledUp] = _buf[f][0];
110 ++m_framesFilledUp;
111 }
112 break;
113 case RightChannel:
114 for( ; f < _frames; ++f )
115 {
116 m_buffer[m_framesFilledUp] = _buf[f][1];
117 ++m_framesFilledUp;
118 }
119 break;
120 }
121
122 if( m_framesFilledUp < FFT_BUFFER_SIZE )
123 {
124 return isRunning();
125 }
126
127
128// hanming( m_buffer, FFT_BUFFER_SIZE, HAMMING );
129
130 const sample_rate_t sr = Engine::mixer()->processingSampleRate();
131 const int LOWEST_FREQ = 0;
132 const int HIGHEST_FREQ = sr / 2;

Callers

nothing calls this directly

Calls 11

isEnabledFunction · 0.85
mixerFunction · 0.85
absspecFunction · 0.85
compressbandsFunction · 0.85
maximumFunction · 0.85
calc13octaveband31Function · 0.85
signalpowerFunction · 0.85
isViewVisibleMethod · 0.80
processingSampleRateMethod · 0.80
isRunningFunction · 0.50
valueMethod · 0.45

Tested by

no test coverage detected