ZynAddSubFX: Pruning code from static analysis
Static analysis performed with cppcheck and clang (cherry picked from commit 7540c6b46e2e6158a38464aeb9a8b35fefc3c9a9)
This commit is contained in:
@@ -58,7 +58,6 @@ class Phaser:public Effect
|
||||
unsigned char Poutsub; //if I wish to subtract the output instead of adding
|
||||
unsigned char Pphase;
|
||||
unsigned char Phyper; //lfo^2 -- converts tri into hyper-sine
|
||||
unsigned char Pbarber; //Enable parber pole phasing
|
||||
unsigned char Panalog;
|
||||
|
||||
//Control parameters
|
||||
|
||||
@@ -248,10 +248,8 @@ void Reverb::settime(unsigned char Ptime)
|
||||
|
||||
void Reverb::setlohidamp(unsigned char Plohidamp)
|
||||
{
|
||||
REALTYPE x;
|
||||
|
||||
if(Plohidamp < 64)
|
||||
Plohidamp = 64; //remove this when the high part from lohidamp will be added
|
||||
Plohidamp = 64; //remove this when the high part from lohidamp will be added
|
||||
|
||||
this->Plohidamp = Plohidamp;
|
||||
if(Plohidamp == 64) {
|
||||
@@ -263,7 +261,7 @@ void Reverb::setlohidamp(unsigned char Plohidamp)
|
||||
lohidamptype = 1;
|
||||
if(Plohidamp > 64)
|
||||
lohidamptype = 2;
|
||||
x = fabs((REALTYPE)(Plohidamp - 64) / 64.1);
|
||||
REALTYPE x = fabs((REALTYPE)(Plohidamp - 64) / 64.1);
|
||||
lohifb = x * x;
|
||||
}
|
||||
}
|
||||
@@ -330,7 +328,7 @@ void Reverb::setlpf(unsigned char Plpf)
|
||||
void Reverb::settype(unsigned char Ptype)
|
||||
{
|
||||
const int NUM_TYPES = 3;
|
||||
int combtunings[NUM_TYPES][REV_COMBS] = {
|
||||
const int combtunings[NUM_TYPES][REV_COMBS] = {
|
||||
//this is unused (for random)
|
||||
{0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
//Freeverb by Jezar at Dreampoint
|
||||
@@ -338,7 +336,7 @@ void Reverb::settype(unsigned char Ptype)
|
||||
//Freeverb by Jezar at Dreampoint //duplicate
|
||||
{1116, 1188, 1277, 1356, 1422, 1491, 1557, 1617 }
|
||||
};
|
||||
int aptunings[NUM_TYPES][REV_APS] = {
|
||||
const int aptunings[NUM_TYPES][REV_APS] = {
|
||||
//this is unused (for random)
|
||||
{0, 0, 0, 0 },
|
||||
//Freeverb by Jezar at Dreampoint
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#ifndef UTIL_H
|
||||
#define UTIL_H
|
||||
|
||||
#include <cstdio>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include "../globals.h"
|
||||
|
||||
@@ -88,7 +88,7 @@ bool PresetsStore::presetstruct::operator<(const presetstruct &b) const
|
||||
}
|
||||
|
||||
|
||||
void PresetsStore::rescanforpresets(string type)
|
||||
void PresetsStore::rescanforpresets(const string &type)
|
||||
{
|
||||
//std::cout << "Scanning For Presets" << std::endl;
|
||||
//std::cout << "Of Type: " << type << std::endl;
|
||||
|
||||
@@ -52,7 +52,7 @@ class PresetsStore
|
||||
};
|
||||
std::vector<presetstruct> presets;
|
||||
|
||||
void rescanforpresets(const std::string type);
|
||||
void rescanforpresets(const std::string &type);
|
||||
|
||||
private:
|
||||
struct {
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
#include "MIDIFile.h"
|
||||
|
||||
|
||||
@@ -235,8 +236,7 @@ void MIDIFile::parsenoteoff(char ntrack, char chan, unsigned int dt)
|
||||
unsigned char note;
|
||||
note = getbyte();
|
||||
|
||||
unsigned char noteoff_velocity = getbyte(); //unused by zynaddsubfx
|
||||
noteoff_velocity = 0;
|
||||
(void) getbyte(); //Read in unused noteoff_velocity
|
||||
if(chan >= NUM_MIDI_CHANNELS)
|
||||
return;
|
||||
|
||||
@@ -346,7 +346,6 @@ void MIDIFile::clearmidifile()
|
||||
midifilesize = 0;
|
||||
midifilek = 0;
|
||||
midieof = false;
|
||||
data.tick = 0.05;
|
||||
}
|
||||
|
||||
unsigned char MIDIFile::getbyte()
|
||||
@@ -394,14 +393,13 @@ unsigned short int MIDIFile::getint16()
|
||||
unsigned int MIDIFile::getvarint32()
|
||||
{
|
||||
unsigned long result = 0;
|
||||
unsigned char b;
|
||||
|
||||
/// printf("\n[start]");
|
||||
|
||||
if((result = getbyte()) & 0x80) {
|
||||
result &= 0x7f;
|
||||
uint8_t b;
|
||||
do {
|
||||
b = getbyte();
|
||||
b = getbyte();
|
||||
result = (result << 7) + (b & 0x7f);
|
||||
} while(b & 0x80);
|
||||
}
|
||||
|
||||
@@ -83,10 +83,6 @@ class MIDIFile
|
||||
|
||||
//skip some bytes
|
||||
void skipnbytes(int n);
|
||||
|
||||
struct {
|
||||
double tick; //how many seconds one tick has
|
||||
} data;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -20,8 +20,9 @@
|
||||
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <cmath>
|
||||
#include "Envelope.h"
|
||||
#include "../Params/EnvelopeParams.h"
|
||||
|
||||
Envelope::Envelope(EnvelopeParams *envpars, REALTYPE basefreq)
|
||||
{
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
#ifndef ENVELOPE_H
|
||||
#define ENVELOPE_H
|
||||
|
||||
#include <math.h>
|
||||
#include "../globals.h"
|
||||
#include "../Params/EnvelopeParams.h"
|
||||
|
||||
@@ -33,7 +32,7 @@ class Envelope
|
||||
public:
|
||||
|
||||
/**Constructor*/
|
||||
Envelope(EnvelopeParams *envpars, REALTYPE basefreq);
|
||||
Envelope(class EnvelopeParams *envpars, REALTYPE basefreq);
|
||||
/**Destructor*/
|
||||
~Envelope();
|
||||
void relasekey();
|
||||
|
||||
@@ -933,7 +933,7 @@ void OscilGen::prepare()
|
||||
|
||||
void OscilGen::adaptiveharmonic(FFTFREQS f, REALTYPE freq)
|
||||
{
|
||||
if((Padaptiveharmonics == 0) /*||(freq<1.0)*/)
|
||||
if(Padaptiveharmonics == 0 /*||(freq<1.0)*/)
|
||||
return;
|
||||
if(freq < 1.0)
|
||||
freq = 440.0;
|
||||
|
||||
@@ -1049,7 +1049,7 @@ char tmp[10];
|
||||
while (klimits[k]!=0){
|
||||
sprintf(tmp,"%d",klimits[k]);
|
||||
keylimitlist->add(tmp);
|
||||
if ((val==-1)){
|
||||
if (val==-1){
|
||||
if (klimits[k]>part->Pkeylimit) val=k;
|
||||
};
|
||||
k++;
|
||||
|
||||
Reference in New Issue
Block a user