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

Method renderOutput

plugins/nes/Nes.cpp:108–436  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

106
107
108void NesObject::renderOutput( sampleFrame * buf, fpp_t frames )
109{
110 ////////////////////////////////
111 // //
112 // variables for processing //
113 // //
114 ////////////////////////////////
115
116 bool ch1Enabled = m_parent->m_ch1Enabled.value();
117 bool ch2Enabled = m_parent->m_ch2Enabled.value();
118 bool ch3Enabled = m_parent->m_ch3Enabled.value();
119 bool ch4Enabled = m_parent->m_ch4Enabled.value();
120
121 float ch1DutyCycle = DUTY_CYCLE[ m_parent->m_ch1DutyCycle.value() ];
122 int ch1EnvLen = wavelength( floorf( 240.0 / ( m_parent->m_ch1EnvLen.value() + 1 ) ) );
123 bool ch1EnvLoop = m_parent->m_ch1EnvLooped.value();
124
125 float ch2DutyCycle = DUTY_CYCLE[ m_parent->m_ch2DutyCycle.value() ];
126 int ch2EnvLen = wavelength( floorf( 240.0 / ( m_parent->m_ch2EnvLen.value() + 1 ) ) );
127 bool ch2EnvLoop = m_parent->m_ch2EnvLooped.value();
128
129 int ch4EnvLen = wavelength( floorf( 240.0 / ( m_parent->m_ch4EnvLen.value() + 1 ) ) );
130 bool ch4EnvLoop = m_parent->m_ch4EnvLooped.value();
131
132 // processing variables for operators
133 int ch1;
134 int ch2;
135 int ch3;
136 int ch4;
137
138 // levels for generators (used for dc offset compensation)
139 int ch1Level;
140 int ch2Level;
141 int ch3Level;
142 int ch4Level;
143
144 int ch1SweepRate = wavelength( floorf( 120.0 / ( m_parent->m_ch1SweepRate.value() + 1 ) ) );
145 int ch2SweepRate = wavelength( floorf( 120.0 / ( m_parent->m_ch2SweepRate.value() + 1 ) ) );
146 int ch4SweepRate = wavelength( floorf( 60.0f / ( 8.0f - qAbs( m_parent->m_ch4Sweep.value() ) ) ) );
147
148 int ch1Sweep = static_cast<int>( m_parent->m_ch1SweepAmt.value() * -1.0 );
149 int ch2Sweep = static_cast<int>( m_parent->m_ch2SweepAmt.value() * -1.0 );
150
151 int ch4Sweep = 0;
152 if( m_parent->m_ch4Sweep.value() != 0.0f )
153 {
154 ch4Sweep = m_parent->m_ch4Sweep.value() > 0.0f
155 ? -1
156 : 1;
157 }
158
159 // the amounts are inverted so we correct them here
160 if( ch1Sweep > 0 )
161 {
162 ch1Sweep = 8 - ch1Sweep;
163 }
164 if( ch1Sweep < 0 )
165 {

Callers 1

playNoteMethod · 0.45

Calls 3

noiseSampleFunction · 0.85
linearInterpolateFunction · 0.85
valueMethod · 0.45

Tested by

no test coverage detected