| 193 | | if (m_osc2Connect == 0) { |
| 194 | | // no LFO |
| 195 | | m_oscillator1.getSamples(s_samples, start, end); |
| 196 | | if (m_volMode == 0) m_envelope1.ampSamplesLinear(s_samples, start, end, m_velocity); |
| 197 | | else m_envelope1.ampSamplesNonLinear(s_samples, start, end, m_velocity); |
| 198 | | } |
| | 219 | if (m_inSens == 0) { |
| | 220 | if (m_osc2Connect == 0) { |
| | 221 | // no input, no LFO |
| | 222 | m_oscillator1.getSamples(s_samples, start, end); |
| | 223 | if (m_volMode == 0) m_envelope1.ampSamplesLinear(s_samples, start, end, m_velocity); |
| | 224 | else m_envelope1.ampSamplesNonLinear(s_samples, start, end, m_velocity); |
| | 225 | } |
| | 226 | else { |
| | 227 | // no input, with LFO, linear |
| | 228 | if (m_volMode == 0) { |
| | 229 | for(i = start; i < end; i++) { |
| | 230 | freqNo = m_freqNo; |
| | 231 | if (m_onCounter >= m_lfoDelay && (m_lfoEnd == 0 || m_onCounter < m_lfoEnd)) { |
| | 232 | freqNo += m_oscillator2.getNextSample() * m_osc2Sign * m_lfoDepth; |
| | 233 | } |
| | 234 | m_oscillator1.setFrequency(getFrequency(freqNo)); |
| | 235 | s_samples[i] = getNextSampleLinear(); |
| | 236 | m_onCounter++; |
| | 237 | } |
| | 238 | } |
| | 239 | // no input, with LFO, non linear |
| | 240 | else { |
| | 241 | for(i = start; i < end; i++) { |
| | 242 | freqNo = m_freqNo; |
| | 243 | if (m_onCounter >= m_lfoDelay && (m_lfoEnd == 0 || m_onCounter < m_lfoEnd)) { |
| | 244 | freqNo += m_oscillator2.getNextSample() * m_osc2Sign * m_lfoDepth; |
| | 245 | } |
| | 246 | m_oscillator1.setFrequency(getFrequency(freqNo)); |
| | 247 | s_samples[i] = getNextSampleNonLinear(); |
| | 248 | m_onCounter++; |
| | 249 | } |
| | 250 | } |
| | 251 | } |
| | 252 | } |
| | 253 | // with input |
| 200 | | // with LFO, linear |
| 201 | | if (m_volMode == 0) { |
| 202 | | for(i = start; i < end; i++) { |
| 203 | | freqNo = m_freqNo; |
| 204 | | if (m_onCounter >= m_lfoDelay && (m_lfoEnd == 0 || m_onCounter < m_lfoEnd)) { |
| 205 | | freqNo += m_oscillator2.getNextSample() * m_osc2Sign * m_lfoDepth; |
| 206 | | } |
| 207 | | m_oscillator1.setFrequency(getFrequency(freqNo)); |
| 208 | | s_samples[i] = getNextSampleLinear(); |
| 209 | | m_onCounter++; |
| 210 | | } |
| 211 | | } |
| 212 | | // with LFO, non linear |
| | 255 | //trace("input "+m_inPipe); |
| | 256 | if (m_osc2Connect == 0) { |
| | 257 | // with input, no LFO |
| | 258 | arr = s_pipeArr[m_inPipe]; |
| | 259 | freqNo = getFrequency(m_freqNo); |
| | 260 | if (m_volMode == 0) { |
| | 261 | for(i = start; i < end; i++) { |
| | 262 | m_oscillator1.setFrequency(freqNo + arr[i] * m_inSens); |
| | 263 | s_samples[i] = getNextSampleLinear(); |
| | 264 | } |
| | 265 | } |
| | 266 | else { |
| | 267 | for(i = start; i < end; i++) { |
| | 268 | m_oscillator1.setFrequency(freqNo + arr[i] * m_inSens); |
| | 269 | s_samples[i] = getNextSampleNonLinear(); |
| | 270 | } |
| | 271 | } |
| | 272 | } |
| 214 | | for(i = start; i < end; i++) { |
| 215 | | freqNo = m_freqNo; |
| 216 | | if (m_onCounter >= m_lfoDelay && (m_lfoEnd == 0 || m_onCounter < m_lfoEnd)) { |
| 217 | | freqNo += m_oscillator2.getNextSample() * m_osc2Sign * m_lfoDepth; |
| 218 | | } |
| 219 | | m_oscillator1.setFrequency(getFrequency(freqNo)); |
| 220 | | s_samples[i] = getNextSampleNonLinear(); |
| 221 | | m_onCounter++; |
| | 274 | // with input, with LFO, linear |
| | 275 | if (m_volMode == 0) { |
| | 276 | arr = s_pipeArr[m_inPipe]; |
| | 277 | for(i = start; i < end; i++) { |
| | 278 | freqNo = m_freqNo; |
| | 279 | if (m_onCounter >= m_lfoDelay && (m_lfoEnd == 0 || m_onCounter < m_lfoEnd)) { |
| | 280 | freqNo += m_oscillator2.getNextSample() * m_osc2Sign * m_lfoDepth; |
| | 281 | } |
| | 282 | m_oscillator1.setFrequency(getFrequency(freqNo) + arr[i] * m_inSens); |
| | 283 | s_samples[i] = getNextSampleLinear(); |
| | 284 | m_onCounter++; |
| | 285 | } |
| | 286 | } |
| | 287 | // with input, with LFO, non linear |
| | 288 | else { |
| | 289 | arr = s_pipeArr[m_inPipe]; |
| | 290 | for(i = start; i < end; i++) { |
| | 291 | freqNo = m_freqNo; |
| | 292 | if (m_onCounter >= m_lfoDelay && (m_lfoEnd == 0 || m_onCounter < m_lfoEnd)) { |
| | 293 | freqNo += m_oscillator2.getNextSample() * m_osc2Sign * m_lfoDepth; |
| | 294 | } |
| | 295 | m_oscillator1.setFrequency(getFrequency(freqNo) + arr[i] * m_inSens); |
| | 296 | s_samples[i] = getNextSampleNonLinear(); |
| | 297 | m_onCounter++; |
| | 298 | } |
| 227 | | for(i = start; i < end; i++) { |
| 228 | | amplitude = s_samples[i]; |
| 229 | | sample = samples[i]; |
| 230 | | sample.left += amplitude * m_panL; |
| 231 | | sample.right += amplitude * m_panR; |
| | 304 | switch(m_outMode) { |
| | 305 | case 0: |
| | 306 | //trace("output audio"); |
| | 307 | for(i = start; i < end; i++) { |
| | 308 | amplitude = s_samples[i]; |
| | 309 | sample = samples[i]; |
| | 310 | sample.left += amplitude * m_panL; |
| | 311 | sample.right += amplitude * m_panR; |
| | 312 | } |
| | 313 | break; |
| | 314 | case 1: // overwrite |
| | 315 | //trace("output "+m_outPipe); |
| | 316 | arr = s_pipeArr[m_outPipe]; |
| | 317 | for(i = start; i < end; i++) { |
| | 318 | arr[i] = s_samples[i]; |
| | 319 | } |
| | 320 | break; |
| | 321 | case 2: // add |
| | 322 | arr = s_pipeArr[m_outPipe]; |
| | 323 | for(i = start; i < end; i++) { |
| | 324 | arr[i] += s_samples[i]; |
| | 325 | } |
| | 326 | break; |
| | 327 | default: |
| | 328 | break; |