void Oscil::uGenerate(float * channels, int numChannels) { // figure out our sample value float tmpAmp(0.f); // if something is plugged into amplitude if ( amplitude->isPatched() ) { tmpAmp = amplitude->getLastValues()[0]; } else { tmpAmp = mAmp; } // if something has been plugged into amplitudeModulation if ( amplitudeModulation->isPatched() ) { tmpAmp += amplitudeModulation->getLastValues()[0]; } // calculte the sample values float sample = tmpAmp * mWaveform->value(mStep); for(int i = 0; i < numChannels; i++) { channels[i] = sample; } // if something is plugged into frequency if ( frequency->isPatched() ) { mBaseFreq = Frequency::ofHertz( frequency->getLastValues()[0] ); stepSizeChanged(); } // if something is plugged into frequencyModulation if ( frequencyModulation->isPatched() ) { mFreq = Frequency::ofHertz( mBaseFreq.asHz() + frequencyModulation->getLastValues()[0] ); stepSizeChanged(); } else { mFreq = mBaseFreq; } // increase time mStep += mStepSize; // make sure we don't exceed 1.0. // floor is less expensive than %? mStep -= (float)floor(mStep); }
void ArcStyle::setStepSize(double arg) { if (m_stepSize == arg) return; m_stepSize = arg; emit stepSizeChanged(arg); }
void QRangeModel::setStepSize(qreal stepSize) { stepSize = qMax(qreal(0.0), stepSize); if (qFuzzyCompare(stepSize, m_stepSize)) return; const qreal oldValue = value(); const qreal oldPosition = position(); m_stepSize = stepSize; emit stepSizeChanged(m_stepSize); emitValueAndPositionIfChanged(oldValue, oldPosition); }
/** * Sets the frequency to a Frequency after construction. * @param freq */ void Oscil::setFrequency( const Frequency & freq ) { mBaseFreq = freq; mFreq = mBaseFreq; stepSizeChanged(); }
void Oscil::setFrequency( float hz ) { mBaseFreq = Frequency::ofHertz( hz ); mFreq = mBaseFreq; stepSizeChanged(); }
void Oscil::sampleRateChanged() { stepSizeChanged(); }
int QRangeModel::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QObject::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: valueChanged((*reinterpret_cast< qreal(*)>(_a[1]))); break; case 1: positionChanged((*reinterpret_cast< qreal(*)>(_a[1]))); break; case 2: stepSizeChanged((*reinterpret_cast< qreal(*)>(_a[1]))); break; case 3: invertedChanged((*reinterpret_cast< bool(*)>(_a[1]))); break; case 4: minimumChanged((*reinterpret_cast< qreal(*)>(_a[1]))); break; case 5: maximumChanged((*reinterpret_cast< qreal(*)>(_a[1]))); break; case 6: positionAtMinimumChanged((*reinterpret_cast< qreal(*)>(_a[1]))); break; case 7: positionAtMaximumChanged((*reinterpret_cast< qreal(*)>(_a[1]))); break; case 8: toMinimum(); break; case 9: toMaximum(); break; case 10: setValue((*reinterpret_cast< qreal(*)>(_a[1]))); break; case 11: setPosition((*reinterpret_cast< qreal(*)>(_a[1]))); break; case 12: { qreal _r = valueForPosition((*reinterpret_cast< qreal(*)>(_a[1]))); if (_a[0]) *reinterpret_cast< qreal*>(_a[0]) = _r; } break; case 13: { qreal _r = positionForValue((*reinterpret_cast< qreal(*)>(_a[1]))); if (_a[0]) *reinterpret_cast< qreal*>(_a[0]) = _r; } break; default: ; } _id -= 14; } #ifndef QT_NO_PROPERTIES else if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< qreal*>(_v) = value(); break; case 1: *reinterpret_cast< qreal*>(_v) = minimum(); break; case 2: *reinterpret_cast< qreal*>(_v) = maximum(); break; case 3: *reinterpret_cast< qreal*>(_v) = stepSize(); break; case 4: *reinterpret_cast< qreal*>(_v) = position(); break; case 5: *reinterpret_cast< qreal*>(_v) = positionAtMinimum(); break; case 6: *reinterpret_cast< qreal*>(_v) = positionAtMaximum(); break; case 7: *reinterpret_cast< bool*>(_v) = inverted(); break; } _id -= 8; } else if (_c == QMetaObject::WriteProperty) { void *_v = _a[0]; switch (_id) { case 0: setValue(*reinterpret_cast< qreal*>(_v)); break; case 1: setMinimum(*reinterpret_cast< qreal*>(_v)); break; case 2: setMaximum(*reinterpret_cast< qreal*>(_v)); break; case 3: setStepSize(*reinterpret_cast< qreal*>(_v)); break; case 4: setPosition(*reinterpret_cast< qreal*>(_v)); break; case 5: setPositionAtMinimum(*reinterpret_cast< qreal*>(_v)); break; case 6: setPositionAtMaximum(*reinterpret_cast< qreal*>(_v)); break; case 7: setInverted(*reinterpret_cast< bool*>(_v)); break; } _id -= 8; } else if (_c == QMetaObject::ResetProperty) { _id -= 8; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 8; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 8; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 8; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 8; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 8; } #endif // QT_NO_PROPERTIES return _id; }