Constness
This commit is contained in:
parent
ccf7ba303f
commit
75be994714
@ -247,7 +247,7 @@ inline void spectrum_spread(int nfreq, double samplerate,
|
||||
};
|
||||
|
||||
|
||||
inline void spectrum_do_compressor(ProcessParameters& pars, int nfreq, REALTYPE *freq1, REALTYPE *freq2) {
|
||||
inline void spectrum_do_compressor(const ProcessParameters& pars, int nfreq, REALTYPE *freq1, REALTYPE *freq2) {
|
||||
REALTYPE rms = 0.0;
|
||||
for (int i = 0; i<nfreq; i++) rms += freq1[i] * freq1[i];
|
||||
rms = sqrt(rms / nfreq)*0.1f;
|
||||
@ -257,7 +257,7 @@ inline void spectrum_do_compressor(ProcessParameters& pars, int nfreq, REALTYPE
|
||||
for (int i = 0; i<nfreq; i++) freq2[i] = freq1[i] * _rap;
|
||||
};
|
||||
|
||||
inline void spectrum_do_tonal_vs_noise(ProcessParameters& pars, int nfreq, double samplerate,
|
||||
inline void spectrum_do_tonal_vs_noise(const ProcessParameters& pars, int nfreq, double samplerate,
|
||||
std::vector<REALTYPE>& tmpfreq1,
|
||||
REALTYPE *freq1, REALTYPE *freq2) {
|
||||
spectrum_spread(nfreq, samplerate, tmpfreq1, freq1, tmpfreq1.data(), pars.tonal_vs_noise.bandwidth);
|
||||
@ -291,7 +291,7 @@ inline void spectrum_do_tonal_vs_noise(ProcessParameters& pars, int nfreq, doubl
|
||||
|
||||
};
|
||||
|
||||
inline void spectrum_do_harmonics(ProcessParameters& pars, std::vector<REALTYPE>& tmpfreq1, int nfreq, double samplerate, REALTYPE *freq1, REALTYPE *freq2) {
|
||||
inline void spectrum_do_harmonics(const ProcessParameters& pars, std::vector<REALTYPE>& tmpfreq1, int nfreq, double samplerate, REALTYPE *freq1, REALTYPE *freq2) {
|
||||
REALTYPE freq = pars.harmonics.freq;
|
||||
REALTYPE bandwidth = pars.harmonics.bandwidth;
|
||||
int nharmonics = pars.harmonics.nharmonics;
|
||||
@ -347,7 +347,7 @@ inline void spectrum_zero(int nfreq,REALTYPE *freq1) {
|
||||
for (int i = 0; i<nfreq; i++) freq1[i] = 0.0;
|
||||
};
|
||||
|
||||
inline void spectrum_do_freq_shift(ProcessParameters& pars, int nfreq, double samplerate, REALTYPE *freq1, REALTYPE *freq2) {
|
||||
inline void spectrum_do_freq_shift(const ProcessParameters& pars, int nfreq, double samplerate, REALTYPE *freq1, REALTYPE *freq2) {
|
||||
spectrum_zero(nfreq, freq2);
|
||||
int ifreq = (int)(pars.freq_shift.Hz / (samplerate*0.5)*nfreq);
|
||||
for (int i = 0; i<nfreq; i++) {
|
||||
@ -356,7 +356,7 @@ inline void spectrum_do_freq_shift(ProcessParameters& pars, int nfreq, double sa
|
||||
};
|
||||
};
|
||||
|
||||
inline void spectrum_do_pitch_shift(ProcessParameters& pars, int nfreq, REALTYPE *freq1, REALTYPE *freq2, REALTYPE _rap) {
|
||||
inline void spectrum_do_pitch_shift(const ProcessParameters& pars, int nfreq, REALTYPE *freq1, REALTYPE *freq2, REALTYPE _rap) {
|
||||
spectrum_zero(nfreq,freq2);
|
||||
if (_rap<1.0) {//down
|
||||
for (int i = 0; i<nfreq; i++) {
|
||||
@ -374,7 +374,7 @@ inline void spectrum_do_pitch_shift(ProcessParameters& pars, int nfreq, REALTYPE
|
||||
};
|
||||
};
|
||||
|
||||
inline void spectrum_do_octave(ProcessParameters& pars, int nfreq, double samplerate,
|
||||
inline void spectrum_do_octave(const ProcessParameters& pars, int nfreq, double samplerate,
|
||||
std::vector<REALTYPE>& sumfreq,
|
||||
std::vector<REALTYPE>& tmpfreq1,
|
||||
REALTYPE *freq1, REALTYPE *freq2) {
|
||||
@ -408,7 +408,7 @@ inline void spectrum_do_octave(ProcessParameters& pars, int nfreq, double sample
|
||||
for (int i = 0; i<nfreq; i++) freq2[i] = sumfreq[i] / sum;
|
||||
};
|
||||
|
||||
inline void spectrum_do_filter(ProcessParameters& pars, int nfreq, double samplerate, REALTYPE *freq1, REALTYPE *freq2) {
|
||||
inline void spectrum_do_filter(const ProcessParameters& pars, int nfreq, double samplerate, REALTYPE *freq1, REALTYPE *freq2) {
|
||||
REALTYPE low = 0, high = 0;
|
||||
if (pars.filter.low<pars.filter.high) {//sort the low/high freqs
|
||||
low = pars.filter.low;
|
||||
|
@ -476,7 +476,7 @@ void StretchAudioSource::setProcessParameters(ProcessParameters * pars)
|
||||
++m_param_change_count;
|
||||
}
|
||||
|
||||
ProcessParameters StretchAudioSource::getProcessParameters()
|
||||
const ProcessParameters& StretchAudioSource::getProcessParameters()
|
||||
{
|
||||
return m_ppar;
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ public:
|
||||
void setRate(double rate);
|
||||
double getRate() { return m_playrate; }
|
||||
void setProcessParameters(ProcessParameters* pars);
|
||||
ProcessParameters getProcessParameters();
|
||||
const ProcessParameters& getProcessParameters();
|
||||
void setFFTSize(int size);
|
||||
int getFFTSize() { return m_process_fftsize; }
|
||||
|
||||
|
@ -444,7 +444,7 @@ SpectralVisualizer::SpectralVisualizer()
|
||||
m_img = Image(Image::RGB, 500, 200, true);
|
||||
}
|
||||
|
||||
void SpectralVisualizer::setState(ProcessParameters & pars, int nfreqs, double samplerate)
|
||||
void SpectralVisualizer::setState(const ProcessParameters & pars, int nfreqs, double samplerate)
|
||||
{
|
||||
double t0 = Time::getMillisecondCounterHiRes();
|
||||
double hz = 440.0;
|
||||
|
@ -19,7 +19,7 @@ class SpectralVisualizer : public Component
|
||||
{
|
||||
public:
|
||||
SpectralVisualizer();
|
||||
void setState(ProcessParameters& pars, int nfreqs, double samplerate);
|
||||
void setState(const ProcessParameters& pars, int nfreqs, double samplerate);
|
||||
void paint(Graphics& g) override;
|
||||
|
||||
private:
|
||||
|
Loading…
Reference in New Issue
Block a user